ClickModifiers Class Reference

#include <clikmods.h>

List of all members.

Public Member Functions

 ClickModifiers ()
 Construct a ClickModifiers object and initialise all its member variables.
 ClickModifiers (const ClickModifiers &CopyMods)
 Construct a ClickModifiers object and initialise all its member variables.
ClickModifiersoperator= (const ClickModifiers &CopyMods)
 Overload the = operator to copy all the member vars of one to another.
BOOL IsHandledByTool ()
 Decide whether a tool should get a click modified with this modifier or not.

Static Public Member Functions

static ClickModifiers GetClickModifiers ()
 Construct ClickModifiers from current system info.
static ClickModifiers GetClickModifiers (wxMouseEvent &event)
 Construct ClickModifiers from current event.
static ClickModifiers GetClickModifiers (UINT32 nFlags)
static UINT32 SynthesizeMouseEventFlags ()
 Create nFlags bitfield by interrogating the state of keys and mouse buttons.
static UINT32 SynthesizeMouseEventFlags (wxMouseEvent &event)
 Create nFlags bitfield by interrogating the state of keys and mouse buttons.
static BOOL DeclarePrefs ()
 Declares any preferences that the ClickModifiers class needs to declare.
static void GetButtonFuncName (ButtonFunction bf, String_32 *pString)
 Get the name of a button function to show to the user.
static void RestoreDefaults ()
 Set the three button function prefs to their default values...
static ButtonFunction GetButtonFunc (UINT32 ButtonID)
 Get the function linked to a mouse button.
static void SetButtonFunc (UINT32 ButtonID, ButtonFunction bf)
 Set the function linked to a mouse button.

Public Attributes

BOOL Adjust: 1
BOOL Menu: 1
BOOL Constrain: 1
BOOL Alternative1: 1
BOOL Alternative2: 1
BOOL EditObject: 1
BOOL FullScreen: 1
BOOL ZoomIn: 1
BOOL ClickWhileDrag: 1
BOOL PushCentreTool: 1
UINT32 Pressure

Private Member Functions

 CC_DECLARE_MEMDUMP (ClickModifiers)
void GetModsFromPrefs (ButtonFunction buttfunc)
 Create a click modifier object.

Static Private Attributes

static ButtonFunction LeftButtonFunction = BUTTFUNC_NORMAL
 Determine the action of the left mouse button.
static ButtonFunction MiddleButtonFunction = BUTTFUNC_PUSHCENTRE
 Determine the action of the middle mouse button.
static ButtonFunction RightButtonFunction = BUTTFUNC_MENU
 Determine the action of the right mouse button.
static UINT32 ButtFuncNames [BUTTFUNC_LAST]


Detailed Description

Notice that combinations of these modifiers may be TRUE at any time, although some combinations may be illegal.

Note that the "Menu" modifier is just added for consistency with dialogue handling - click events on the document views will NEVER receive clicks with the "Menu" modifier.

public: BOOL Adjust : 1; // Shift key (Also configurable to a mouse button) BOOL Menu : 1; // User wants a context sensitive menu (Configurable) BOOL Constrain : 1; // Control key (Also configurable to a mouse button) BOOL Alternative1 : 1; // Left-Alt key (Also configurable to a mouse button) BOOL Alternative2 : 1; // Right-Alt key ???

BOOL EditObject : 1; // User wants the best editor for this object (Configurable) BOOL FullScreen : 1; // User wants to toggle full-screen mode (Configurable) BOOL ZoomIn : 1; // User wants to zoom in one stage (Configurable)

UINT32 Pressure; // Pen Pressure

See also:
ClickType; DocView::OnClick; Tool_v1::OnClick

Definition at line 155 of file clikmods.h.


Constructor & Destructor Documentation

ClickModifiers::ClickModifiers  ) 
 

Construct a ClickModifiers object and initialise all its member variables.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 323 of file clikmods.cpp.

