Cleanup some dead code, and add a potentially needed fix for non-Mac.
(The Mac bug is fixed in 4e5b1da81fce7cd9ffedaec878ed07bfcfff4fe2 in our wxWidgets fork.)
This commit is contained in:
parent
8059edff0e
commit
200a06a677
|
@ -74,26 +74,19 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, T_symb
|
||||||
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
|
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
m_typeChoice->Clear();
|
m_typeChoice->Clear();
|
||||||
|
|
||||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_codePreview, wxT( "{}" ), false );
|
m_scintillaTricks = new SCINTILLA_TRICKS( m_codePreview, wxT( "{}" ), false );
|
||||||
|
|
||||||
m_paramGridMgr->Bind( wxEVT_PG_SELECTED, &DIALOG_SIM_MODEL::onParamGridSelectionChange, this );
|
m_paramGridMgr->Bind( wxEVT_PG_SELECTED, &DIALOG_SIM_MODEL::onParamGridSelectionChange, this );
|
||||||
|
|
||||||
m_paramGrid->SetValidationFailureBehavior( wxPG_VFB_STAY_IN_PROPERTY
|
|
||||||
| wxPG_VFB_BEEP
|
|
||||||
| wxPG_VFB_MARK_CELL );
|
|
||||||
|
|
||||||
wxPropertyGrid* grid = m_paramGrid->GetGrid();
|
wxPropertyGrid* grid = m_paramGrid->GetGrid();
|
||||||
|
|
||||||
//grid->SetCellBackgroundColour( grid->GetPropertyDefaultCell().GetBgCol() );
|
|
||||||
//grid->SetCellTextColour( grid->GetPropertyDefaultCell().GetFgCol();
|
|
||||||
|
|
||||||
// In wx 3.0 the color will be wrong sometimes.
|
// In wx 3.0 the color will be wrong sometimes.
|
||||||
grid->SetCellDisabledTextColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
|
grid->SetCellDisabledTextColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
|
||||||
|
|
||||||
grid->Bind( wxEVT_SET_FOCUS, &DIALOG_SIM_MODEL::onParamGridSetFocus, this );
|
grid->Bind( wxEVT_SET_FOCUS, &DIALOG_SIM_MODEL::onParamGridSetFocus, this );
|
||||||
|
grid->Bind( wxEVT_UPDATE_UI, &DIALOG_SIM_MODEL::onUpdateUI, this );
|
||||||
|
|
||||||
grid->AddActionTrigger( wxPG_ACTION_EDIT, WXK_RETURN );
|
grid->AddActionTrigger( wxPG_ACTION_EDIT, WXK_RETURN );
|
||||||
grid->DedicateKey( WXK_RETURN );
|
grid->DedicateKey( WXK_RETURN );
|
||||||
|
@ -1369,6 +1362,7 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSelectionChange( wxProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow* editorControl = grid->GetEditorControl();
|
wxWindow* editorControl = grid->GetEditorControl();
|
||||||
|
|
||||||
if( !editorControl )
|
if( !editorControl )
|
||||||
{
|
{
|
||||||
m_prevParamGridSelection = grid->GetSelection();
|
m_prevParamGridSelection = grid->GetSelection();
|
||||||
|
@ -1381,6 +1375,35 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::onParamGridSelectionChange( wxProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T_symbol, typename T_field>
|
||||||
|
void DIALOG_SIM_MODEL<T_symbol, T_field>::onUpdateUI( wxUpdateUIEvent& aEvent )
|
||||||
|
{
|
||||||
|
// This is currently patched in wxPropertyGrid::ScrollWindow() in the Mac wxWidgets fork.
|
||||||
|
// However, we may need this version if it turns out to be an issue on other platforms and
|
||||||
|
// we can't get it upstreamed.
|
||||||
|
#if 0
|
||||||
|
// It's a shame to do this on the UpdateUI event, but neither the wxPropertyGridManager,
|
||||||
|
// wxPropertyGridPage, wxPropertyGrid, nor the wxPropertyGrid's GetCanvas() window appear
|
||||||
|
// to get scroll events.
|
||||||
|
|
||||||
|
wxPropertyGrid* grid = m_paramGrid->GetGrid();
|
||||||
|
wxTextCtrl* ctrl = grid->GetEditorTextCtrl();
|
||||||
|
|
||||||
|
if( ctrl )
|
||||||
|
{
|
||||||
|
wxRect ctrlRect = ctrl->GetScreenRect();
|
||||||
|
wxRect gridRect = grid->GetScreenRect();
|
||||||
|
|
||||||
|
if( ctrlRect.GetTop() < gridRect.GetTop() || ctrlRect.GetBottom() > gridRect.GetBottom() )
|
||||||
|
{
|
||||||
|
grid->CommitChangesFromEditor();
|
||||||
|
grid->ClearSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T_symbol, typename T_field>
|
template <typename T_symbol, typename T_field>
|
||||||
void DIALOG_SIM_MODEL<T_symbol, T_field>::adjustParamGridColumns( int aWidth, bool aForce )
|
void DIALOG_SIM_MODEL<T_symbol, T_field>::adjustParamGridColumns( int aWidth, bool aForce )
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,6 +111,7 @@ private:
|
||||||
|
|
||||||
void onParamGridSetFocus( wxFocusEvent& aEvent );
|
void onParamGridSetFocus( wxFocusEvent& aEvent );
|
||||||
void onParamGridSelectionChange( wxPropertyGridEvent& aEvent );
|
void onParamGridSelectionChange( wxPropertyGridEvent& aEvent );
|
||||||
|
void onUpdateUI( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
void adjustParamGridColumns( int aWidth, bool aForce );
|
void adjustParamGridColumns( int aWidth, bool aForce );
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,7 @@ SIM_STRING_PROPERTY::SIM_STRING_PROPERTY( const wxString& aLabel, const wxString
|
||||||
SIM_VALUE_GRAMMAR::NOTATION aNotation ) :
|
SIM_VALUE_GRAMMAR::NOTATION aNotation ) :
|
||||||
wxStringProperty( aLabel, aName ),
|
wxStringProperty( aLabel, aName ),
|
||||||
SIM_PROPERTY( aModel, aParamIndex ),
|
SIM_PROPERTY( aModel, aParamIndex ),
|
||||||
m_valueType( aValueType ),
|
m_valueType( aValueType )
|
||||||
m_notation( aNotation )
|
|
||||||
{
|
{
|
||||||
SetValueFromString( GetParam().value );
|
SetValueFromString( GetParam().value );
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@ protected:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SIM_VALUE::TYPE m_valueType;
|
SIM_VALUE::TYPE m_valueType;
|
||||||
SIM_VALUE_GRAMMAR::NOTATION m_notation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue