Make ITEM_MODIFICATION_ROUTINE status messages more general and easier to call
This commit is contained in:
parent
b18fd12694
commit
b6cd7e3b4a
|
@ -1386,10 +1386,9 @@ int EDIT_TOOL::ModifyLines( const TOOL_EVENT& aEvent )
|
|||
|
||||
commit.Push( pairwise_line_routine->GetCommitDescription() );
|
||||
|
||||
if( pairwise_line_routine->GetSuccesses() == 0 )
|
||||
frame()->ShowInfoBarMsg( pairwise_line_routine->GetCompleteFailureMessage() );
|
||||
else if( pairwise_line_routine->GetFailures() > 0 )
|
||||
frame()->ShowInfoBarMsg( pairwise_line_routine->GetSomeFailuresMessage() );
|
||||
if (const std::optional<wxString> msg = pairwise_line_routine->GetStatusMessage()) {
|
||||
frame()->ShowInfoBarMsg( *msg );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -63,15 +63,20 @@ wxString LINE_FILLET_ROUTINE::GetCommitDescription() const
|
|||
return _( "Fillet Lines" );
|
||||
}
|
||||
|
||||
wxString LINE_FILLET_ROUTINE::GetCompleteFailureMessage() const
|
||||
|
||||
std::optional<wxString> LINE_FILLET_ROUTINE::GetStatusMessage() const
|
||||
{
|
||||
if( GetSuccesses() == 0 )
|
||||
{
|
||||
return _( "Unable to fillet the selected lines." );
|
||||
}
|
||||
|
||||
wxString LINE_FILLET_ROUTINE::GetSomeFailuresMessage() const
|
||||
else if( GetFailures() > 0 )
|
||||
{
|
||||
return _( "Some of the lines could not be filleted." );
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
void LINE_FILLET_ROUTINE::ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB )
|
||||
{
|
||||
|
@ -168,15 +173,20 @@ wxString LINE_CHAMFER_ROUTINE::GetCommitDescription() const
|
|||
return _( "Chamfer Lines" );
|
||||
}
|
||||
|
||||
wxString LINE_CHAMFER_ROUTINE::GetCompleteFailureMessage() const
|
||||
|
||||
std::optional<wxString> LINE_CHAMFER_ROUTINE::GetStatusMessage() const
|
||||
{
|
||||
if( GetSuccesses() == 0 )
|
||||
{
|
||||
return _( "Unable to chamfer the selected lines." );
|
||||
}
|
||||
|
||||
wxString LINE_CHAMFER_ROUTINE::GetSomeFailuresMessage() const
|
||||
else if( GetFailures() > 0 )
|
||||
{
|
||||
return _( "Some of the lines could not be chamfered." );
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
void LINE_CHAMFER_ROUTINE::ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB )
|
||||
{
|
||||
|
@ -230,15 +240,20 @@ wxString LINE_EXTENSION_ROUTINE::GetCommitDescription() const
|
|||
return _( "Extend Lines to Meet" );
|
||||
}
|
||||
|
||||
wxString LINE_EXTENSION_ROUTINE::GetCompleteFailureMessage() const
|
||||
|
||||
std::optional<wxString> LINE_EXTENSION_ROUTINE::GetStatusMessage() const
|
||||
{
|
||||
if( GetSuccesses() == 0 )
|
||||
{
|
||||
return _( "Unable to extend the selected lines to meet." );
|
||||
}
|
||||
|
||||
wxString LINE_EXTENSION_ROUTINE::GetSomeFailuresMessage() const
|
||||
else if( GetFailures() > 0 )
|
||||
{
|
||||
return _( "Some of the lines could not be extended to meet." );
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
void LINE_EXTENSION_ROUTINE::ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB )
|
||||
{
|
||||
|
|
|
@ -164,8 +164,12 @@ public:
|
|||
|
||||
virtual wxString GetCommitDescription() const = 0;
|
||||
|
||||
virtual wxString GetCompleteFailureMessage() const = 0;
|
||||
virtual wxString GetSomeFailuresMessage() const = 0;
|
||||
/**
|
||||
* @brief Get a status message to show when the routine is complete
|
||||
*
|
||||
* Usually this will be an error or nothing.
|
||||
*/
|
||||
virtual std::optional<wxString> GetStatusMessage() const = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -246,8 +250,7 @@ public:
|
|||
}
|
||||
|
||||
wxString GetCommitDescription() const override;
|
||||
wxString GetCompleteFailureMessage() const override;
|
||||
wxString GetSomeFailuresMessage() const override;
|
||||
std::optional<wxString> GetStatusMessage() const override;
|
||||
|
||||
void ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB ) override;
|
||||
|
||||
|
@ -269,8 +272,7 @@ public:
|
|||
}
|
||||
|
||||
wxString GetCommitDescription() const override;
|
||||
wxString GetCompleteFailureMessage() const override;
|
||||
wxString GetSomeFailuresMessage() const override;
|
||||
std::optional<wxString> GetStatusMessage() const override;
|
||||
|
||||
void ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB ) override;
|
||||
|
||||
|
@ -290,8 +292,7 @@ public:
|
|||
}
|
||||
|
||||
wxString GetCommitDescription() const override;
|
||||
wxString GetCompleteFailureMessage() const override;
|
||||
wxString GetSomeFailuresMessage() const override;
|
||||
std::optional<wxString> GetStatusMessage() const override;
|
||||
|
||||
void ProcessLinePair( PCB_SHAPE& aLineA, PCB_SHAPE& aLineB ) override;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue