imageeditor/plugins/CropPlugin/src/ImageEditorCropControl.cpp
author Mikael Laine <mikael.laine@ixonos.com>
Fri, 29 Jan 2010 13:53:17 +0200
changeset 1 edfc90759b9f
permissions -rw-r--r--
Committing the Image Editor package under the Eclipse Public License
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     1
/*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Ixonos Plc.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     3
* All rights reserved.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     5
* under the terms of the "Eclipse Public License v1.0"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     8
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     9
* Initial Contributors:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    10
* Nokia Corporation - Initial contribution
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    11
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    12
* Contributors:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    13
* Ixonos Plc
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    14
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    15
* Description: 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    16
* Crop plugin's control class.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    17
*
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    18
*/
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    19
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    20
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    21
//  INCLUDES
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    22
#include <fbs.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    23
#include <badesca.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    24
#include <eikenv.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    25
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    26
#include <ImageEditorUI.mbg>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    27
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    28
#include <aknview.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    29
#include <aknutils.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    30
#include <AknInfoPopupNoteController.h> 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    31
#include <crop.rsg> 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    32
#include <bautils.h> 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    33
#include <ConeResLoader.h> 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    34
#include <StringLoader.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    35
#include <AknIconUtils.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    36
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    37
#ifdef RD_TACTILE_FEEDBACK 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    38
#include <touchfeedback.h>
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    39
#endif /* RD_TACTILE_FEEDBACK  */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    40
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    41
#include "ImageEditorUI.hrh"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    42
#include "ImageEditorPluginBase.hrh"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    43
#include "PluginInfo.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    44
#include "DrawUtils.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    45
#include "SystemParameters.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    46
#include "JpTimer.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    47
#include "ImageEditorUIDefs.h" 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    48
#include "iepb.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    49
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    50
#include "ImageEditorCropControl.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    51
#include "ImageEditorError.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    52
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    53
// debug log
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    54
#include "imageeditordebugutils.h"
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    55
_LIT(KCropPluginLogFile,"CropPlugin.log");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    56
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    57
// Resource file name
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    58
_LIT (KPgnResourceFile, "crop.rsc"); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    59
// Separator to navi pane text
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    60
_LIT( KCropNaviTextSeparator, "x" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    61
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    62
//  CONSTANTS
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    63
const float KParamStep              = 0.005F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    64
const float KMinCropRelDistFrac     = 0.01F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    65
const float KCursorScalingFactor    = 0.7F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    66
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    67
const TInt  KMaxCropAbsoluteMin     = 75;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    68
const TInt  KMinSourceSize          = 75;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    69
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    70
//const TInt  KStatusPaneTextMoveIndex = 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    71
const TInt  KStatusPaneTextAreaIndex = 2;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    72
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    73
// Default value from CPreviewControlBase not used
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    74
const TInt KCropFastKeyTimerDelayInMicroseconds = 1000;
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
//  Used fixed point resolution for scales
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    77
//const TInt KScaleBits = 12;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    78
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    79
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    80
CImageEditorCropControl * CImageEditorCropControl::NewL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    81
    const TRect& aRect,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    82
    CCoeControl* aParent
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    83
    )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    84
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    85
    LOG(KCropPluginLogFile, "CImageEditorCropControl::NewL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    86
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    87
    CImageEditorCropControl * self = new (ELeave) CImageEditorCropControl;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    88
    CleanupStack::PushL (self);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    89
    self->ConstructL (aRect, aParent);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    90
    CleanupStack::Pop ();   // self
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    91
    return self;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    92
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    93
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    94
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    95
TInt CImageEditorCropControl::DancingAntsCallback (TAny * aPtr)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    96
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    97
    ((CImageEditorCropControl *)aPtr)->OnDancingAntsCallBack();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    98
    return KErrNone;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    99
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   100
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   101
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   102
TInt CImageEditorCropControl::FastKeyCallback (TAny * aPtr)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   103
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   104
    TRAPD( err, ((CImageEditorCropControl *)aPtr)->OnFastKeyCallBackL() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   105
    return err;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   106
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   107
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   108
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   109
CImageEditorCropControl::CImageEditorCropControl () :
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   110
iState (ECropStateFirst),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   111
iFastKeyTimerState (ETimerInactive),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   112
iHandleEventKeys (ETrue),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   113
iTickCount (0),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   114
iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   115
iReadyToRender(EFalse)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   116
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   117
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   118
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   119
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   120
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   121
CImageEditorCropControl::~CImageEditorCropControl ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   122
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   123
    iEditorView = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   124
    iItem = NULL;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   125
    iSysPars = NULL;
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
    delete iCrossHair;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   128
    delete iCrossHairMask;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   129
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   130
    delete iSecondaryCrossHair;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   131
    delete iSecondaryCrossHairMask;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   132
    if (iTimer)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   133
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   134
        iTimer->Cancel();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   135
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   136
    delete iTimer;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   137
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   138
    delete iPopupController;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   139
    delete iTooltipResize;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   140
    delete iTooltipMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   141
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   142
#ifdef DOUBLE_BUFFERED_CROP    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   143
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   144
    delete iBufBitmap;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   145
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   146
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   147
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   148
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   149
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   150
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   151
void CImageEditorCropControl::ConstructL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   152
    const TRect& /*aRect*/,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   153
    CCoeControl* aParent
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   154
    )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   155
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   156
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ConstructL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   157
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   158
    //    Set parent window
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   159
    SetContainerWindowL (*aParent);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   160
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   161
    // Load MAIN CROSSHAIR image
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   162
    SDrawUtils::GetIndicatorBitmapL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   163
        iCrossHair, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   164
        iCrossHairMask,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   165
        EMbmImageeditoruiQgn_indi_imed_cursor_super,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   166
        EMbmImageeditoruiQgn_indi_imed_cursor_super_mask        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   167
        );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   168
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   169
   // Load  SECOND CROSSHAIR image
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   170
    SDrawUtils::GetIndicatorBitmapL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   171
        iSecondaryCrossHair, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   172
        iSecondaryCrossHairMask, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   173
        EMbmImageeditoruiQgn_indi_imed_cursor2_super,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   174
        EMbmImageeditoruiQgn_indi_imed_cursor2_super_mask        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   175
        );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   176
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   177
    TSize chSize = iCrossHair->SizeInPixels();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   178
    TSize chNewSize = TSize( ( chSize.iWidth * KCursorScalingFactor ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   179
                              ( chSize.iHeight * KCursorScalingFactor ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   180
    // Set secondary cursor size smaller than the main cursor
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   181
    AknIconUtils::SetSize( iSecondaryCrossHair, chNewSize );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   182
    AknIconUtils::SetSize( iSecondaryCrossHairMask, chNewSize );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   183
                         
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   184
    //  Create and start timer for dancing ants and fast key events
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   185
    iTimer = CPeriodic::NewL (CActive::EPriorityStandard);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   186
    StartDancingAntsTimer();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   187
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   188
    iPopupController = CAknInfoPopupNoteController::NewL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   189
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   190
    TFileName resourcefile;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   191
    resourcefile.Append(KPgnResourcePath);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   192
    resourcefile.Append(KPgnResourceFile);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   193
    User::LeaveIfError( CompleteWithAppPath( resourcefile ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   194
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   195
    //    Read tooltip resources  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   196
    //  (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   197
    RConeResourceLoader resLoader ( *CEikonEnv::Static() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   198
    CleanupClosePushL ( resLoader );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   199
    resLoader.OpenL ( resourcefile );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   200
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   201
    iTooltipResize = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CROP_RESIZE_AREA);    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   202
    iTooltipMove = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CROP_MOVE_AREA);    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   203
      
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   204
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   205
#ifdef RD_TACTILE_FEEDBACK 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   206
    iTouchFeedBack = MTouchFeedback::Instance();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   207
#endif /* RD_TACTILE_FEEDBACK  */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   208
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   209
    CleanupStack::PopAndDestroy(); // resLoader
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   210
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   211
    EnableDragEvents();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   212
       
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   213
    //    Activate control
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   214
    ActivateL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   215
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   216
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   217
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   218
void CImageEditorCropControl::Draw (const TRect & aRect) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   219
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   220
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   221
#ifndef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   222
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   223
    CPreviewControlBase::DrawPreviewImage (aRect);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   224
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   225
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   226
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   227
    if ( iState != ECropStateMin )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   228
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   229
        //  Get graphics context
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   230
        CWindowGc & gc = SystemGc();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   231
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   232
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   233
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   234
        if ( iBufBitmap && iBufBitmap->Handle() )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   235
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   236
            gc.BitBlt(TPoint(0,0), iBufBitmap);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   237
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   238
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   239
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   240
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   241
        //  Compute crop rectangle inside the image area
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   242
        TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   243
        TInt w = (rect.iBr.iX - rect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   244
        TInt h = (rect.iBr.iY - rect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   245
        TInt ulc = (TInt) (iULC * w + 0.5) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   246
        TInt ulr = (TInt) (iULR * h + 0.5) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   247
        TInt lrc = (TInt) (iLRC * w + 0.5) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   248
        TInt lrr = (TInt) (iLRR * h + 0.5) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   249
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   250
#ifndef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   251
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   252
        //    Darken areas in the image that are outside crop rectangle
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   253
        gc.SetDrawMode (CGraphicsContext::EDrawModeAND);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   254
        gc.SetPenStyle (CGraphicsContext::ENullPen);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   255
        gc.SetPenColor (KRgbBlack);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   256
        gc.SetBrushStyle (CGraphicsContext::EDiamondCrossHatchBrush);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   257
        gc.SetBrushColor (KRgbWhite);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   258
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   259
        //    Darken top
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   260
        gc.DrawRect ( TRect ( rect.iTl.iX, 0, rect.iBr.iX, ulr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   261
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   262
        //    Darken left side
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   263
        gc.DrawRect ( TRect( rect.iTl.iX, ulr, ulc, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   264
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   265
        //    Darken right side
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   266
        gc.DrawRect ( TRect( lrc, ulr, rect.iBr.iX, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   267
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   268
        //    Darken bottom
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   269
        gc.DrawRect ( TRect( rect.iTl.iX, lrr, rect.iBr.iX, Rect().iBr.iY ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   270
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   271
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   272
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   273
        //  Draw crop rectangle with dancing antz
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   274
        DrawDancingAnts (aRect);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   275
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   276
        DrawCursors( TRect( ulc, ulr, lrc, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   277
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   278
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   279
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   280
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   281
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   282
void CImageEditorCropControl::DrawCursors (const TRect& aCropRect) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   283
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   284
    CWindowGc & gc = SystemGc();
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
    CFbsBitmap* mainCrossHair;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   287
    CFbsBitmap* mainCrossHairMask;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   288
    if ( iState == ECropStateMove )
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
        mainCrossHair = iSecondaryCrossHair;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   291
        mainCrossHairMask = iSecondaryCrossHairMask;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   292
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   293
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   294
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   295
        mainCrossHair = iCrossHair;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   296
        mainCrossHairMask = iCrossHairMask;
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
            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   299
    //  Draw the main cross hair
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   300
	if ( mainCrossHair && mainCrossHair )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   301
	    {       
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   302
		TInt cx = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   303
		TInt cy = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   304
		if (iState == ECropStateFirst || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   305
		    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   306
			cx = aCropRect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   307
			cy = aCropRect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   308
	    	}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   309
		else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   310
		    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   311
			cx = aCropRect.iBr.iX - 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   312
			cy = aCropRect.iBr.iY - 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   313
	    	}
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
		TSize chSize = mainCrossHair->SizeInPixels();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   316
		gc.BitBltMasked (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   317
			TPoint(cx - (chSize.iWidth >> 1), cy - (chSize.iHeight >> 1)), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   318
			mainCrossHair, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   319
			TRect (chSize), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   320
			mainCrossHairMask, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   321
			EFalse
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   322
			);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   323
	    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   324
	    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   325
    //  Draw the secondary cross hair
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   326
    if ( iSecondaryCrossHair && iSecondaryCrossHairMask )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   327
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   328
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   329
        TInt cx = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   330
        TInt cy = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   331
        if (iState == ECropStateFirst || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   332
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   333
            cx = aCropRect.iBr.iX - 1;  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   334
            cy = aCropRect.iBr.iY - 1;          
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   335
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   336
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   337
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   338
            cx = aCropRect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   339
            cy = aCropRect.iTl.iY;
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   342
        TSize chSize = iSecondaryCrossHair->SizeInPixels();            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   343
        gc.BitBltMasked (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   344
            TPoint(cx - (chSize.iWidth >> 1), cy - (chSize.iHeight >> 1)), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   345
            iSecondaryCrossHair, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   346
            TRect (chSize), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   347
            iSecondaryCrossHairMask, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   348
            EFalse
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   349
            );        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   350
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   351
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   352
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   353
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   354
void CImageEditorCropControl::DrawDancingAnts (const TRect & /*aRect*/) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   355
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   356
    //  Get graphics context
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   357
    CWindowGc & gc = SystemGc();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   358
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   359
    //  Compute crop rectangle inside the image area
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   360
    TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   361
    TInt w = (rect.iBr.iX - rect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   362
    TInt h = (rect.iBr.iY - rect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   363
    TInt ulc = (TInt) (iULC * w) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   364
    TInt ulr = (TInt) (iULR * h) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   365
    TInt lrc = (TInt) (iLRC * w) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   366
    TInt lrr = (TInt) (iLRR * h) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   367
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   368
    //    Crop needed rectangles
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   369
    TRect cr (ulc, ulr, lrc, lrr); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   370
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   371
    //  Draw the "dancing ants" rectangle
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   372
    gc.SetDrawMode (CGraphicsContext::EDrawModePEN);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   373
    gc.SetBrushStyle (CGraphicsContext::ENullBrush);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   374
    gc.SetBrushColor (KRgbBlack);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   375
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   376
    //    Draw 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   377
    gc.SetPenStyle (CGraphicsContext::ESolidPen);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   378
    gc.SetPenColor ((iAntFlag) ? (KRgbBlack) : (KRgbWhite));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   379
    gc.DrawRect (cr);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   380
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   381
    //    Draw dashed line
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   382
    gc.SetPenStyle (CGraphicsContext::EDashedPen);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   383
    gc.SetPenColor ((iAntFlag) ? (KRgbWhite) : (KRgbBlack));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   384
    gc.DrawRect (cr);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   385
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   386
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   387
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   388
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   389
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   390
void CImageEditorCropControl::SetView (CAknView * aView)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   391
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   392
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetView()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   393
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   394
    iEditorView = aView;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   395
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   396
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   397
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   398
void CImageEditorCropControl::SetSelectedUiItemL (CPluginInfo * aItem)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   399
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   400
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetSelectedUiItemL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   401
    iItem = aItem;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   402
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   403
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   404
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   405
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   406
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   407
void CImageEditorCropControl::SetImageL (CFbsBitmap * aBitmap)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   408
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   409
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetImageL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   410
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   411
    //    Create preview bitmap
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   412
    iPrevBitmap = aBitmap;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   413
    TSize size = iPrevBitmap->SizeInPixels();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   414
    TDisplayMode dmode = iPrevBitmap->DisplayMode();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   415
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   416
    delete iBufBitmap;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   417
    iBufBitmap = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   418
    iBufBitmap = new (ELeave) CFbsBitmap;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   419
    User::LeaveIfError ( iBufBitmap->Create(size, dmode) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   420
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   421
    //    Copy bitmap data
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   422
    ClonePreviewBitmapL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   423
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   424
    DrawNow();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   425
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   426
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   427
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   428
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   429
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   430
TKeyResponse CImageEditorCropControl::OfferKeyEventL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   431
    const TKeyEvent &   aKeyEvent,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   432
    TEventCode          aType
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   433
    )
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
    LOG(KCropPluginLogFile, "CImageEditorCropControl::OfferKeyEventL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   436
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   437
    TKeyResponse response = EKeyWasNotConsumed;
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
    //  If busy, do not handle anything
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   440
    if ( Busy() )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   441
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   442
        response = EKeyWasConsumed;
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   445
    //  EVENTKEY
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   446
    else if (EEventKey == aType && iHandleEventKeys)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   447
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   448
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   449
        switch (aKeyEvent.iCode)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   450
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   451
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   452
            case EKeyDownArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   453
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   454
                //  Adjust crop point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   455
                NaviDownL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   456
                iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   457
                DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   458
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   459
                iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   460
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   461
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   462
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   463
            case EKeyUpArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   464
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   465
                //  Adjust crop point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   466
                NaviUpL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   467
                iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   468
                DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   469
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   470
                iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   471
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   472
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   473
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   474
            case EKeyRightArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   475
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   476
                //  Adjust crop point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   477
                NaviRightL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   478
                iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   479
                DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   480
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   481
                iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   482
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   483
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   484
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   485
            case EKeyLeftArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   486
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   487
                //  Adjust crop point
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   488
                NaviLeftL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   489
                iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   490
                DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   491
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   492
                iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   493
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   494
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   495
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   496
            case EKeyOK:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   497
            case EKeyEnter:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   498
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   499
                StartDancingAntsTimer();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   500
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   501
                if ( iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   502
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   503
                    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   504
                    if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   505
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   506
                        iState = ECropStateSecond;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   507
                        iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   508
                        iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   509
                        DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   510
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   511
                    else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   512
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   513
                        iState = ECropStateMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   514
                        iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   515
                        iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   516
                        DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   517
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   518
                    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   519
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   520
                        iState = ECropStateMin;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   521
                        iReadyToRender = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   522
                        iEditorView->HandleCommandL (EImageEditorResetZoom);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   523
                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   524
                        if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   525
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   526
                            iEditorView->HandleCommandL (EImageEditorCancelPlugin);    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   527
                        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   528
                        else
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
                            iEditorView->HandleCommandL (EImageEditorApplyPlugin);
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
                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   533
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   534
                    response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   535
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   536
                else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   537
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   538
                    if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   539
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   540
                        iState = ECropStateSecond;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   541
                        iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   542
                        iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   543
                        DrawNow();
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
                    else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   546
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   547
                        iState = ECropStateMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   548
                        iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   549
                        iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   550
                        DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   551
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   552
                    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   553
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   554
                        ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   555
                        iState = ECropStateMin;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   556
                        iReadyToRender = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   557
                        iEditorView->HandleCommandL (EImageEditorResetZoom);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   558
                        if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   559
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   560
                            iEditorView->HandleCommandL (EImageEditorCancelPlugin);    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   561
                        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   562
                        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   563
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   564
                            iEditorView->HandleCommandL (EImageEditorApplyPlugin);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   565
                        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   566
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   567
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   568
                    response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   569
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   570
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   571
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   572
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   573
            case 0x2a: // *
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   574
            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
   575
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   576
            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   577
                //    Check for minimum crop size            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   578
                TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   579
                TInt width = (TInt)((iLRC - iULC) * (virect.iBr.iX - virect.iTl.iX) + 0.5F);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   580
                width = (TInt)(width * iSysPars->Scale() + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   581
                TInt height = (TInt)((iLRR - iULR) * (virect.iBr.iY - virect.iTl.iY) + 0.5F);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   582
                height = (TInt)(height * iSysPars->Scale() + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   583
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   584
                TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   585
                TInt minCrop = (TInt)(KMaxCropAbsoluteMin * relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   586
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   587
                if ( (width <= minCrop) || (height <= minCrop) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   588
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   589
                    response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   590
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   591
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   592
                //    Store crop rectangle relative to screen
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   593
                StoreCropRelScreen();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   594
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   595
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   596
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   597
            case 0x23: // #
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   598
            case EStdKeyDecVolume: // zoom out key
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   599
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   600
                //    Store crop rectangle relative to screen
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   601
                StoreCropRelScreen();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   602
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   603
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   604
            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   605
            // Consume rotation keys to disable rotation
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   606
#ifndef LANDSCAPE_ROTATE_HOTKEYS        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   607
            case 0x31: // 1
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   608
#else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   609
            case 0x33: // 3            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   610
#endif
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   611
#ifndef LANDSCAPE_ROTATE_HOTKEYS                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   612
            case 0x33: // 3
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   613
#else            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   614
            case 0x39: // 9
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   615
#endif            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   616
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   617
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   618
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   619
            } 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   620
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   621
            default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   622
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   623
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   624
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   625
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   626
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   627
        // If the device is really slow, it may happen that the timer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   628
        // does not get execution time and slows down or halts completely.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   629
        // (Ideally, this should not happen.)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   630
        // This block is just to make sure that the cursor keeps moving
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   631
        // even if the timer halts.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   632
        if (ETimerStarted == iFastKeyTimerState)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   633
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   634
            if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks)
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
                iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   637
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   638
            else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   639
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   640
                iTickCount++;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   641
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   642
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   643
    }
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
    else if (EEventKey == aType && !iHandleEventKeys)
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
        response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   648
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   649
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   650
    //  EVENTKEYDOWN
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   651
    else if (EEventKeyDown == aType)
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
        switch (aKeyEvent.iScanCode)
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
            case EStdKeyLeftArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   658
            case EStdKeyRightArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   659
            case EStdKeyUpArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   660
            case EStdKeyDownArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   661
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   662
                iPressedKeyScanCode = aKeyEvent.iScanCode;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   663
                StartFastKeyTimer();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   664
                response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   665
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   666
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   667
            default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   668
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   669
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   670
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   671
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   672
    //  EVENTKEYUP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   673
    else if (EEventKeyUp == aType)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   674
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   675
        if (aKeyEvent.iScanCode == iPressedKeyScanCode)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   676
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   677
            iHandleEventKeys = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   678
            iFastKeyTimerState = ETimerInactive;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   679
            StartDancingAntsTimer();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   680
            response = EKeyWasConsumed;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   681
            ShowTooltip();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   682
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   683
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   684
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   685
    return response;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   686
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   687
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   688
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   689
void CImageEditorCropControl::SizeChanged()
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
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SizeChanged()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   692
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   693
}
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
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   696
TDesC & CImageEditorCropControl::GetParam ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   697
{     
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   698
    LOG(KCropPluginLogFile, "CImageEditorCropControl::GetParam()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   699
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   700
    // Do not set crop paramater before valid area is selected,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   701
    // otherwise preview image is cropped when zooming or panning
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   702
    if (iReadyToRender)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   703
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   704
        iParam.Copy (_L("x1 "));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   705
        iParam.AppendNum (iCropX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   706
        iParam.Append (_L(" y1 "));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   707
        iParam.AppendNum (iCropY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   708
        iParam.Append (_L(" x2 "));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   709
        iParam.AppendNum (iCropX + iCropW);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   710
        iParam.Append (_L(" y2 "));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   711
        iParam.AppendNum (iCropY + iCropH);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   712
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   713
    return iParam;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   714
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   715
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   716
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   717
void CImageEditorCropControl::SetSystemParameters ( const CSystemParameters * aPars) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   718
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   719
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetSystemParameters()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   720
    iSysPars = aPars;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   721
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   722
 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   723
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   724
void CImageEditorCropControl::SetCropModeL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   725
    const TInt      aMode,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   726
    const float     aRatio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   727
    )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   728
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   729
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetCropModeL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   730
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   731
    //  Store crop mode
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   732
    iIsCropModeManual = (aMode == 0);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   733
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   734
    //  Store wanted aspect ratio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   735
    iCropRatio = aRatio;
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
    //    Set initial points according to the cropping mode (aspect ratio)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   738
    SetInitialPointsL ();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   739
    // Shows the first tooltip when the plugin is entered
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   740
    ShowTooltip();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   741
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   742
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   743
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   744
void CImageEditorCropControl::HandlePluginCommandL (const TInt aCommand)
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
    LOGFMT(KCropPluginLogFile, "CImageEditorCropControl::HandlePluginCommandL(), aCommand = %d", aCommand);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   747
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   748
    switch (aCommand) 
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   751
        //    Control focus gained, start dancing ants timer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   752
        case EImageEditorFocusGained:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   753
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   754
            StartDancingAntsTimer();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   755
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   756
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   757
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   758
        //    Control focus lost, stop dancing ants timer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   759
        case EImageEditorFocusLost:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   760
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   761
            if (iTimer)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   762
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   763
                iTimer->Cancel();
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
            break;
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
        //    Visible image area changes => update crop parameters and
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   769
        //    screen buffer
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   770
        case EImageEditorGlobalZoomChanged:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   771
        case EImageEditorGlobalPanChanged:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   772
        case EImageEditorGlobalRotationChanged:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   773
        case EImageEditorPostScreenModeChange:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   774
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   775
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   776
            if ( aCommand == EImageEditorGlobalZoomChanged )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   777
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   778
                RestoreCropRelScreen();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   779
                UpdateCropRectangle();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   780
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   781
            else if ( aCommand == EImageEditorPostScreenModeChange )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   782
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   783
                RestoreCropRelImage();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   784
                UpdateCropRectangle();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   785
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   786
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   787
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   788
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   789
            ClonePreviewBitmapL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   790
            DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   791
            DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   792
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   793
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   794
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   795
            iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   796
            DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   797
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   798
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   799
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   800
        //    Set softkey
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   801
        case EPgnSoftkeyIdSet:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   802
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   803
            if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   804
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   805
                iState = ECropStateSecond;
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
            else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   808
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   809
                iState = ECropStateMove;
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
            iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   812
            iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   813
            DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   814
            ShowTooltip();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   815
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   816
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   817
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   818
        //    Done softkey
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   819
        case EPgnSoftkeyIdDone:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   820
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   821
            ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   822
            iState = ECropStateMin;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   823
            iReadyToRender = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   824
            iEditorView->HandleCommandL (EImageEditorResetZoom);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   825
            if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   826
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   827
                iEditorView->HandleCommandL (EImageEditorCancelPlugin);    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   828
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   829
            else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   830
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   831
                iEditorView->HandleCommandL (EImageEditorApplyPlugin);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   832
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   833
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   834
            break;
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   837
        //    Cancel softkey
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   838
        case EPgnSoftkeyIdCancel:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   839
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   840
            iEditorView->HandleCommandL (EImageEditorResetZoom);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   841
            iEditorView->HandleCommandL (EImageEditorCancelPlugin);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   842
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   843
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   844
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   845
        //    Back softkey
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   846
        case EPgnSoftkeyIdBack:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   847
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   848
            if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   849
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   850
                iState = ECropStateFirst;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   851
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   852
            else
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
                iState = ECropStateSecond;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   855
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   856
            iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   857
            iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   858
            DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   859
            ShowTooltip();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   860
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   861
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   862
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   863
        //    Screen mode changed (portrait, portrait full, landscape, landscape full)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   864
        case EImageEditorPreScreenModeChange:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   865
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   866
            //    Store crop rectangle relative to image
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   867
            StoreCropRelImage();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   868
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   869
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   870
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   871
        default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   872
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   873
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   874
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   875
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   876
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   877
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   878
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   879
TInt CImageEditorCropControl::GetSoftkeyIndexL()
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
    LOG(KCropPluginLogFile, "CImageEditorCropControl::GetSoftkeyIndexL()");
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
    switch (iState) 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   884
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   885
        case ECropStateFirst:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   886
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   887
            return 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   888
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   889
        case ECropStateSecond:
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
            return 2;            
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
        case ECropStateMove:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   894
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   895
            return 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   896
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   897
        case ECropStateMinCrop:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   898
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   899
            return 3; // empty - cancel    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   900
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   901
        default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   902
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   903
            return -1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   904
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   905
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   906
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   907
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   908
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   909
TPtrC CImageEditorCropControl::GetNaviPaneTextL (
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   910
    TBool& aLeftNaviPaneScrollButtonVisibile, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   911
    TBool& aRightNaviPaneScrollButtonVisible )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   912
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   913
    LOG(KCropPluginLogFile, "CImageEditorCropControl::GetNaviPaneTextL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   914
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   915
    aLeftNaviPaneScrollButtonVisibile = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   916
    aRightNaviPaneScrollButtonVisible = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   917
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   918
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   919
    // Update parameters - needed for the zoom update
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   920
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   921
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   922
    // Getting string from resources
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   923
    TPtrC ptr = iItem->Parameters()[KStatusPaneTextAreaIndex]; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   924
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   925
    //  Compute scaled width and height
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   926
    TReal width = iSysPars->Scale() * iCropW;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   927
    TReal height = iSysPars->Scale() * iCropH;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   928
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   929
    // Convert the width and height relative to the 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   930
    TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   931
    TInt scaledWidth = (TInt)((width / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   932
    TInt scaledHeight = (TInt)((height / relscale) + 0.5);
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
    iNaviPaneText.Zero();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   935
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   936
    // Generate string to be added to %U
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   937
    TBuf< 20 > valueStr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   938
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   939
    valueStr.AppendNum( scaledWidth );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   940
    valueStr.Append( KCropNaviTextSeparator );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   941
    valueStr.AppendNum( scaledHeight );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   942
        AknTextUtils::LanguageSpecificNumberConversion  (  valueStr );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   943
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   944
    StringLoader::Format( iNaviPaneText, ptr, -1, valueStr );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   945
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   946
    CalculateMinCrop();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   947
    return iNaviPaneText;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   948
}
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
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   951
void CImageEditorCropControl::ComputeCropParams()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   952
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   953
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   954
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputeCropParams()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   955
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   956
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   957
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   958
    TInt w = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   959
    TInt h = (virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   960
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   961
    TInt ulc = (TInt)(iULC * w + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   962
    TInt ulr = (TInt)(iULR * h + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   963
    TInt lrc = (TInt)(iLRC * w + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   964
    TInt lrr = (TInt)(iLRR * h + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   965
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   966
    //    Set parameter struct
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   967
    w = lrc - ulc;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   968
    h = lrr - ulr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   969
    iCropX = iSysPars->VisibleImageRect().iTl.iX + ulc;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   970
    iCropY = iSysPars->VisibleImageRect().iTl.iY + ulr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   971
    iCropW = w;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   972
    if (iCropX + w > virect.iBr.iX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   973
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   974
        iCropW = virect.iBr.iX - iCropX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   975
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   976
       iCropH = h;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   977
    if (iCropY  + h > virect.iBr.iY)
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
        iCropH = virect.iBr.iY - iCropY;
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
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
void CImageEditorCropControl::NaviDownL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   985
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   986
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   987
    LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviDownL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   988
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   989
    //  MANUAL MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   990
    if (iIsCropModeManual)
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
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   994
        if (iState == ECropStateFirst)
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
            iULR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   997
            if (iULR > iLRR - iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   998
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   999
                iULR = iLRR - iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1000
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1001
        }
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
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1004
        else if (iState == ECropStateSecond)
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
            iLRR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1007
            if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1008
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1009
                iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1010
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1011
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1012
        // MOVE (ADDED FOR MANUAL)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1013
        else 
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
            float old = iLRR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1016
            iLRR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1017
            if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1018
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1019
                iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1020
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1021
            iULR += (iLRR - old);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1022
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1023
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1024
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1025
    //  ASPECT RATIO PRESERVING MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1026
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1027
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1028
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1029
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1030
        if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1031
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1032
            if ( ((iLRC - iULC) > iMinX) && ((iLRR - iULR) > iMinY) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1033
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1034
                iULR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1035
                if (iULR > iLRR - iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1036
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1037
                    iULR = iLRR - iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1038
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1039
                ComputePreservedULC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1040
                if (iULC > iLRC - iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1041
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1042
                    iULC = iLRC - iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1043
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1044
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1045
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1046
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1047
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1048
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1049
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1050
            iLRR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1051
            if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1052
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1053
                iLRR = 1.0;
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
            ComputePreservedLRC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1056
            if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1057
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1058
                iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1059
                ComputePreservedLRR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1060
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1061
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1062
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1063
        // MOVE (ONLY WITH ASPECT RATIO PRESERVING)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1064
        // NOWADAYS ALSO WITH MANUAL
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1065
        else 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1066
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1067
            float old = iLRR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1068
            iLRR += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1069
            if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1070
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1071
                iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1072
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1073
            iULR += (iLRR - old);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1074
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1075
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1076
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1077
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1078
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1079
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1080
    if (iState == ECropStateSecond || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1081
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1082
        ClonePreviewBitmapL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1083
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1084
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1085
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1086
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1087
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1088
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1089
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1090
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1091
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1092
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1093
void CImageEditorCropControl::NaviUpL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1094
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1095
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1096
    LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviUpL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1097
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1098
    //  MANUAL MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1099
    if (iIsCropModeManual)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1100
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1101
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1102
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1103
        if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1104
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1105
            iULR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1106
            if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1107
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1108
                iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1109
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1110
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1111
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1112
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1113
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1114
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1115
            iLRR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1116
            if (iLRR < iULR + iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1117
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1118
                iLRR = iULR + iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1119
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1120
        }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1121
        // MOVE (ADDED FOR MANUAL)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1122
        else 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1123
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1124
            float old = iULR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1125
            iULR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1126
            if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1127
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1128
                iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1129
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1130
            iLRR -= (old - iULR);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1131
        } 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1132
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1133
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1134
    //  ASPECT RATIO PRESERVING MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1135
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1136
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1137
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1138
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1139
        if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1140
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1141
            iULR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1142
            if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1143
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1144
                iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1145
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1146
            ComputePreservedULC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1147
            if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1148
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1149
                iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1150
                ComputePreservedULR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1151
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1152
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1153
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1154
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1155
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1156
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1157
            if ( ((iLRC - iULC) > iMinX) && ((iLRR - iULR) > iMinY) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1158
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1159
                iLRR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1160
                if ((iLRR - iULR) < iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1161
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1162
                    iLRR = iULR + iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1163
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1164
                ComputePreservedLRC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1165
                if ((iLRC - iULC) < iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1166
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1167
                    iLRC = iULC + iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1168
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1169
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1170
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1171
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1172
        // MOVE (ONLY WITH ASPECT RATIO PRESERVING)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1173
        // NOWADAYS ALSO WITH MANUAL
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1174
        else 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1175
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1176
            float old = iULR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1177
            iULR -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1178
            if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1179
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1180
                iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1181
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1182
            iLRR -= (old - iULR);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1183
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1184
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1185
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1186
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1187
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1188
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1189
    if (iState == ECropStateFirst || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1190
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1191
        ClonePreviewBitmapL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1192
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1193
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1194
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1195
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1196
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1197
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1198
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1199
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1200
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1201
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1202
void CImageEditorCropControl::NaviRightL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1203
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1204
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1205
    LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviRightL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1206
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1207
    //  MANUAL MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1208
    if (iIsCropModeManual)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1209
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1210
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1211
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1212
        if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1213
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1214
            iULC += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1215
            if (iULC > iLRC - iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1216
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1217
                iULC = iLRC - iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1218
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1219
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1220
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1221
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1222
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1223
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1224
            iLRC += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1225
            if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1226
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1227
                iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1228
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1229
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1230
        // MOVE (ADDED FOR MANUAL)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1231
        else if (iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1232
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1233
            float old = iLRC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1234
            iLRC += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1235
            if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1236
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1237
                iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1238
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1239
            iULC += (iLRC - old);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1240
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1241
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1242
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1243
    //  ASPECT RATIO PRESERVING MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1244
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1245
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1246
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1247
        // MOVE (ONLY WITH ASPECT RATIO PRESERVING)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1248
        // NOWADAYS ALSO WITH MANUAL
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1249
        if (iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1250
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1251
            float old = iLRC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1252
            iLRC += (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1253
            if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1254
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1255
                iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1256
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1257
            iULC += (iLRC - old);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1258
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1259
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1260
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1261
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1262
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1263
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1264
    if (iState == ECropStateSecond || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1265
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1266
        ClonePreviewBitmapL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1267
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1268
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1269
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1270
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1271
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1272
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1273
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1274
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1275
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1276
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1277
void CImageEditorCropControl::NaviLeftL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1278
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1279
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1280
    LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviLeftL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1281
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1282
    //  MANUAL MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1283
    if (iIsCropModeManual)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1284
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1285
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1286
        // FIRST: UPPER LEFT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1287
        if (iState == ECropStateFirst)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1288
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1289
            iULC -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1290
            if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1291
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1292
                iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1293
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1294
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1295
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1296
        // SECOND: LOWER RIGHT CORNER
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1297
        else if (iState == ECropStateSecond)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1298
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1299
            iLRC -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1300
            if (iLRC < iULC + iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1301
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1302
                iLRC = iULC + iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1303
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1304
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1305
        // MOVE (ADDED FOR MANUAL)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1306
        else if (iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1307
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1308
            float old = iULC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1309
            iULC -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1310
            if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1311
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1312
                iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1313
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1314
            iLRC -= (old - iULC);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1315
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1316
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1317
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1318
    //  ASPECT RATIO PRESERVING MODE
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1319
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1320
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1321
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1322
        // MOVE (ONLY WITH ASPECT RATIO PRESERVING)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1323
        // NOWADAYS ALSO WITH MANUAL
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1324
        if (iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1325
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1326
            float old = iULC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1327
            iULC -= (KParamStep * iNaviStepMultiplier);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1328
            if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1329
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1330
                iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1331
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1332
            iLRC -= (old - iULC);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1333
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1334
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1335
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1336
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1337
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1338
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1339
    if (iState == ECropStateFirst || iState == ECropStateMove)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1340
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1341
        ClonePreviewBitmapL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1342
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1343
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1344
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1345
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1346
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1347
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1348
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1349
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1350
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1351
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1352
void CImageEditorCropControl::SetInitialPointsL ()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1353
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1354
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1355
    LOG(KCropPluginLogFile, "CImageEditorCropControl::SetInitialPointsL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1356
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1357
    const TSize vps = iSysPars->ViewPortRect().Size();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1358
    if (vps.iWidth <= KMinSourceSize || vps.iHeight <= KMinSourceSize)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1359
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1360
          iULC = 0.00F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1361
        iULR = 0.00F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1362
        iLRC = 1.00F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1363
        iLRR = 1.00F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1364
        iState = ECropStateMinCrop;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1365
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1366
  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1367
    //  MANUAL
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1368
    else if (iIsCropModeManual)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1369
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1370
        iULC = 0.02F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1371
        iULR = 0.02F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1372
        iLRC = 0.98F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1373
        iLRR = 0.98F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1374
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1375
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1376
    //  ASPECT RATIO PRESERVED
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1377
    else
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1380
        TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1381
        TInt width = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1382
        TInt height = (virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1383
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1384
        float current = (float)width / (float)height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1385
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1386
        if (iCropRatio > current)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1387
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1388
            float tmp = 0.5F * (current / iCropRatio);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1389
            iULC = 0.0F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1390
            iULR = 0.5F - tmp;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1391
            iLRC = 1.0F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1392
            iLRR = 0.5F + tmp;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1393
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1394
        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1395
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1396
            float tmp = 0.5F * (iCropRatio / current);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1397
            iULC = 0.5F - tmp;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1398
            iULR = 0.0F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1399
            iLRC = 0.5F + tmp;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1400
            iLRR = 1.0F;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1401
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1402
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1403
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1404
    ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1405
    StoreCropRelScreen();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1406
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1407
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1408
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1409
    DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1410
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1411
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1412
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1413
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1414
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1415
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1416
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1417
void CImageEditorCropControl::StartDancingAntsTimer()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1418
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1419
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1420
    LOG(KCropPluginLogFile, "CImageEditorCropControl::StartDancingAntsTimer()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1421
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1422
    if (iTimer)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1423
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1424
        iTimer->Cancel();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1425
        iTimer->Start(
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1426
            TTimeIntervalMicroSeconds32 (KDancingAntzTimerDelayInMicroseconds),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1427
            TTimeIntervalMicroSeconds32 (KDancingAntzTimerIntervalInMicroseconds),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1428
            TCallBack (DancingAntsCallback, this)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1429
            );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1430
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1431
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1432
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1433
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1434
void CImageEditorCropControl::StartFastKeyTimer()
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
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1437
    LOG(KCropPluginLogFile, "CImageEditorCropControl::StartFastKeyTimer()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1438
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1439
    iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1440
    iTickCount = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1441
    iFastKeyTimerState = ETimerStarted;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1442
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1443
    if (iTimer)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1444
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1445
        iTimer->Cancel();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1446
        iTimer->Start(
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1447
            TTimeIntervalMicroSeconds32 (KCropFastKeyTimerDelayInMicroseconds),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1448
            TTimeIntervalMicroSeconds32 (KDefaultFastKeyTimerIntervalInMicroseconds),
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1449
            TCallBack (FastKeyCallback, this)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1450
            );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1451
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1452
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1453
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1454
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1455
void CImageEditorCropControl::OnDancingAntsCallBack()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1456
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1457
    iAntFlag = !iAntFlag;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1458
    ActivateGc();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1459
    DrawDancingAnts (Rect());
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1460
    DeactivateGc();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1461
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1462
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1463
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1464
void CImageEditorCropControl::OnFastKeyCallBackL()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1465
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1466
    if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1467
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1468
        iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1469
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1470
    else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1471
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1472
        iTickCount++;
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
    // If first time here, reset the tick counter.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1476
    if (ETimerStarted == iFastKeyTimerState)
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
        iFastKeyTimerState = ETimerRunning;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1479
        iTickCount = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1480
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1481
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1482
    iHandleEventKeys = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1483
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1484
    switch (iPressedKeyScanCode)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1485
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1486
        case EStdKeyDownArrow:
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
			NaviDownL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1489
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1490
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1491
        case EStdKeyUpArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1492
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1493
			NaviUpL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1494
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1495
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1496
        case EStdKeyLeftArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1497
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1498
			NaviLeftL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1499
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1500
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1501
        case EStdKeyRightArrow:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1502
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1503
            NaviRightL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1504
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1505
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1506
        default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1507
            break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1508
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1509
    iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1510
    DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1511
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1512
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1513
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1514
TBool CImageEditorCropControl::IsReadyToRender() const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1515
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1516
    LOG(KCropPluginLogFile, "CImageEditorCropControl::IsReadyToRender()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1517
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1518
    // Always ready to render. However selected crop are is not set in GetParam()¨
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1519
    // until closing the plug-in.
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1520
    return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1521
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1522
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1523
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1524
void CImageEditorCropControl::CalculateMinCrop() 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1525
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1526
    LOG(KCropPluginLogFile, "CImageEditorCropControl::CalculateMinCrop()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1527
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1528
    TInt im_width = (iSysPars->VisibleImageRect().iBr.iX - iSysPars->VisibleImageRect().iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1529
    im_width = (TInt)(im_width * iSysPars->Scale() + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1530
    TInt im_height = (iSysPars->VisibleImageRect().iBr.iY - iSysPars->VisibleImageRect().iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1531
    im_height = (TInt)(im_height * iSysPars->Scale() + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1532
    TInt im_maxdim = (im_width < im_height) ? (im_height) : (im_width); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1533
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1534
    TInt im_min_crop_rel = (TInt)(KMinCropRelDistFrac * im_maxdim + 0.5F);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1535
    TInt im_min_crop_abs = KMaxCropAbsoluteMin;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1536
    TInt im_maxcrop = (im_min_crop_rel > im_min_crop_abs) ? 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1537
        (im_min_crop_rel) : (im_min_crop_abs);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1538
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1539
    TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1540
	TInt image_maxcrop_prev = (TInt)(im_maxcrop * relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1541
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1542
    iMinX = (float)image_maxcrop_prev / (float)im_width;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1543
    iMinY = (float)image_maxcrop_prev / (float)im_height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1544
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1545
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1546
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1547
void CImageEditorCropControl::ComputePreservedULC() 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1548
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1549
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedULC()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1550
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1551
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1552
    TInt viwidth = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1553
    TInt viheight = (virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1554
    iULC = (iLRC * viwidth - iCropRatio * ((iLRR - iULR) * viheight)) / viwidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1555
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1556
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1557
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1558
void CImageEditorCropControl::ComputePreservedLRC() 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1559
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1560
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedLRC()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1561
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1562
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1563
    TInt viwidth = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1564
    TInt viheight =(virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1565
    iLRC = (iULC * viwidth + iCropRatio * ((iLRR - iULR) * viheight)) / viwidth;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1566
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1567
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1568
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1569
void CImageEditorCropControl::ComputePreservedULR()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1570
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1571
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedULR()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1572
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1573
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1574
    TInt viwidth = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1575
    TInt viheight =(virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1576
    iULR = (iLRR * viheight - (((iLRC - iULC) * viwidth) / iCropRatio)) / viheight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1577
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1578
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1579
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1580
void CImageEditorCropControl::ComputePreservedLRR()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1581
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1582
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedLRR()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1583
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1584
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1585
    TInt viwidth = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1586
    TInt viheight =(virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1587
    iLRR = (iULR * viheight + (((iLRC - iULC) * viwidth) / iCropRatio)) / viheight;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1588
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1589
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1590
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1591
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1592
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1593
void CImageEditorCropControl::ClonePreviewBitmapL() 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1594
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1595
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1596
    LOG(KCropPluginLogFile, "CImageEditorCropControl::ClonePreviewBitmapL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1597
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1598
    TBitmapUtil bmptls (iPrevBitmap);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1599
    bmptls.Begin(TPoint(0,0));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1600
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1601
    TSize size = iPrevBitmap->SizeInPixels();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1602
    TDisplayMode dmode = iPrevBitmap->DisplayMode();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1603
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1604
    TInt bufsize = size.iHeight * iPrevBitmap->ScanLineLength (size.iWidth, dmode);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1605
    TUint8 * ps = (TUint8*)( iPrevBitmap->DataAddress() ); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1606
    TUint8 * pd = (TUint8*)( iBufBitmap->DataAddress() ); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1607
    Mem::Copy (pd, ps, bufsize);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1608
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1609
    bmptls.End();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1610
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1611
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1612
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1613
void CImageEditorCropControl::DarkenUnselectedAreaL() 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1614
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1615
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1616
    LOG(KCropPluginLogFile, "CImageEditorCropControl::DarkenUnselectedAreaL()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1617
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1618
    if (iBufBitmap)  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1619
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1620
        //  Compute crop rectangle inside the image area
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1621
        TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1622
        TInt w = (rect.iBr.iX - rect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1623
        TInt h = (rect.iBr.iY - rect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1624
        TInt ulc = (TInt) (iULC * w + 0.5) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1625
        TInt ulr = (TInt) (iULR * h + 0.5) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1626
        TInt lrc = (TInt) (iLRC * w  + 0.5) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1627
        TInt lrr = (TInt) (iLRR * h + 0.5) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1628
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1629
        //    Darken areas in the image that are outside crop rectangle
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1630
        CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL (iBufBitmap); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1631
        CleanupStack::PushL (bitmapDevice);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1632
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1633
        //    Create bitmap graphics context
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1634
        CFbsBitGc * bitmapContext = 0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1635
        User::LeaveIfError (bitmapDevice->CreateContext (bitmapContext));
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1636
        CleanupStack::PushL (bitmapContext) ;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1637
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1638
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1639
        bitmapContext->SetDrawMode (CGraphicsContext::EDrawModeAND);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1640
        bitmapContext->SetPenStyle (CGraphicsContext::ENullPen);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1641
        bitmapContext->SetPenColor (KRgbBlack);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1642
        bitmapContext->SetBrushStyle (CGraphicsContext::EDiamondCrossHatchBrush);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1643
        bitmapContext->SetBrushColor (KRgbWhite);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1644
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1645
        //    Darken top
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1646
        bitmapContext->DrawRect ( TRect ( rect.iTl.iX, 0, rect.iBr.iX, ulr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1647
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1648
        //    Darken left side
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1649
        bitmapContext->DrawRect ( TRect( rect.iTl.iX, ulr, ulc, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1650
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1651
        //    Darken right side
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1652
        bitmapContext->DrawRect ( TRect( lrc, ulr, rect.iBr.iX, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1653
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1654
        //    Darken bottom
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1655
        bitmapContext->DrawRect ( TRect( rect.iTl.iX, lrr, rect.iBr.iX, Rect().iBr.iY ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1656
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1657
        CleanupStack::PopAndDestroy(2); // bitmapContext, bitmapDevice 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1658
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1659
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1660
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1661
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1662
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1663
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1664
void CImageEditorCropControl::UpdateCropRectangle()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1665
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1666
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1667
    LOG(KCropPluginLogFile, "CImageEditorCropControl::UpdateCropRectangle()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1668
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1669
    if ( iOldCropRectPrev == TRect (0,0,0,0) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1670
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1671
        return;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1672
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1673
    if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1674
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1675
        iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1676
        if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1677
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1678
            ComputePreservedLRR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1679
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1680
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1681
    if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1682
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1683
        iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1684
        if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1685
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1686
            ComputePreservedLRC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1687
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1688
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1689
    if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1690
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1691
        iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1692
        if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1693
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1694
            ComputePreservedLRR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1695
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1696
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1697
    if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1698
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1699
        iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1700
        if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1701
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1702
            ComputePreservedLRC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1703
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1704
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1705
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1706
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1707
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1708
void CImageEditorCropControl::StoreCropRelScreen()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1709
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1710
    LOG(KCropPluginLogFile, "CImageEditorCropControl::StoreCropRelScreen()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1711
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1712
    TRect viprect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1713
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1714
    TInt vipwidth = (viprect.iBr.iX - viprect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1715
    TInt vipheight = (viprect.iBr.iY - viprect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1716
    iOldCropRectPrev.iTl.iX = viprect.iTl.iX + (TInt)(iULC * vipwidth + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1717
    iOldCropRectPrev.iTl.iY = viprect.iTl.iY + (TInt)(iULR * vipheight + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1718
    iOldCropRectPrev.iBr.iX = viprect.iTl.iX + (TInt)(iLRC * vipwidth + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1719
    iOldCropRectPrev.iBr.iY = viprect.iTl.iY + (TInt)(iLRR * vipheight + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1720
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1721
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1722
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1723
void CImageEditorCropControl::RestoreCropRelScreen()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1724
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1725
    LOG(KCropPluginLogFile, "CImageEditorCropControl::RestoreCropRelScreen()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1726
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1727
    TRect viprect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1728
    TInt width = (viprect.iBr.iX - viprect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1729
    TInt height = (viprect.iBr.iY - viprect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1730
    iULC = (float)(iOldCropRectPrev.iTl.iX - viprect.iTl.iX) / (float)width;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1731
    iULR = (float)(iOldCropRectPrev.iTl.iY - viprect.iTl.iY) / (float)height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1732
    iLRC = (float)(iOldCropRectPrev.iBr.iX - viprect.iTl.iX) / (float)width;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1733
    iLRR = (float)(iOldCropRectPrev.iBr.iY - viprect.iTl.iY) / (float)height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1734
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1735
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1736
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1737
void CImageEditorCropControl::StoreCropRelImage()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1738
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1739
    LOG(KCropPluginLogFile, "CImageEditorCropControl::StoreCropRelImage()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1740
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1741
    TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1742
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1743
    virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1744
    virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1745
    virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1746
    virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1747
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1748
    TInt viwidth = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1749
    TInt viheight = (virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1750
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1751
    iOldCropRectPrev.iTl.iX = virect.iTl.iX + (TInt)(iULC * viwidth + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1752
    iOldCropRectPrev.iTl.iY = virect.iTl.iY + (TInt)(iULR * viheight + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1753
    iOldCropRectPrev.iBr.iX = virect.iTl.iX + (TInt)(iLRC * viwidth + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1754
    iOldCropRectPrev.iBr.iY = virect.iTl.iY + (TInt)(iLRR * viheight + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1755
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1756
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1757
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1758
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1759
void CImageEditorCropControl::RestoreCropRelImage()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1760
{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1761
    LOG(KCropPluginLogFile, "CImageEditorCropControl::RestoreCropRelImage()");
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1762
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1763
    TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1764
    TRect virect = iSysPars->VisibleImageRect();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1765
    virect.iTl.iX = (TInt)(virect.iTl.iX / relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1766
    virect.iTl.iY = (TInt)(virect.iTl.iY / relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1767
    virect.iBr.iX = (TInt)(virect.iBr.iX / relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1768
    virect.iBr.iY = (TInt)(virect.iBr.iY / relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1769
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1770
    TInt width = (virect.iBr.iX - virect.iTl.iX);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1771
    TInt height = (virect.iBr.iY - virect.iTl.iY);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1772
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1773
    iULC = (float)(iOldCropRectPrev.iTl.iX - virect.iTl.iX) / width;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1774
    iULR = (float)(iOldCropRectPrev.iTl.iY - virect.iTl.iY) / height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1775
    iLRC = (float)(iOldCropRectPrev.iBr.iX - virect.iTl.iX) / width;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1776
    iLRR = (float)(iOldCropRectPrev.iBr.iY - virect.iTl.iY) / height;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1777
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1778
}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1779
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1780
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1781
void CImageEditorCropControl::HandlePointerEventL(
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1782
                                           const TPointerEvent &aPointerEvent )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1783
    {        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1784
    if( AknLayoutUtils::PenEnabled() )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1785
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1786
        TBool redraw( ETrue );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1787
        switch( aPointerEvent.iType )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1788
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1789
            case TPointerEvent::EButton1Down:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1790
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1791
                iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1792
                iTouchDragEnabled = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1793
                // Store tapped position
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1794
                iTappedPosition = aPointerEvent.iPosition;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1795
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1796
                if ( iState == ECropStateFirst || iState == ECropStateSecond )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1797
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1798
                    // Check first if minimum crop area is tapped (priority 1)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1799
                    if ( IsMinCropAreaTapped( aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1800
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1801
                        // enables immediate rectangle moving
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1802
                        redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1803
                        iTouchDragEnabled = ETrue; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1804
                        iState = ECropStateMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1805
                        iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1806
                                                EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1807
                        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1808
                    // Check if corners are tapped (priority 2)                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1809
                    else if ( IsCursorTapped( aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1810
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1811
#ifdef RD_TACTILE_FEEDBACK
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1812
						if ( iTouchFeedBack )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1813
							{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1814
							iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1815
							RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 1" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1816
							}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1817
#endif /* RD_TACTILE_FEEDBACK  */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1818
                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1819
                        // Just enable dragging, no need to change position
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1820
                        // here
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1821
                        iTouchDragEnabled = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1822
                        redraw = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1823
                        }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1824
                    else if ( IsOppositeCornerTapped( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1825
                                                aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1826
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1827
#ifdef RD_TACTILE_FEEDBACK
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1828
						if ( iTouchFeedBack )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1829
							{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1830
							iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1831
							RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 2" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1832
							}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1833
#endif /* RD_TACTILE_FEEDBACK  */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1834
                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1835
                        iTouchDragEnabled = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1836
                        if ( iState == ECropStateFirst )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1837
                            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1838
                            iState = ECropStateSecond;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1839
                            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1840
                        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1841
                            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1842
                            iState = ECropStateFirst;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1843
                            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1844
                        iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1845
                                                EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1846
                        redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1847
                        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1848
                    // Change to move state                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1849
                    else if ( IsCropAreaTapped( aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1850
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1851
                        // enables immediate rectangle moving
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1852
                        redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1853
                        iTouchDragEnabled = ETrue; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1854
                        iState = ECropStateMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1855
                        iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1856
                                                EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1857
                        }                    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1858
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1859
                else if ( iState == ECropStateMove )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1860
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1861
                    TInt corner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1862
                    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1863
                    if ( IsMinCropAreaTapped( aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1864
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1865
                        // enables immediate rectangle moving
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1866
                        redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1867
                        iTouchDragEnabled = ETrue; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1868
                        iState = ECropStateMove;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1869
                        //iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1870
                        //                        EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1871
                        }                              
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1872
                    // Moving back to first or second state from Move state
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1873
                    // by pressing top-left or bottom-right corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1874
                    else if( IsCornerTapped( aPointerEvent.iPosition , corner) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1875
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1876
#ifdef RD_TACTILE_FEEDBACK
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1877
						if ( iTouchFeedBack )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1878
							{
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1879
							iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1880
							RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 3" );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1881
							}
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1882
#endif /* RD_TACTILE_FEEDBACK  */
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1883
                        if ( corner == ETLCorner )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1884
                            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1885
                            // enables immediate dragging
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1886
                            redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1887
                            iTouchDragEnabled = ETrue; 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1888
                            iState = ECropStateFirst;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1889
                            iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1890
                                                    EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1891
                            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1892
                        else if ( corner == EBRCorner )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1893
                            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1894
                            redraw = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1895
                            iTouchDragEnabled = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1896
                            iState = ECropStateSecond;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1897
                            iEditorView->HandleCommandL ( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1898
                                                    EImageEditorUpdateSoftkeys );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1899
                            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1900
                        }                    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1901
                    else if ( IsCropAreaTapped( aPointerEvent.iPosition ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1902
                        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1903
                        redraw = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1904
                        iTouchDragEnabled = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1905
                        iTappedPosition = aPointerEvent.iPosition;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1906
                        }                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1907
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1908
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1909
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1910
            case TPointerEvent::EDrag:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1911
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1912
                if ( iState == ECropStateFirst && 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1913
                     iTouchDragEnabled )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1914
                    {   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1915
                    SetTLPosition( iTappedPosition, aPointerEvent.iPosition );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1916
                    iTappedPosition = aPointerEvent.iPosition;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1917
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1918
                else if ( iState == ECropStateSecond && 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1919
                          iTouchDragEnabled )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1920
                    {     
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1921
                    SetBRPosition( iTappedPosition, aPointerEvent.iPosition );                                    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1922
                    iTappedPosition = aPointerEvent.iPosition;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1923
                    }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1924
                else if ( iState == ECropStateMove && iTouchDragEnabled )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1925
                    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1926
                    MoveCropArea( iTappedPosition, aPointerEvent.iPosition );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1927
                    iTappedPosition = aPointerEvent.iPosition;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1928
                    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1929
                redraw = ETrue;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1930
                break;        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1931
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1932
            case TPointerEvent::EButton1Up:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1933
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1934
                iTouchDragEnabled = EFalse;  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1935
                redraw = EFalse;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1936
                ShowTooltip();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1937
                break;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1938
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1939
                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1940
            default:
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1941
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1942
                break;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1943
                }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1944
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1945
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1946
        if ( redraw )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1947
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1948
            ComputeCropParams();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1949
            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1950
#ifdef DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1951
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1952
            if ( iState == ECropStateFirst || 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1953
                 iState == ECropStateSecond || 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1954
                 iState == ECropStateMove )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1955
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1956
                ClonePreviewBitmapL();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1957
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1958
            DarkenUnselectedAreaL();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1959
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1960
#endif // DOUBLE_BUFFERED_CROP
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1961
                            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1962
            iEditorView->HandleCommandL (EImageEditorUpdateNavipane);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1963
            DrawNow();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1964
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1965
        CCoeControl::HandlePointerEventL( aPointerEvent );        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1966
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1967
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1968
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1969
//=============================================================================    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1970
void CImageEditorCropControl::SetTLPosition( TPoint aOldPosition, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1971
                                             TPoint aNewPosition )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1972
    {        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1973
    // Get system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1974
    TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1975
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1976
    //Set new x value
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1977
    iULC += TReal( aNewPosition.iX - aOldPosition.iX ) /
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1978
              ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1979
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1980
    //Set new y value
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1981
    iULR += TReal( aNewPosition.iY - aOldPosition.iY  ) /
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1982
              ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1983
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1984
    // check the limits 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1985
    if (iULR < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1986
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1987
        iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1988
        }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1989
    else if (iULR > iLRR - iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1990
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1991
        iULR = iLRR - iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1992
        }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1993
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1994
    if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1995
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1996
        // To preserve selected aspect ratio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1997
        ComputePreservedULC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1998
        }      
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  1999
                         
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2000
    if (iULC < 0.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2001
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2002
        iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2003
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2004
    else if (iULC > iLRC - iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2005
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2006
        iULC = iLRC - iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2007
        }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2008
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2009
    if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2010
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2011
        // To preserve selected aspect ratio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2012
        ComputePreservedULR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2013
        }                       
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2014
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2015
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2016
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2017
void CImageEditorCropControl::SetBRPosition( TPoint aOldPosition, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2018
                                             TPoint aNewPosition )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2019
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2020
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2021
    // Get system parameters
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2022
    TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2023
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2024
    //Set new x value
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2025
    iLRC += TReal( aNewPosition.iX - aOldPosition.iX ) /
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2026
              ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2027
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2028
    //Set new y value
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2029
    iLRR += TReal( aNewPosition.iY - aOldPosition.iY ) /
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2030
              ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2031
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2032
    // check the limits 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2033
    if (iLRR < iULR + iMinY)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2034
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2035
        iLRR = iULR + iMinY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2036
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2037
    else if (iLRR > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2038
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2039
        iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2040
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2041
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2042
    if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2043
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2044
        // To preserve selected aspect ratio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2045
        ComputePreservedLRC();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2046
        }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2047
                 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2048
    if (iLRC < iULC + iMinX)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2049
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2050
        iLRC = iULC + iMinX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2051
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2052
    else if (iLRC > 1.0)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2053
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2054
        iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2055
        } 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2056
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2057
    if ( !iIsCropModeManual )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2058
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2059
        // To preserve selected aspect ratio
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2060
        ComputePreservedLRR();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2061
        }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2062
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2063
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2064
//=============================================================================    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2065
TBool CImageEditorCropControl::IsCursorTapped( TPoint aTappedPosition ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2066
    {   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2067
    TInt corner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2068
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2069
    if ( IsCornerTapped( aTappedPosition, corner ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2070
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2071
        if ( corner == ETLCorner && iState == ECropStateFirst )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2072
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2073
            return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2074
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2075
        else if ( corner == EBRCorner && iState == ECropStateSecond )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2076
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2077
            return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2078
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2079
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2080
    return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2081
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2082
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2083
//=============================================================================    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2084
TBool CImageEditorCropControl::IsOppositeCornerTapped( 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2085
                                                TPoint aTappedPosition ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2086
    {    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2087
    TInt corner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2088
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2089
    if ( IsCornerTapped( aTappedPosition, corner ) )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2090
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2091
        if ( corner == ETLCorner && iState == ECropStateSecond )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2092
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2093
            return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2094
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2095
        else if ( corner == EBRCorner && iState == ECropStateFirst )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2096
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2097
            return ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2098
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2099
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2100
    return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2101
    }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2102
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2103
//============================================================================= 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2104
TBool CImageEditorCropControl::IsCropAreaTapped( TPoint aTappedPosition ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2105
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2106
    TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2107
    TInt w = ( rect.iBr.iX - rect.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2108
    TInt h = ( rect.iBr.iY - rect.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2109
    TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2110
    TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2111
    TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2112
    TInt lrr = ( TInt) ( iLRR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2113
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2114
    TRect areaRect ( TPoint( ulc, ulr ), TPoint( lrc, lrr ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2115
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2116
    return areaRect.Contains( aTappedPosition );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2117
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2118
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2119
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2120
//============================================================================= 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2121
TBool CImageEditorCropControl::IsMinCropAreaTapped( TPoint aTappedPosition ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2122
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2123
    TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2124
    TInt w = ( rect.iBr.iX - rect.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2125
    TInt h = ( rect.iBr.iY - rect.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2126
    TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2127
    TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2128
    TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2129
    TInt lrr = ( TInt) ( iLRR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2130
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2131
    TPoint middlePoint = TPoint( ulc + ( lrc - ulc ) / 2,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2132
                                 ulr + ( lrr - ulr ) / 2 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2133
                                     
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2134
    TReal relscale = iSysPars->RelScale();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2135
    TInt minCrop = (TInt)(KMaxCropAbsoluteMin * relscale + 0.5);
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2136
                                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2137
    TRect areaRect ( TPoint( middlePoint.iX - minCrop, middlePoint.iY - minCrop ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2138
                     TPoint( middlePoint.iX + minCrop, middlePoint.iY + minCrop ) );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2139
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2140
    // restrict min crop area inside total cropping area
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2141
    if( areaRect.iTl.iX < ulc )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2142
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2143
        areaRect.iTl.iX = ulc;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2144
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2145
    if( areaRect.iTl.iY < ulr )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2146
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2147
        areaRect.iTl.iY = ulr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2148
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2149
    if( areaRect.iBr.iX > lrc )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2150
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2151
        areaRect.iBr.iX = lrc;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2152
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2153
    if( areaRect.iBr.iY > lrr )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2154
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2155
        areaRect.iBr.iY = lrr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2156
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2157
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2158
    return areaRect.Contains( aTappedPosition );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2159
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2160
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2161
                
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2162
//============================================================================= 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2163
TBool CImageEditorCropControl::IsCornerTapped( TPoint aTappedPosition, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2164
                                               TInt& aTappedCorner ) const
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2165
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2166
    //  Compute crop rectangle inside the image area
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2167
    TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2168
    TInt w = ( rect.iBr.iX - rect.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2169
    TInt h = ( rect.iBr.iY - rect.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2170
    TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2171
    TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2172
    TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2173
    TInt lrr = ( TInt ) ( iLRR * h + 0.5 ) + rect.iTl.iY;  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2174
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2175
    TBool topLeftTapped = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2176
    TBool bottomRightTapped = EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2177
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2178
    TSize cursorSize = iCrossHair->SizeInPixels();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2179
    TSize tripleCursorSize( 3 * cursorSize.iWidth, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2180
                            3 * cursorSize.iHeight );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2181
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2182
    // Case1, upper left corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2183
    TInt cx = ulc;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2184
    TInt cy = ulr;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2185
    TRect cursorRect( TPoint( cx - ( tripleCursorSize.iWidth / 2 ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2186
                              cy - ( tripleCursorSize.iHeight / 2 ) ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2187
                              tripleCursorSize );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2188
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2189
    // Calculate an estimate for the distance to top-left corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2190
    // Change more accurate implementation if needed in future
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2191
    // (this is fast)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2192
     TInt distTL = Abs( cx - aTappedPosition.iX ) +
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2193
                   Abs( cy - aTappedPosition.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2194
                                        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2195
    if ( cursorRect.Contains( aTappedPosition ) )                          
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2196
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2197
        topLeftTapped = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2198
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2199
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2200
    // Case2, lower right corner    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2201
    cx = lrc - 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2202
    cy = lrr - 1;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2203
    cursorRect = TRect( TPoint( cx - ( tripleCursorSize.iWidth / 2 ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2204
                              cy - ( tripleCursorSize.iHeight / 2 ) ), 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2205
                              tripleCursorSize );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2206
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2207
    // Calculate an estimate for the distance to bottom-right corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2208
    // Change more accurate implementation if needed in future
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2209
    // (this is fast)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2210
     TInt distBR = Abs( cx - aTappedPosition.iX ) +
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2211
                   Abs( cy - aTappedPosition.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2212
                                            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2213
    if ( cursorRect.Contains( aTappedPosition ) )                          
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2214
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2215
        bottomRightTapped = ETrue;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2216
        }  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2217
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2218
    // Check tapped corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2219
    if ( topLeftTapped || bottomRightTapped )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2220
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2221
        if( topLeftTapped && !bottomRightTapped )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2222
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2223
            aTappedCorner = ETLCorner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2224
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2225
        else if( !topLeftTapped && bottomRightTapped )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2226
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2227
            aTappedCorner = EBRCorner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2228
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2229
        // Tapping happened inside of both corners. Check the closest.    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2230
        else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2231
            {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2232
            if( distTL < distBR )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2233
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2234
                aTappedCorner = ETLCorner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2235
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2236
            else
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2237
                {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2238
                aTappedCorner = EBRCorner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2239
                }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2240
            }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2241
        return ETrue;    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2242
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2243
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2244
    // no top-left nor bottom-righ corner tapped    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2245
    aTappedCorner = EInvalidCorner;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2246
    return EFalse;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2247
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2248
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2249
//============================================================================= 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2250
void CImageEditorCropControl::MoveCropArea( TPoint aOldPosition, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2251
                                            TPoint aNewPosition )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2252
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2253
    TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2254
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2255
    // Change can be positive or negative
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2256
    TInt xChange ( aNewPosition.iX - aOldPosition.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2257
    TInt yChange ( aNewPosition.iY - aOldPosition.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2258
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2259
    // X-components    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2260
    // store old x-values so they can be used if crop rect is trying to be
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2261
    // moved outside the visible area    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2262
    TReal ulcOld = iULC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2263
    iULC += TReal( xChange ) / ( visibleImageRectPrev.iBr.iX - 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2264
                                 visibleImageRectPrev.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2265
    TReal lrcOld = iLRC;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2266
    iLRC += TReal( xChange ) / ( visibleImageRectPrev.iBr.iX - 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2267
                                 visibleImageRectPrev.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2268
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2269
    // if limits are reached, move as much as possible (both sides)
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2270
    if ( iULC < 0.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2271
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2272
        iULC = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2273
        iLRC = lrcOld;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2274
        // ulc min limit reached,  move lrc as much as it was possible
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2275
        // to move ulc
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2276
        iLRC += ( iULC - ulcOld );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2277
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2278
    else if ( iLRC > 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2279
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2280
        iLRC = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2281
        iULC = ulcOld;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2282
        iULC += ( iLRC - lrcOld );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2283
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2284
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2285
    // Y-components        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2286
    TReal ulrOld = iULR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2287
    iULR += TReal( yChange ) / ( visibleImageRectPrev.iBr.iY - 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2288
                                 visibleImageRectPrev.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2289
    TReal lrrOld = iLRR;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2290
    iLRR += TReal( yChange ) / ( visibleImageRectPrev.iBr.iY - 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2291
                                 visibleImageRectPrev.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2292
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2293
    if ( iULR < 0.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2294
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2295
        iULR = 0.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2296
        iLRR = lrrOld;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2297
        iLRR += ( iULR - ulrOld ); 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2298
        }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2299
    else if ( iLRR > 1.0 )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2300
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2301
        iLRR = 1.0;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2302
        iULR = ulrOld;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2303
        iULR += ( iLRR - lrrOld );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2304
        }            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2305
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2306
  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2307
//=============================================================================
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2308
void CImageEditorCropControl::ShowTooltip()
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2309
    {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2310
    iPopupController->HideInfoPopupNote();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2311
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2312
    // Calculate visible image rect corner positions
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2313
    TRect rect = iSysPars->VisibleImageRectPrev();
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2314
    TInt w = ( rect.iBr.iX - rect.iTl.iX );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2315
    TInt h = ( rect.iBr.iY - rect.iTl.iY );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2316
    TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2317
    TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2318
    TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX;
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2319
    TInt lrr = ( TInt ) ( iLRR * h + 0.5 ) + rect.iTl.iY;  
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2320
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2321
    TSize cursorSize = iCrossHair->SizeInPixels();    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2322
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2323
    // user is setting upper left corner
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2324
    if ( iState == ECropStateFirst )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2325
        {    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2326
        TPoint middlePoint = TPoint( ulc, ulr );                                   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2327
        
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2328
        SDrawUtils::ShowToolTip( iPopupController,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2329
                                 this,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2330
                                 middlePoint,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2331
                                 EHLeftVBottom,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2332
                                 *iTooltipResize );    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2333
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2334
    // user is setting lower right corner    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2335
    else if ( iState == ECropStateSecond )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2336
        {
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2337
        TPoint middlePoint = TPoint( lrc - 1 ,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2338
                                     lrr - 1 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2339
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2340
        SDrawUtils::ShowToolTip ( iPopupController,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2341
                                  this, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2342
                                  middlePoint,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2343
                                  EHRightVBottom, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2344
                                  *iTooltipResize );                          
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2345
        }    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2346
    // in move state
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2347
    else if ( iState == ECropStateMove )
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2348
        {            
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2349
        TPoint middlePoint = TPoint( ulc + ( lrc - ulc ) / 2,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2350
                                     ulr + ( lrr - ulr ) / 2 );
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2351
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2352
        SDrawUtils::ShowToolTip ( iPopupController,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2353
                                  this, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2354
                                  middlePoint,
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2355
                                  EHCenterVCenter, 
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2356
                                  *iTooltipMove );       
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2357
        }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2358
    }
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2359
   
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2360
    
edfc90759b9f Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
  2361
// End of file