00324 {
00325     Adjust          = FALSE;    // Shift key (Also configurable to a mouse button)
00326     Menu            = FALSE;    // User wants a context sensitive menu (Configurable)
00327     Constrain       = FALSE;    // Control key (Also configurable to a mouse button)
00328     Alternative1    = FALSE;    // Left-Alt key (Also configurable to a mouse button)
00329     Alternative2    = FALSE;    // Right-Alt key ???
00330 
00331     EditObject      = FALSE;    // User wants the best editor for this object (Configurable)
00332     FullScreen      = FALSE;    // User wants to toggle full-screen mode (Configurable)
00333     ZoomIn          = FALSE;    // User wants to zoom in one stage (Configurable)
00334 
00335     Pressure        = 0;        // Pen Pressure
00336 
00337     ClickWhileDrag = FALSE;     // TRUE if the click was made while a drag was in progress
00338     PushCentreTool = FALSE;     // User wants to drag move the view or auto-centre on current mouse pos
00339 }

ClickModifiers::ClickModifiers const ClickModifiers CopyMods  ) 
 

Construct a ClickModifiers object and initialise all its member variables.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 356 of file clikmods.cpp.

00357 {
00358     Adjust          = CopyMods.Adjust;          // Shift key (Also configurable to a mouse button)
00359     Menu            = CopyMods.Menu;            // User wants a context sensitive menu (Configurable)
00360     Constrain       = CopyMods.Constrain;       // Control key (Also configurable to a mouse button)
00361     Alternative1    = CopyMods.Alternative1;    // Left-Alt key (Also configurable to a mouse button)
00362     Alternative2    = CopyMods.Alternative2;    // Right-Alt key ???
00363 
00364     EditObject      = CopyMods.EditObject;      // User wants the best editor for this object (Configurable)
00365     FullScreen      = CopyMods.FullScreen;      // User wants to toggle full-screen mode (Configurable)
00366     ZoomIn          = CopyMods.ZoomIn;          // User wants to zoom in one stage (Configurable)
00367 
00368     Pressure        = CopyMods.Pressure;        // Pen Pressure
00369 
00370     ClickWhileDrag  = CopyMods.ClickWhileDrag;  // TRUE if the click was made while a drag was in progress
00371     PushCentreTool  = CopyMods.PushCentreTool;  // TRUE if user wants to drag move view or auto-centre to mouse pos
00372 }


Member Function Documentation

ClickModifiers::CC_DECLARE_MEMDUMP ClickModifiers   )  [private]
 

BOOL ClickModifiers::DeclarePrefs  )  [static]
 

Declares any preferences that the ClickModifiers class needs to declare.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/03/95
Returns:
TRUE if it worked, FALSE if it failed

Definition at line 188 of file clikmods.cpp.

00189 {
00190     GetApplication()->DeclareSection( wxT("Mouse"), 5);
00191     GetApplication()->DeclarePref( wxT("Mouse"), wxT("Left Button"), (INT32*)&LeftButtonFunction);
00192     GetApplication()->DeclarePref( wxT("Mouse"), wxT("Middle Button"), (INT32*)&MiddleButtonFunction);
00193     GetApplication()->DeclarePref( wxT("Mouse"), wxT("Right Button"), (INT32*)&RightButtonFunction);
00194 
00195     return TRUE;
00196 }

ButtonFunction ClickModifiers::GetButtonFunc UINT32  ButtonID  )  [static]
 

Get the function linked to a mouse button.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/03/95
Parameters:
0,1 or 2 indicating Left MIddle or Right mouse button [INPUTS]
- [OUTPUTS]
Returns:
Button function ID currently assigned to that button

Definition at line 258 of file clikmods.cpp.

00259 {
00260     switch (ButtonID)
00261     {
00262         case 0:
00263             return LeftButtonFunction;
00264         case 1:
00265             return MiddleButtonFunction;
00266         case 2:
00267             return RightButtonFunction;
00268         default:
00269             ERROR3("GetButtonFunc asked for the function assigned to an unknown button!");
00270             return BUTTFUNC_NORMAL;
00271     }
00272 }

void ClickModifiers::GetButtonFuncName ButtonFunction  bf,
String_32 pString
[static]
 

Get the name of a button function to show to the user.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/03/95
Parameters:
ButtonFunction enum member [INPUTS]
Name of ButtonFunction enum member [OUTPUTS]
Returns:
-

Definition at line 214 of file clikmods.cpp.

00215 {
00216     *pString = String_32( ButtFuncNames[bf] );
00217 }

ClickModifiers ClickModifiers::GetClickModifiers UINT32  nFlags  )  [static]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/94
Returns:
struct holding current modifiers for any mouse clicks

Definition at line 563 of file clikmods.cpp.

