90 wxArrayString menuItems;
107 if( currSelection < 0 || currSelection >=
static_cast<int>(
m_menuIDs.size() ) )
125 const double r =
m_moveX.GetDoubleValue();
134 val.x =
m_moveX.GetDoubleValue();
135 val.y =
m_moveY.GetDoubleValue();
146 double moveX =
m_moveX.GetDoubleValue();
147 double moveY =
m_moveY.GetDoubleValue();
196 m_moveX.SetLabel(
_(
"Distance:" ) );
213 wxObject* obj =
event.GetEventObject();
249 wxRealPoint translation;
256 wxCHECK_MSG( anchorSelection >= 0 && anchorSelection <
static_cast<int>(
m_menuIDs.size() ),
false,
257 wxString::Format(
"Invalid rotation anchor selection: %d", anchorSelection ) );
267 wxTextCtrl* obj =
static_cast<wxTextCtrl*
>(
event.GetEventObject() );
269 if( obj->GetValue().IsEmpty() )
270 obj->SetValue(
"0" );
278 double delta_x =
m_moveX.GetDoubleValue();
279 double delta_y =
m_moveY.GetDoubleValue();
280 double max_border = std::numeric_limits<int>::max() * M_SQRT1_2;
282 if(
m_bbox.GetLeft() + delta_x < -max_border ||
283 m_bbox.GetRight() + delta_x > max_border ||
284 m_bbox.GetTop() + delta_y < -max_border ||
285 m_bbox.GetBottom() + delta_y > max_border )
287 const wxString invalid_length =
_(
"Invalid movement values. Movement would place selection "
288 "outside of the maximum board area." );
290 m_xEntry->SetToolTip( invalid_length );
291 m_xEntry->SetForegroundColour( *wxRED );
292 m_yEntry->SetToolTip( invalid_length );
293 m_yEntry->SetForegroundColour( *wxRED );
299 m_xEntry->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
301 m_yEntry->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
DIALOG_MOVE_EXACT_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Move Item"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxChoice * m_anchorOptions
wxButton * m_stdButtonsCancel
wxStaticText * m_rotLabel
wxStdDialogButtonSizer * m_stdButtons
wxButton * m_stdButtonsOK
wxCheckBox * m_polarCoords
void buildRotationAnchorMenu()
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
ROTATION_ANCHOR & m_rotationAnchor
void ToPolarDeg(double x, double y, double &r, EDA_ANGLE &q)
Convert a given Cartesian point into a polar representation.
void updateDialogControls(bool aPolar)
void OnClear(wxCommandEvent &event) override
DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, VECTOR2I &aTranslate, EDA_ANGLE &aRotate, ROTATION_ANCHOR &aAnchor, const BOX2I &aBbox)
void OnTextFocusLost(wxFocusEvent &event) override
Reset a text field to be 0 if it was exited while blank.
void OnPolarChanged(wxCommandEvent &event) override
void OnTextChanged(wxCommandEvent &event) override
bool GetTranslationInIU(wxRealPoint &val, bool polar)
Get the (Cartesian) translation described by the text entries.
std::vector< ROTATION_ANCHOR > m_menuIDs
std::vector< wxWindow * > m_tabOrder
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_UNITS GetUserUnits() const
bool IsType(FRAME_T aType) const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
@ ROTATE_AROUND_USER_ORIGIN
@ ROTATE_AROUND_SEL_CENTER
@ ROTATE_AROUND_AUX_ORIGIN
@ ROTATE_AROUND_ITEM_ANCHOR
static constexpr EDA_ANGLE ANGLE_0
Functions for manipulating tab traversal in forms and dialogs.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D