Mouse functions are now in a separate class

This commit is contained in:
Markus Gans 2018-01-14 21:53:45 +01:00
parent 48cdd9bb0a
commit 8addcbbcb7
4 changed files with 70 additions and 58 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
*.gcov *.gcov
*.gcno *.gcno
*.gcda *.gcda
stamp-h1
_configs.sed _configs.sed
config.guess config.guess
config.h.in~ config.h.in~

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2013-2017 Markus Gans * * Copyright 2013-2018 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *

View File

@ -199,7 +199,7 @@ class FMouseGPM : public FMouse
virtual ~FMouseGPM(); virtual ~FMouseGPM();
// Accessors // Accessors
const char* getClassName() const; virtual const char* getClassName() const;
// Mutators // Mutators
void setStdinNo(int); void setStdinNo(int);
@ -238,10 +238,6 @@ class FMouseGPM : public FMouse
#pragma pack(pop) #pragma pack(pop)
#endif #endif
//----------------------------------------------------------------------
inline const char* FMouseGPM::getClassName() const
{ return "FMouseGPM"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMouseGPM::enableGpmMouse() inline bool FMouseGPM::enableGpmMouse()
{ return gpmMouse(true); } { return gpmMouse(true); }
@ -272,7 +268,7 @@ class FMouseX11 : public FMouse
virtual ~FMouseX11(); virtual ~FMouseX11();
// Accessors // Accessors
const char* getClassName() const; virtual const char* getClassName() const;
// Inquiry // Inquiry
virtual bool hasData(); virtual bool hasData();
@ -317,10 +313,6 @@ class FMouseX11 : public FMouse
}; };
#pragma pack(pop) #pragma pack(pop)
//----------------------------------------------------------------------
inline const char* FMouseX11::getClassName() const
{ return "FMouseX11"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FMouseSGR // class FMouseSGR
@ -339,7 +331,7 @@ class FMouseSGR : public FMouse
virtual ~FMouseSGR(); virtual ~FMouseSGR();
// Accessors // Accessors
const char* getClassName() const; virtual const char* getClassName() const;
// Inquiry // Inquiry
virtual bool hasData(); virtual bool hasData();
@ -384,10 +376,6 @@ class FMouseSGR : public FMouse
}; };
#pragma pack(pop) #pragma pack(pop)
//----------------------------------------------------------------------
inline const char* FMouseSGR::getClassName() const
{ return "FMouseSGR"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FMouseUrxvt // class FMouseUrxvt
@ -406,7 +394,7 @@ class FMouseUrxvt : public FMouse
virtual ~FMouseUrxvt(); virtual ~FMouseUrxvt();
// Accessors // Accessors
const char* getClassName() const; virtual const char* getClassName() const;
// Inquiry // Inquiry
virtual bool hasData(); virtual bool hasData();
@ -451,10 +439,6 @@ class FMouseUrxvt : public FMouse
}; };
#pragma pack(pop) #pragma pack(pop)
//----------------------------------------------------------------------
inline const char* FMouseUrxvt::getClassName() const
{ return "FMouseUrxvt"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FMouseControl // class FMouseControl
@ -472,50 +456,49 @@ class FMouseControl
virtual ~FMouseControl(); virtual ~FMouseControl();
// Accessors // Accessors
const char* getClassName() const; virtual const char* getClassName() const;
FPoint& getPos(); FPoint& getPos();
void clearEvent(); void clearEvent();
// Mutators // Mutators
void setStdinNo (int); void setStdinNo (int);
void setMaxWidth (short); void setMaxWidth (short);
void setMaxHeight (short); void setMaxHeight (short);
void useGpmMouse (bool = true); void useGpmMouse (bool = true);
void useXtermMouse (bool = true); void useXtermMouse (bool = true);
// Inquiries // Inquiries
bool hasData(); bool hasData();
bool hasEvent(); bool hasEvent();
bool isLeftButtonPressed(); bool isLeftButtonPressed();
bool isLeftButtonReleased(); bool isLeftButtonReleased();
bool isLeftButtonDoubleClick(); bool isLeftButtonDoubleClick();
bool isRightButtonPressed(); bool isRightButtonPressed();
bool isRightButtonReleased(); bool isRightButtonReleased();
bool isMiddleButtonPressed(); bool isMiddleButtonPressed();
bool isMiddleButtonReleased(); bool isMiddleButtonReleased();
bool isShiftKeyPressed(); bool isShiftKeyPressed();
bool isControlKeyPressed(); bool isControlKeyPressed();
bool isMetaKeyPressed(); bool isMetaKeyPressed();
bool isWheelUp(); bool isWheelUp();
bool isWheelDown(); bool isWheelDown();
bool isMoved(); bool isMoved();
bool isInputDataPending(); bool isInputDataPending();
bool isGpmMouseEnabled(); bool isGpmMouseEnabled();
// Methods // Methods
void enable(); void enable();
void disable(); void disable();
void xtermMouse (bool); void xtermMouse (bool);
void enableXTermMouse(); void enableXTermMouse();
void disableXTermMouse(); void disableXTermMouse();
virtual void setRawData (FMouse::mouse_type, char[], int); virtual void setRawData (FMouse::mouse_type, char[], int);
virtual void processEvent (struct timeval* time); virtual void processEvent (struct timeval* time);
bool getGpmKeyPressed (bool); bool getGpmKeyPressed (bool);
void drawGpmPointer(); void drawGpmPointer();
private: private:
std::map<FMouse::mouse_type, FMouse*> mouse_protocol;
std::map<FMouse::mouse_type, FMouse*>::iterator iter;
// Accessor // Accessor
FMouse* getMouseWithData(); FMouse* getMouseWithData();
@ -523,6 +506,8 @@ class FMouseControl
void putstring (const char[], int = 1); void putstring (const char[], int = 1);
// Data Member // Data Member
std::map<FMouse::mouse_type, FMouse*> mouse_protocol;
std::map<FMouse::mouse_type, FMouse*>::iterator iter;
FPoint zero_point; FPoint zero_point;
bool use_gpm_mouse; bool use_gpm_mouse;
bool use_xterm_mouse; bool use_xterm_mouse;

View File

@ -238,6 +238,12 @@ FMouseGPM::~FMouseGPM() // destructor
// public methods of FMouseX11 // public methods of FMouseX11
//----------------------------------------------------------------------
const char* FMouseGPM::getClassName() const
{
return "FMouseGPM";
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseGPM::setStdinNo (int file_descriptor) void FMouseGPM::setStdinNo (int file_descriptor)
{ {
@ -459,6 +465,12 @@ FMouseX11::~FMouseX11() // destructor
// public methods of FMouseX11 // public methods of FMouseX11
//----------------------------------------------------------------------
const char* FMouseX11::getClassName() const
{
return "FMouseX11";
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseX11::hasData() bool FMouseX11::hasData()
{ {
@ -653,6 +665,12 @@ FMouseSGR::~FMouseSGR() // destructor
// public methods of FMouseSGR // public methods of FMouseSGR
//----------------------------------------------------------------------
const char* FMouseSGR::getClassName() const
{
return "FMouseSGR";
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseSGR::hasData() bool FMouseSGR::hasData()
{ {
@ -896,6 +914,12 @@ FMouseUrxvt::~FMouseUrxvt() // destructor
// public methods of FMouseUrxvt // public methods of FMouseUrxvt
//----------------------------------------------------------------------
const char* FMouseUrxvt::getClassName() const
{
return "FMouseUrxvt";
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouseUrxvt::hasData() bool FMouseUrxvt::hasData()
{ {
@ -1148,7 +1172,9 @@ void FMouseUrxvt::setButtonState (int button, struct timeval* time)
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseControl::FMouseControl() FMouseControl::FMouseControl()
: zero_point(0,0) : mouse_protocol()
, iter()
, zero_point(0,0)
, use_gpm_mouse(false) , use_gpm_mouse(false)
, use_xterm_mouse(false) , use_xterm_mouse(false)
{ {