00564 {
00565     ClickModifiers  ClickMods;
00566 
00567     // Read keyboard modifier states and reflect them in ClickModifiers...
00568     ClickMods.Adjust        = ((nFlags & MK_SHIFT)!=0);
00569     ClickMods.Constrain     = ((nFlags & MK_CONTROL)!=0);
00570     ClickMods.Alternative1  = ((nFlags & MK_ALT)!=0);
00571 
00572     // Check mouse button function prefs to see if they supply modifiers...
00573     if ((nFlags & MK_LBUTTON)!=0)
00574         ClickMods.GetModsFromPrefs(LeftButtonFunction);
00575 
00576     if ((nFlags & MK_MBUTTON)!=0)
00577         ClickMods.GetModsFromPrefs(MiddleButtonFunction);
00578 
00579     if ((nFlags & MK_RBUTTON)!=0)
00580         ClickMods.GetModsFromPrefs(RightButtonFunction);
00581 
00582     //Graham 18/6/96: Set ClickWhileDrag if there is a drag in progress
00583     //That means that this click was made while another mouse button was
00584     //being used to drag something
00585     if (Operation::GetCurrentDragOp()!=NULL)
00586         ClickMods.ClickWhileDrag=TRUE;
00587 
00588 // WEBSTER - markn 25/4/97
00589 // No pen stuff required in Webster
00590 // Taken out by vector stroking code Neville 2/10/97
00591 #ifdef VECTOR_STROKING
00592     // Get pressure information...
00593     CCPen* pPressurePen    = Camelot.GetPressurePen();
00594     if (pPressurePen)
00595         ClickMods.Pressure = pPressurePen->GetPenPressure();
00596     else
00597     {
00598 // don't warn in ralph it hasn't got one...
00599 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00600         ERROR3("CCamApp::GetClickModifiers() - pPressurePen==NULL");
00601 #endif
00602         ClickMods.Pressure = 0;
00603     }
00604 #endif // VECTOR_STROKING
00605 
00606     return ClickMods;
00607 }

ClickModifiers ClickModifiers::GetClickModifiers wxMouseEvent &  event  )  [static]
 

Construct ClickModifiers from current event.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/Jan/2006
Returns:
struct holding current modifiers for any mouse clicks

Definition at line 546 of file clikmods.cpp.

00547 {
00548     UINT32 nFlags = SynthesizeMouseEventFlags(event);
00549     return GetClickModifiers(nFlags);
00550 }

ClickModifiers ClickModifiers::GetClickModifiers  )  [static]
 

Construct ClickModifiers from current system info.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/Jan/2006
Returns:
struct holding current modifiers for any mouse clicks

Definition at line 528 of file clikmods.cpp.

00529 {
00530     UINT32 nFlags = SynthesizeMouseEventFlags();
00531     return GetClickModifiers(nFlags);
00532 }

void ClickModifiers::GetModsFromPrefs ButtonFunction  buttfunc  )  [private]
 

Create a click modifier object.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ClickModifier object based on inputs and prefs

Definition at line 624 of file clikmods.cpp.

00625 {
00626     switch (buttfunc)
00627     {
00628         case BUTTFUNC_NORMAL:
00629             break;
00630 
00631         case BUTTFUNC_SHIFT:
00632             Adjust = TRUE;
00633             break;
00634 
00635         case BUTTFUNC_CONSTRAIN:
00636             Constrain = TRUE;
00637             break;
00638 
00639         case BUTTFUNC_ALTERNATIVE:
00640             Alternative1 = TRUE;
00641             break;
00642 
00643         case BUTTFUNC_MENU:
00644             Menu = TRUE;
00645             break;
00646 
00647 //      case BUTTFUNC_EDITOBJECT:
00648 //          EditObject = TRUE;
00649 //          break;
00650 //
00651         case BUTTFUNC_FULLSCREEN:
00652             FullScreen = TRUE;
00653             break;
00654 
00655         case BUTTFUNC_ZOOMIN:
00656             ZoomIn = TRUE;
00657             break;
00658 
00659         case BUTTFUNC_PUSHCENTRE:
00660             PushCentreTool = TRUE;
00661             break;
00662 
00663         default:
00664             ERROR3("Shouldn't ever get here, but there's no harm if it does");
00665     }
00666 }

BOOL ClickModifiers::IsHandledByTool  ) 
 

Decide whether a tool should get a click modified with this modifier or not.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this ClickModifier should be passed on to tools FALSE otherwise

