Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b163cb444 | |||
| 83d6a77617 | |||
| e5e174a20e | |||
| 8aede85214 | |||
| c625b9e3cc | |||
| 222d44a8d8 | |||
| 386f827d38 | |||
| 831c51c875 | |||
| 2d25d37112 | |||
| a3172d643f | |||
| 02787784a4 | |||
| 967f390aec | |||
| 89951b01ff | |||
| ca8f026bc3 |
@@ -683,11 +683,11 @@ void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
|
||||
void EDA_3D_VIEWER::OnActivate( wxActivateEvent &aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
|
||||
|
||||
if( m_canvas )
|
||||
if( aEvent.GetActive() && m_canvas )
|
||||
{
|
||||
// Reload data if 3D frame shows a board,
|
||||
// because it can be changed since last frame activation
|
||||
@@ -698,17 +698,17 @@ void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
|
||||
event.Skip(); // required under wxMAC
|
||||
aEvent.Skip(); // required under wxMAC
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
|
||||
void EDA_3D_VIEWER::OnSetFocus( wxFocusEvent& aEvent )
|
||||
{
|
||||
// Activates again the focus of the canvas so it will catch mouse and key events
|
||||
if( m_canvas )
|
||||
m_canvas->SetFocus();
|
||||
|
||||
event.Skip();
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
# Copyright (C) 2016 - 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2016 - 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -35,4 +35,4 @@
|
||||
# be set after each version tag is added to the git repo. This will
|
||||
# give developers a reasonable idea where which branch was used to build
|
||||
# KiCad.
|
||||
set( KICAD_VERSION "5.1.7" )
|
||||
set( KICAD_VERSION "5.1.8" )
|
||||
|
||||
+20
-13
@@ -76,7 +76,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
|
||||
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this );
|
||||
Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this );
|
||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this );
|
||||
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( EDA_DRAW_PANEL_GAL::onLostFocus ), NULL, this );
|
||||
|
||||
const wxEventType events[] =
|
||||
@@ -132,15 +132,6 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetFocus()
|
||||
{
|
||||
// Windows has a strange manner on bringing up and activating windows
|
||||
// containing a GAL canvas just after moving the mouse cursor into its area.
|
||||
// Feel free to uncomment or extend the following #ifdef if you experience
|
||||
// similar problems on your platform.
|
||||
#ifdef __WINDOWS__
|
||||
if( !GetParent()->IsDescendant( wxWindow::FindFocus() ) )
|
||||
return;
|
||||
#endif
|
||||
|
||||
wxScrolledCanvas::SetFocus();
|
||||
m_lostFocus = false;
|
||||
}
|
||||
@@ -457,7 +448,15 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::OnEvent( wxEvent& aEvent )
|
||||
{
|
||||
if( m_lostFocus && m_stealsFocus )
|
||||
bool shouldSetFocus = m_lostFocus && m_stealsFocus;
|
||||
|
||||
#if defined( _WIN32 )
|
||||
// Ensure we are the active foreground window before we attempt to steal focus
|
||||
// mouse events are generated on Win32 regardless if window is active
|
||||
shouldSetFocus = shouldSetFocus && ( m_edaFrame->GetHWND() == GetForegroundWindow() );
|
||||
#endif
|
||||
|
||||
if( shouldSetFocus )
|
||||
SetFocus();
|
||||
|
||||
if( !m_eventDispatcher )
|
||||
@@ -469,10 +468,18 @@ void EDA_DRAW_PANEL_GAL::OnEvent( wxEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::onEnter( wxEvent& aEvent )
|
||||
void EDA_DRAW_PANEL_GAL::onEnter( wxMouseEvent& aEvent )
|
||||
{
|
||||
bool shouldSetFocus = m_stealsFocus;
|
||||
|
||||
#if defined( _WIN32 )
|
||||
// Ensure we are the active foreground window before we attempt to steal focus
|
||||
// mouse events are generated on Win32 regardless if window is active
|
||||
shouldSetFocus = shouldSetFocus && ( m_edaFrame->GetHWND() == GetForegroundWindow() );
|
||||
#endif
|
||||
|
||||
// Getting focus is necessary in order to receive key events properly
|
||||
if( m_stealsFocus )
|
||||
if( shouldSetFocus )
|
||||
SetFocus();
|
||||
|
||||
aEvent.Skip();
|
||||
|
||||
@@ -138,41 +138,36 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( wxString const& aNodeName, wxString c
|
||||
|
||||
void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
||||
{
|
||||
m_tree.ResetScore();
|
||||
|
||||
wxStringTokenizer tokenizer( aSearch );
|
||||
|
||||
while( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
const wxString term = tokenizer.GetNextToken().Lower();
|
||||
EDA_COMBINED_MATCHER matcher( term );
|
||||
|
||||
m_tree.UpdateScore( matcher );
|
||||
}
|
||||
|
||||
m_tree.SortNodes();
|
||||
|
||||
{
|
||||
// DO NOT REMOVE THE FREEZE/THAW. This freeze/thaw is a flag for this model adapter
|
||||
// that tells it when it shouldn't trust any of the data in the model. When set, it will
|
||||
// not return invalid data to the UI, since this invalid data can cause crashes.
|
||||
// This is different than the update locker, which locks the UI aspects only.
|
||||
wxWindowUpdateLocker updateLock( m_widget );
|
||||
BeforeReset();
|
||||
|
||||
Freeze();
|
||||
// Even with the updateLock, wxWidgets sometimes ties its knickers in
|
||||
// a knot when trying to run a wxdataview_selection_changed_callback()
|
||||
// on a row that has been deleted.
|
||||
// https://bugs.launchpad.net/kicad/+bug/1756255
|
||||
m_widget->UnselectAll();
|
||||
Freeze();
|
||||
|
||||
Cleared();
|
||||
m_tree.ResetScore();
|
||||
|
||||
wxStringTokenizer tokenizer( aSearch );
|
||||
|
||||
while( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
const wxString term = tokenizer.GetNextToken().Lower();
|
||||
EDA_COMBINED_MATCHER matcher( term );
|
||||
|
||||
m_tree.UpdateScore( matcher );
|
||||
}
|
||||
|
||||
m_tree.SortNodes();
|
||||
AfterReset();
|
||||
Thaw();
|
||||
|
||||
// This was fixed in wxWidgets 3.0.5 and 3.1.3.
|
||||
#if defined( __WXGTK__ ) && ( (wxVERSION_NUMBER < 030005 ) || \
|
||||
( ( wxVERSION_NUMBER >= 030100 ) && ( wxVERSION_NUMBER < 030103 ) ) )
|
||||
// The fastest method to update wxDataViewCtrl is to rebuild from
|
||||
// scratch by calling Cleared(). Linux requires to reassociate model to
|
||||
// display data, but Windows will create multiple associations.
|
||||
AttachTo( m_widget );
|
||||
#endif
|
||||
}
|
||||
|
||||
LIB_TREE_NODE* bestMatch = ShowResults();
|
||||
|
||||
@@ -315,6 +315,14 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
||||
int unicode = 0;
|
||||
bool keyIsSpecial = false; // True if the key is a special key code
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Fix a constant stream of events being able to stall out wxTimers from firing
|
||||
// Which results in GAL not updating
|
||||
// https://devblogs.microsoft.com/oldnewthing/20191108-00/?p=103080
|
||||
MSG msg;
|
||||
PeekMessage(&msg, nullptr, WM_TIMER, WM_TIMER, PM_NOREMOVE);
|
||||
#endif
|
||||
|
||||
int type = aEvent.GetEventType();
|
||||
|
||||
// Sometimes there is no window that has the focus (it happens when another PCB_BASE_FRAME
|
||||
|
||||
@@ -273,7 +273,20 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent )
|
||||
|
||||
void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& aEvent )
|
||||
{
|
||||
#if defined( _WIN32 )
|
||||
// Win32 transmits mouse move and wheel events to all controls below the mouse regardless of focus
|
||||
// Forcing the focus here will cause the EDA FRAMES to immediately become the top level active window
|
||||
if( m_parentPanel->GetParent() != nullptr )
|
||||
{
|
||||
// this assumes the parent panel's parent is the eda window
|
||||
if( GetForegroundWindow() == m_parentPanel->GetParent()->GetHWND() )
|
||||
{
|
||||
m_parentPanel->SetFocus();
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_parentPanel->SetFocus();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -413,6 +413,7 @@ void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
|
||||
|
||||
void LIB_EDIT_FRAME::FreezeSearchTree()
|
||||
{
|
||||
m_treePane->Freeze();
|
||||
m_libMgr->GetAdapter()->Freeze();
|
||||
}
|
||||
|
||||
@@ -420,6 +421,7 @@ void LIB_EDIT_FRAME::FreezeSearchTree()
|
||||
void LIB_EDIT_FRAME::ThawSearchTree()
|
||||
{
|
||||
m_libMgr->GetAdapter()->Thaw();
|
||||
m_treePane->Thaw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+20
-19
@@ -147,11 +147,14 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
LIB_ALIAS* case_sensitive_match = nullptr;
|
||||
std::vector<LIB_ALIAS*> case_insensitive_matches;
|
||||
|
||||
wxString part_name;
|
||||
wxString search_name;
|
||||
wxString last_part_name;
|
||||
|
||||
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
|
||||
{
|
||||
wxString part_name = each_component->GetLibId().GetLibItemName();
|
||||
part_name = each_component->GetLibId().GetLibItemName();
|
||||
search_name = LIB_ID::FixIllegalChars( part_name, LIB_ID::ID_SCH );
|
||||
|
||||
if( last_part_name != part_name )
|
||||
{
|
||||
@@ -160,14 +163,14 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
last_part_name = part_name;
|
||||
case_insensitive_matches.clear();
|
||||
|
||||
LIB_ID id( wxEmptyString, part_name );
|
||||
LIB_ID id( wxEmptyString, search_name );
|
||||
|
||||
case_sensitive_match = aRescuer.GetPrj()->SchLibs()->FindLibraryAlias( id );
|
||||
|
||||
// If the case sensitive match failed, try a case insensitive match.
|
||||
if( !case_sensitive_match )
|
||||
// the case sensitive match failed. Try a case insensitive match
|
||||
aRescuer.GetPrj()->SchLibs()->FindLibraryNearEntries( case_insensitive_matches,
|
||||
part_name );
|
||||
search_name );
|
||||
}
|
||||
|
||||
if( case_sensitive_match || !( case_insensitive_matches.size() ) )
|
||||
@@ -192,7 +195,7 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
wxString RESCUE_CASE_CANDIDATE::GetActionDescription() const
|
||||
{
|
||||
wxString action;
|
||||
action.Printf( _( "Rename to %s" ), m_new_name );
|
||||
action.Printf( _( "Rename %s to %s" ), m_requested_name, m_new_name );
|
||||
return action;
|
||||
}
|
||||
|
||||
@@ -249,39 +252,37 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
// So a search in libraries is made only once by group
|
||||
LIB_PART* cache_match = nullptr;
|
||||
LIB_PART* lib_match = nullptr;
|
||||
wxString part_name;
|
||||
wxString search_name;
|
||||
wxString old_part_name;
|
||||
|
||||
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
|
||||
{
|
||||
wxString part_name = each_component->GetLibId().GetLibItemName();
|
||||
part_name = each_component->GetLibId().GetLibItemName();
|
||||
search_name = LIB_ID::FixIllegalChars( part_name, LIB_ID::ID_SCH );
|
||||
|
||||
if( old_part_name != part_name )
|
||||
{
|
||||
// A new part name is found (a new group starts here).
|
||||
// Search the symbol names candidates only once for this group:
|
||||
old_part_name = part_name;
|
||||
cache_match = find_component( part_name, aRescuer.GetPrj()->SchLibs(), true );
|
||||
lib_match = find_component( part_name, aRescuer.GetPrj()->SchLibs(), false );
|
||||
cache_match = find_component( search_name, aRescuer.GetPrj()->SchLibs(), true );
|
||||
lib_match = find_component( search_name, aRescuer.GetPrj()->SchLibs(), false );
|
||||
|
||||
if( !cache_match && !lib_match )
|
||||
continue;
|
||||
|
||||
// Test whether there is a conflict or if the symbol can only be found in the cache
|
||||
// and the symbol name does not have any illegal characters.
|
||||
if( LIB_ID::HasIllegalChars( part_name, LIB_ID::ID_SCH ) == -1 )
|
||||
{
|
||||
if( cache_match && lib_match &&
|
||||
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
||||
continue;
|
||||
if( cache_match && lib_match &&
|
||||
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
||||
continue;
|
||||
|
||||
if( !cache_match && lib_match )
|
||||
continue;
|
||||
}
|
||||
if( !cache_match && lib_match )
|
||||
continue;
|
||||
|
||||
// Check if the symbol has already been rescued.
|
||||
wxString new_name = LIB_ID::FixIllegalChars( part_name, LIB_ID::ID_SCH );
|
||||
|
||||
RESCUE_CACHE_CANDIDATE candidate( part_name, new_name, cache_match, lib_match,
|
||||
RESCUE_CACHE_CANDIDATE candidate( part_name, search_name, cache_match, lib_match,
|
||||
each_component->GetUnit(),
|
||||
each_component->GetConvert() );
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ protected:
|
||||
|
||||
virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) );
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
void onEnter( wxEvent& aEvent );
|
||||
void onEnter( wxMouseEvent& aEvent );
|
||||
void onLostFocus( wxFocusEvent& aEvent );
|
||||
void onRefreshTimer( wxTimerEvent& aEvent );
|
||||
void onShowTimer( wxTimerEvent& aEvent );
|
||||
|
||||
@@ -124,6 +124,7 @@ BEGIN_EVENT_TABLE( TREE_PROJECT_FRAME, wxSashLayoutWindow )
|
||||
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnCreateNewDirectory )
|
||||
EVT_MENU( ID_PROJECT_DELETE, TREE_PROJECT_FRAME::OnDeleteFile )
|
||||
EVT_MENU( ID_PROJECT_RENAME, TREE_PROJECT_FRAME::OnRenameFile )
|
||||
EVT_IDLE( TREE_PROJECT_FRAME::OnIdle )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -134,6 +135,7 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_TreeProject = NULL;
|
||||
m_selectedItem = nullptr;
|
||||
|
||||
m_watcher = NULL;
|
||||
Connect( wxEVT_FSWATCHER,
|
||||
@@ -821,7 +823,22 @@ void TREE_PROJECT_FRAME::OnSelect( wxTreeEvent& Event )
|
||||
if( !selected_item )
|
||||
return;
|
||||
|
||||
selected_item->Activate( this );
|
||||
// Bookmark the selected item but don't try and activate it until later
|
||||
// if we do it now, there will be more events at least on Windows in this frame
|
||||
// that will steal focus from any newly launched windows
|
||||
m_selectedItem = selected_item;
|
||||
}
|
||||
|
||||
|
||||
void TREE_PROJECT_FRAME::OnIdle( wxIdleEvent& aEvent )
|
||||
{
|
||||
// Idle executes once all other events finished processing
|
||||
// This makes it ideal to launch a new window without starting Focus wars.
|
||||
if( m_selectedItem != nullptr )
|
||||
{
|
||||
m_selectedItem->Activate( this );
|
||||
m_selectedItem = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
wxTreeItemId m_root;
|
||||
std::vector<wxString> m_filters;
|
||||
wxFileSystemWatcher* m_watcher; // file system watcher (since wxWidgets 2.9.2)
|
||||
TREEPROJECT_ITEM* m_selectedItem;
|
||||
|
||||
public:
|
||||
TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent );
|
||||
@@ -158,6 +159,12 @@ private:
|
||||
|
||||
void RemoveFilter( const wxString& filter );
|
||||
|
||||
/**
|
||||
* Idle event handler, used process the selected items at a point in time
|
||||
* when all other events have been consumed
|
||||
*/
|
||||
void OnIdle( wxIdleEvent &aEvent );
|
||||
|
||||
/**
|
||||
* Function AddItemToTreeProject
|
||||
* @brief Add the file or directory aName to the project tree
|
||||
|
||||
@@ -102,7 +102,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_modelsGrid->SetColAttr( 1, attr );
|
||||
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_modelsGrid->SetColAttr( 1, attr );
|
||||
m_modelsGrid->SetWindowStyleFlag( m_modelsGrid->GetWindowStyle() & ~wxHSCROLL );
|
||||
|
||||
|
||||
@@ -91,8 +91,6 @@ DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG( PCB_BASE_FRAME* aParent, BOARD* aBoard ) :
|
||||
m_board = aBoard;
|
||||
m_config = Kiface().KifaceSettings();
|
||||
|
||||
memset( m_boxSelectLayer, 0, sizeof( m_boxSelectLayer ) );
|
||||
|
||||
m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
|
||||
|
||||
initDialog();
|
||||
|
||||
@@ -191,7 +191,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
||||
#define SET_BOOL_VALUE( aRow, aCol, aValue ) \
|
||||
attr = new wxGridCellAttr; \
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() ); \
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM ); \
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); \
|
||||
attr->SetReadOnly(); \
|
||||
m_grid->SetAttr( aRow, aCol, attr ); \
|
||||
m_grid->SetCellValue( aRow, aCol, ( aValue ) ? "1" : "" )
|
||||
|
||||
@@ -113,7 +113,7 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
|
||||
auto attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_grid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
||||
auto attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_grid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_grid->SetAttr( i, COL_TEXT_UPRIGHT, attr );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,14 +554,14 @@ bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||
bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||
std::vector< SGNODE* >* items )
|
||||
{
|
||||
TDF_Label label = data.m_assy->FindShape( shape, Standard_False );
|
||||
|
||||
TDF_Label label;
|
||||
data.hasSolid = true;
|
||||
std::string partID;
|
||||
Quantity_Color col;
|
||||
Quantity_Color* lcolor = NULL;
|
||||
|
||||
if( label.IsNull() )
|
||||
// Search the whole model first to make sure something exists (may or may not have color)
|
||||
if( !data.m_assy->Search( shape, label ) )
|
||||
{
|
||||
static int i = 0;
|
||||
std::ostringstream ostr;
|
||||
@@ -570,11 +570,48 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||
}
|
||||
else
|
||||
{
|
||||
getTag( label, partID );
|
||||
|
||||
bool found_color = false;
|
||||
|
||||
if( getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
lcolor = &col;
|
||||
}
|
||||
|
||||
// If the top-level label doesn't have the color information, search components
|
||||
if( !found_color )
|
||||
{
|
||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_True, Standard_True ) &&
|
||||
getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
lcolor = &col;
|
||||
}
|
||||
}
|
||||
|
||||
// If the components do not have color information, search all components without location
|
||||
if( !found_color )
|
||||
{
|
||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_False, Standard_True ) &&
|
||||
getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
lcolor = &col;
|
||||
}
|
||||
}
|
||||
|
||||
// Our last chance to find the color looks for color as a subshape of top-level simple shapes
|
||||
if( !found_color )
|
||||
{
|
||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_False, Standard_False ) &&
|
||||
getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
lcolor = &col;
|
||||
}
|
||||
}
|
||||
|
||||
getTag( label, partID );
|
||||
}
|
||||
|
||||
TopoDS_Iterator it;
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
SCENEGRAPH* LoadModel( char const* filename );
|
||||
|
||||
#define PLUGIN_OCE_MAJOR 1
|
||||
#define PLUGIN_OCE_MINOR 1
|
||||
#define PLUGIN_OCE_PATCH 1
|
||||
#define PLUGIN_OCE_MINOR 2
|
||||
#define PLUGIN_OCE_PATCH 0
|
||||
#define PLUGIN_OCE_REVNO 0
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -889,7 +889,8 @@ void DisposeOutPts( OutPt*& pp )
|
||||
|
||||
inline void InitEdge( TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt )
|
||||
{
|
||||
std::memset( e, 0, sizeof(TEdge) );
|
||||
// This clears the C++ way
|
||||
*e = TEdge( { 0 } );
|
||||
|
||||
e->Next = eNext;
|
||||
e->Prev = ePrev;
|
||||
|
||||
Reference in New Issue
Block a user