Strange error

Michael Thaler michael.thaler at physik.tu-muenchen.de
Tue Oct 18 13:54:00 CEST 2005


Hello,

I am trying to refactor the crop tool and I got stuck because of a strange 
error. I have defined an enumeration handleType in kis_crop_selection.h. Here 
is the relevant part of kis_crop_selection.h:

#ifndef KIS_CROP_SELECTION_H_
#define KIS_CROP_SELECTION_H_

#include <qregion.h>
#include <qrect.h>

enum handleType
    {
        None = 0,
        Left = 1,
        TopLeft = 2,
        Top = 3,
        TopRight = 4,
        Right = 5,
        BottomRight = 6,
        Bottom = 7,
        BottomLeft = 8,
        InsideSelection = 9
    };

class QPainter;
class KisCanvasSubject;

class KisCropSelection : public QRect
{
...
}

I included this file in kis_tool_crop.h

and did the following

void KisToolCrop::setCursorType (handleType handle)
{
    switch (handle)
    {
    case (Left):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeHorCursor());
        return;
    case (TopLeft):
    //case (BottomRight):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeFDiagCursor());
        return;
    //case (BottomLeft):
    //case (TopRight):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeBDiagCursor());
        return;
    case (Top):
    case (Bottom):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeVerCursor());
        return;
    case (Left):
    case (Right):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeHorCursor());
        return;
    case (InsideSelection):
        
m_subject->canvasController()->setCanvasCursor(KisCursor::sizeAllCursor());
        return;
    }
    m_subject->canvasController()->setCanvasCursor(KisCursor::selectCursor());
    return;
}

in kis_tool_crop.cc. When I try to compile it I get the following error 
message:

kis_tool_crop.cc: In member function `void
   KisToolCrop::setCursorType(handleType)':
kis_tool_crop.cc:567: error: duplicate case value
kis_tool_crop.cc:560: error: previously used here
kis_tool_crop.cc:571: error: duplicate case value
kis_tool_crop.cc:564: error: previously used here
kis_tool_crop.cc:578: warning: enumeration value `TopRight' not handled in
   switch
kis_tool_crop.cc:578: warning: enumeration value `BottomRight' not handled in
   switch
kis_tool_crop.cc:578: warning: enumeration value `BottomLeft' not handled in
   switch
make: *** [kis_tool_crop.lo] Error 1

Line 567: case (Top):
Line 559: case (BottomRight):
Line 571: case (Left):
Line 564: case (TopRight):

I don't understand this. Does somebody know what is going wrong here?

Greetings,
Michael


More information about the kimageshop mailing list