Definition at line 425 of file clikmods.cpp.

00426 {
00427     //Graham 19/6/96: Altered to handle clicks while dragging.
00428     //If the click took place while dragging, the Drag operation should always handle
00429     //the click (i.e. IF ClickWhileDrag, return TRUE).
00430 
00431     //Otherwise, return TRUE
00432     //UNLESS any of Edit Object, FullScreen or ZoomIn are TRUE, in which case
00433     //return FALSE.
00434 
00435     return ClickWhileDrag || !(EditObject || FullScreen || ZoomIn);
00436 }

ClickModifiers & ClickModifiers::operator= const ClickModifiers CopyMods  ) 
 

Overload the = operator to copy all the member vars of one to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 389 of file clikmods.cpp.

00390 {
00391     Adjust          = CopyMods.Adjust;          // Shift key (Also configurable to a mouse button)
00392     Menu            = CopyMods.Menu;            // User wants a context sensitive menu (Configurable)
00393     Constrain       = CopyMods.Constrain;       // Control key (Also configurable to a mouse button)
00394     Alternative1    = CopyMods.Alternative1;    // Left-Alt key (Also configurable to a mouse button)
00395     Alternative2    = CopyMods.Alternative2;    // Right-Alt key ???
00396 
00397     EditObject      = CopyMods.EditObject;      // User wants the best editor for this object (Configurable)
00398     FullScreen      = CopyMods.FullScreen;      // User wants to toggle full-screen mode (Configurable)
00399     ZoomIn          = CopyMods.ZoomIn;          // User wants to zoom in one stage (Configurable)
00400 
00401     Pressure        = CopyMods.Pressure;        // Pen Pressure
00402 
00403     ClickWhileDrag  = CopyMods.ClickWhileDrag;  // TRUE if the click was made while a drag was in progress
00404     PushCentreTool  = CopyMods.PushCentreTool;  // TRUE if user wants to drag move view or auto-centre to mouse pos
00405 
00406     return *this;
00407 }

void ClickModifiers::RestoreDefaults  )  [static]
 

Set the three button function prefs to their default values...

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 235 of file clikmods.cpp.

void ClickModifiers::SetButtonFunc UINT32  ButtonID,
ButtonFunction  bf
[static]
 

Set the function linked to a mouse button.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/03/95
Parameters:
0,1 or 2 indicating Left Middle or Right mouse button [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 290 of file clikmods.cpp.

00291 {
00292     switch (ButtonID)
00293     {
00294         case 0:
00295             LeftButtonFunction = bf;
00296             return;
00297         case 1:
00298             MiddleButtonFunction = bf;
00299             return;
00300         case 2:
00301             RightButtonFunction = bf;
00302             return;
00303         default:
00304             ERROR3("GetButtonFunc asked for the function assigned to an unknown button!");
00305     }
00306 }

UINT32 ClickModifiers::SynthesizeMouseEventFlags wxMouseEvent &  event  )  [static]
 

Create nFlags bitfield by interrogating the state of keys and mouse buttons.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/03/95
Parameters:
wxMouseEvent event The event that contains button state [INPUTS]
- [OUTPUTS]
Returns:
nFlags in the same format as received from MFC during OnClick, OnMouseMove events, etc.

Definition at line 494 of file clikmods.cpp.

00495 {
00496     UINT32 nFlags = 0;
00497 
00498     // The OS swaps the mouse buttons over before putting them in the nFlags
00499     // bitfield if a user pref is set so we must do the same...
00500 PORTNOTE("other", "Check use of wxSYS_SWAP_BUTTONS")
00501 //  BOOL swapped = wxSystemSettings::GetMetric( wxSYS_SWAP_BUTTONS );
00502     BOOL swapped = FALSE;
00503 
00504     nFlags |= (event.ControlDown()      ? MK_CONTROL : 0);
00505     nFlags |= (event.ShiftDown()        ? MK_SHIFT : 0);
00506     nFlags |= (event.AltDown()          ? MK_ALT : 0);
00507 
00508     // Note: wxMouseState.LeftDown is equivalent to wxMouseEvent.LeftIsDown
00509     nFlags |= (event.LeftIsDown()       ? (swapped ? MK_RBUTTON : MK_LBUTTON) : 0);
00510     nFlags |= (event.MiddleIsDown()     ? MK_MBUTTON : 0);
00511     nFlags |= (event.RightIsDown()      ? (swapped ? MK_LBUTTON : MK_RBUTTON) : 0);
00512 
00513     return nFlags;
00514 }

