2014-07-09 12:23:13 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 CERN
|
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLACEMENT_TOOL_H_
|
|
|
|
#define PLACEMENT_TOOL_H_
|
|
|
|
|
|
|
|
#include <tool/tool_interactive.h>
|
|
|
|
|
|
|
|
class SELECTION_TOOL;
|
|
|
|
|
|
|
|
class PLACEMENT_TOOL : public TOOL_INTERACTIVE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PLACEMENT_TOOL();
|
|
|
|
virtual ~PLACEMENT_TOOL();
|
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Reset()
|
2016-09-24 18:53:15 +00:00
|
|
|
void Reset( RESET_REASON aReason ) override {}
|
2014-07-09 12:23:13 +00:00
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Init()
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Init() override;
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function AlignTop()
|
|
|
|
* Sets Y coordinate of the selected items to the value of the top-most selected item Y coordinate.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int AlignTop( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function AlignBottom()
|
|
|
|
* Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int AlignBottom( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function AlignLeft()
|
|
|
|
* Sets X coordinate of the selected items to the value of the left-most selected item X coordinate.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int AlignLeft( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function AlignRight()
|
|
|
|
* Sets X coordinate of the selected items to the value of the right-most selected item X coordinate.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int AlignRight( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function DistributeHorizontally()
|
|
|
|
* Distributes the selected items along the X axis.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int DistributeHorizontally( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
/**
|
|
|
|
* Function DistributeVertically()
|
|
|
|
* Distributes the selected items along the Y axis.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int DistributeVertically( const TOOL_EVENT& aEvent );
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-02-14 20:49:06 +00:00
|
|
|
///> Sets up handlers for various events.
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetTransitions() override;
|
2014-07-09 12:23:13 +00:00
|
|
|
|
2015-04-30 08:46:03 +00:00
|
|
|
private:
|
2014-07-09 12:23:13 +00:00
|
|
|
SELECTION_TOOL* m_selectionTool;
|
2015-07-24 07:42:46 +00:00
|
|
|
|
|
|
|
CONTEXT_MENU* m_placementMenu;
|
2014-07-09 12:23:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* PLACEMENT_TOOL_H_ */
|