UINT32 ClickModifiers::SynthesizeMouseEventFlags  )  [static]
 

Create nFlags bitfield by interrogating the state of keys and mouse buttons.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
nFlags in the same format as received from MFC during OnClick, OnMouseMove events, etc.

Definition at line 454 of file clikmods.cpp.

00455 {
00456     UINT32 nFlags = 0;
00457 
00458     // The OS swaps the mouse buttons over before putting them in the nFlags
00459     // bitfield if a user pref is set so we must do the same...
00460 PORTNOTE("other", "Check use of wxSYS_SWAP_BUTTONS")
00461 //  BOOL swapped = wxSystemSettings::GetMetric( wxSYS_SWAP_BUTTONS );
00462     BOOL swapped = FALSE;
00463 
00464     wxMouseState state = ::wxGetMouseState();
00465 
00466     nFlags |= (state.ControlDown()      ? MK_CONTROL : 0);
00467     nFlags |= (state.ShiftDown()        ? MK_SHIFT : 0);
00468     nFlags |= (state.AltDown()          ? MK_ALT : 0);
00469 
00470     // Note: wxMouseState.LeftDown is equivalent to wxMouseEvent.LeftIsDown
00471     nFlags |= (state.LeftDown()         ? (swapped ? MK_RBUTTON : MK_LBUTTON) : 0);
00472     nFlags |= (state.MiddleDown()       ? MK_MBUTTON : 0);
00473     nFlags |= (state.RightDown()        ? (swapped ? MK_LBUTTON : MK_RBUTTON) : 0);
00474 
00475     return nFlags;
00476 }


Member Data Documentation

BOOL ClickModifiers::Adjust
 

Definition at line 162 of file clikmods.h.

BOOL ClickModifiers::Alternative1
 

Definition at line 165 of file clikmods.h.

BOOL ClickModifiers::Alternative2
 

Definition at line 166 of file clikmods.h.

UINT32 ClickModifiers::ButtFuncNames [static, private]
 

Initial value:

    {
                        _R(IDS_BUTTFUNC_NORMAL),
                        _R(IDS_BUTTFUNC_SHIFT),
                        _R(IDS_BUTTFUNC_CONSTRAIN),
                        _R(IDS_BUTTFUNC_ALTERNATIVE),
                        _R(IDS_BUTTFUNC_MENU),

                        _R(IDS_BUTTFUNC_FULLSCREEN),
                        _R(IDS_BUTTFUNC_ZOOMIN),

                        }

Definition at line 221 of file clikmods.h.

BOOL ClickModifiers::ClickWhileDrag
 

Definition at line 175 of file clikmods.h.

BOOL ClickModifiers::Constrain
 

Definition at line 164 of file clikmods.h.

BOOL ClickModifiers::EditObject
 

Definition at line 168 of file clikmods.h.

BOOL ClickModifiers::FullScreen
 

Definition at line 169 of file clikmods.h.

ButtonFunction ClickModifiers::LeftButtonFunction = BUTTFUNC_NORMAL [static, private]
 

Determine the action of the left mouse button.

Preference: LeftButtonFunction Section: Mouse Range: ButtonFunction enum

Definition at line 217 of file clikmods.h.

BOOL ClickModifiers::Menu
 

Definition at line 163 of file clikmods.h.

ButtonFunction ClickModifiers::MiddleButtonFunction = BUTTFUNC_PUSHCENTRE [static, private]
 

Determine the action of the middle mouse button.

Preference: MiddleButtonFunction Section: Mouse Range: ButtonFunction enum

Definition at line 218 of file clikmods.h.

UINT32 ClickModifiers::Pressure
 

Definition at line 182 of file clikmods.h.

BOOL ClickModifiers::PushCentreTool
 

Definition at line 180 of file clikmods.h.

ButtonFunction ClickModifiers::RightButtonFunction = BUTTFUNC_MENU [static, private]
 

Determine the action of the right mouse button.

Preference: RightButtonFunction Section: Mouse Range: ButtonFunction enum

Definition at line 219 of file clikmods.h.

BOOL ClickModifiers::ZoomIn
 

Definition at line 170 of file clikmods.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:34 2007 for Camelot by  doxygen 1.4.4