Implement user viewports.

ADDED popup to Appearances palette where users can define viewports
for later selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/2271
This commit is contained in:
Jeff Young 2021-10-24 23:07:06 +01:00
parent 58d4ac2a97
commit 6c05e5d1a8
13 changed files with 525 additions and 23 deletions

View File

@ -33,10 +33,12 @@
#endif #endif
EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ) : EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems,
wxKeyCode aCtrlKey ) :
EDA_VIEW_SWITCHER_BASE( aParent ), EDA_VIEW_SWITCHER_BASE( aParent ),
m_tabState( true ), m_tabState( true ),
m_receivingEvents( false ) m_receivingEvents( false ),
m_ctrlKey( aCtrlKey )
{ {
m_listBox->InsertItems( aItems, 0 ); m_listBox->InsertItems( aItems, 0 );
m_listBox->SetSelection( std::min( 1, (int) m_listBox->GetCount() - 1 ) ); m_listBox->SetSelection( std::min( 1, (int) m_listBox->GetCount() - 1 ) );
@ -129,7 +131,7 @@ bool EDA_VIEW_SWITCHER::TryBefore( wxEvent& aEvent )
} }
// Check for control key trailing edge // Check for control key trailing edge
if( !wxGetKeyState( WXK_RAW_CONTROL ) ) if( !wxGetKeyState( m_ctrlKey ) )
{ {
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
} }

View File

@ -128,3 +128,66 @@ void PARAM_LAYER_PRESET::jsonToPresets( const nlohmann::json& aJson )
} }
} }
} }
PARAM_VIEWPORT::PARAM_VIEWPORT( const std::string& aPath, std::vector<VIEWPORT>* aViewportList ) :
PARAM_LAMBDA<nlohmann::json>( aPath,
std::bind( &PARAM_VIEWPORT::viewportsToJson, this ),
std::bind( &PARAM_VIEWPORT::jsonToViewports, this, _1 ),
{} ),
m_viewports( aViewportList )
{
wxASSERT( aViewportList );
}
nlohmann::json PARAM_VIEWPORT::viewportsToJson()
{
nlohmann::json ret = nlohmann::json::array();
for( const VIEWPORT& viewport : *m_viewports )
{
nlohmann::json js = {
{ "name", viewport.name },
{ "x", viewport.rect.GetX() },
{ "y", viewport.rect.GetY() },
{ "w", viewport.rect.GetWidth() },
{ "h", viewport.rect.GetHeight() }
};
ret.push_back( js );
}
return ret;
}
void PARAM_VIEWPORT::jsonToViewports( const nlohmann::json& aJson )
{
if( aJson.empty() || !aJson.is_array() )
return;
m_viewports->clear();
for( const nlohmann::json& viewport : aJson )
{
if( viewport.contains( "name" ) )
{
VIEWPORT v( viewport.at( "name" ).get<wxString>() );
if( viewport.contains( "x" ) )
v.rect.SetX( viewport.at( "x" ).get<double>() );
if( viewport.contains( "y" ) )
v.rect.SetY( viewport.at( "y" ).get<double>() );
if( viewport.contains( "w" ) )
v.rect.SetWidth( viewport.at( "w" ).get<double>() );
if( viewport.contains( "h" ) )
v.rect.SetHeight( viewport.at( "h" ).get<double>() );
m_viewports->emplace_back( v );
}
}
}

View File

@ -109,6 +109,8 @@ PROJECT_FILE::PROJECT_FILE( const wxString& aFullPath ) :
m_NetSettings = std::make_shared<NET_SETTINGS>( this, "net_settings" ); m_NetSettings = std::make_shared<NET_SETTINGS>( this, "net_settings" );
m_params.emplace_back( new PARAM_LAYER_PRESET( "board.layer_presets", &m_LayerPresets ) ); m_params.emplace_back( new PARAM_LAYER_PRESET( "board.layer_presets", &m_LayerPresets ) );
m_params.emplace_back( new PARAM_VIEWPORT( "board.viewports", &m_Viewports ) );
} }

View File

@ -29,7 +29,7 @@
class EDA_VIEW_SWITCHER : public EDA_VIEW_SWITCHER_BASE class EDA_VIEW_SWITCHER : public EDA_VIEW_SWITCHER_BASE
{ {
public: public:
EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems ); EDA_VIEW_SWITCHER( wxWindow* aParent, const wxArrayString& aItems, wxKeyCode aCtrlKey );
int GetSelection() const { return m_listBox->GetSelection(); } int GetSelection() const { return m_listBox->GetSelection(); }
@ -38,8 +38,9 @@ protected:
bool Show( bool show ) override; bool Show( bool show ) override;
protected: protected:
bool m_tabState; bool m_tabState;
bool m_receivingEvents; bool m_receivingEvents;
wxKeyCode m_ctrlKey;
}; };
#endif // EDA_VIEW_SWITCHER_H #endif // EDA_VIEW_SWITCHER_H

View File

@ -26,6 +26,7 @@
// Can be removed by refactoring PARAM_LAYER_PRESET // Can be removed by refactoring PARAM_LAYER_PRESET
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <math/box2.h>
/** /**
* This file contains data structures that are saved in the project file or project local settings * This file contains data structures that are saved in the project file or project local settings
@ -181,4 +182,34 @@ private:
std::vector<LAYER_PRESET>* m_presets; std::vector<LAYER_PRESET>* m_presets;
}; };
struct VIEWPORT
{
VIEWPORT( const wxString& aName = wxEmptyString ) :
name( aName )
{ }
VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
name( aName ),
rect( aRect )
{ }
wxString name;
BOX2D rect;
};
class PARAM_VIEWPORT : public PARAM_LAMBDA<nlohmann::json>
{
public:
PARAM_VIEWPORT( const std::string& aPath, std::vector<VIEWPORT>* aViewportList );
private:
nlohmann::json viewportsToJson();
void jsonToViewports( const nlohmann::json& aJson );
std::vector<VIEWPORT>* m_viewports;
};
#endif // KICAD_BOARD_PROJECT_SETTINGS_H #endif // KICAD_BOARD_PROJECT_SETTINGS_H

View File

@ -167,8 +167,9 @@ public:
*/ */
std::shared_ptr<NET_SETTINGS> m_NetSettings; std::shared_ptr<NET_SETTINGS> m_NetSettings;
/// List of stored layer presets
std::vector<LAYER_PRESET> m_LayerPresets; std::vector<LAYER_PRESET> m_LayerPresets; /// List of stored layer presets
std::vector<VIEWPORT> m_Viewports; /// List of stored viewports (pos + zoom)
private: private:
/// An list of schematic sheets in this project /// An list of schematic sheets in this project

View File

@ -94,18 +94,19 @@ void PCB_BASE_EDIT_FRAME::doCloseWindow()
bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent ) bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
{ {
static bool s_switcherShown = false; static bool s_presetSwitcherShown = false;
static bool s_viewportSwitcherShown = false;
if( !s_switcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) ) if( !s_presetSwitcherShown && wxGetKeyState( WXK_RAW_CONTROL ) && wxGetKeyState( WXK_TAB ) )
{ {
if( m_appearancePanel && this->IsActive() ) if( m_appearancePanel && this->IsActive() )
{ {
const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU(); const wxArrayString& mru = m_appearancePanel->GetLayerPresetsMRU();
EDA_VIEW_SWITCHER switcher( this, mru ); EDA_VIEW_SWITCHER switcher( this, mru, WXK_RAW_CONTROL );
s_switcherShown = true; s_presetSwitcherShown = true;
switcher.ShowModal(); switcher.ShowModal();
s_switcherShown = false; s_presetSwitcherShown = false;
int idx = switcher.GetSelection(); int idx = switcher.GetSelection();
@ -115,6 +116,25 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
return true; return true;
} }
} }
else if( !s_viewportSwitcherShown && wxGetKeyState( WXK_ALT ) && wxGetKeyState( WXK_TAB ) )
{
if( m_appearancePanel && this->IsActive() )
{
const wxArrayString& mru = m_appearancePanel->GetViewportsMRU();
EDA_VIEW_SWITCHER switcher( this, mru, WXK_ALT );
s_viewportSwitcherShown = true;
switcher.ShowModal();
s_viewportSwitcherShown = false;
int idx = switcher.GetSelection();
if( idx >= 0 && idx < (int) mru.size() )
m_appearancePanel->ApplyViewport( mru[idx] );
return true;
}
}
return PCB_BASE_FRAME::TryBefore( aEvent ); return PCB_BASE_FRAME::TryBefore( aEvent );
} }

View File

@ -94,6 +94,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
netclassColors[pair.first] = pair.second->GetPcbColor(); netclassColors[pair.first] = pair.second->GetPcbColor();
m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets ); m_appearancePanel->SetUserLayerPresets( project.m_LayerPresets );
m_appearancePanel->SetUserViewports( project.m_Viewports );
PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selTool = GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter(); SELECTION_FILTER_OPTIONS& filterOpts = selTool->GetFilter();
@ -145,6 +146,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
project.m_BoardDrawingSheetFile = BASE_SCREEN::m_DrawingSheetFileName; project.m_BoardDrawingSheetFile = BASE_SCREEN::m_DrawingSheetFileName;
project.m_LayerPresets = m_appearancePanel->GetUserLayerPresets(); project.m_LayerPresets = m_appearancePanel->GetUserLayerPresets();
project.m_Viewports = m_appearancePanel->GetUserViewports();
RecordDRCExclusions(); RecordDRCExclusions();

View File

@ -432,6 +432,7 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
m_windowLayers->SetFont( infoFont ); m_windowLayers->SetFont( infoFont );
m_windowObjects->SetFont( infoFont ); m_windowObjects->SetFont( infoFont );
m_presetsLabel->SetFont( infoFont ); m_presetsLabel->SetFont( infoFont );
m_viewportsLabel->SetFont( infoFont );
createControls(); createControls();
@ -983,6 +984,7 @@ void APPEARANCE_CONTROLS::OnBoardChanged()
rebuildNets(); rebuildNets();
rebuildLayerPresetsWidget(); rebuildLayerPresetsWidget();
syncLayerPresetSelection(); syncLayerPresetSelection();
rebuildViewportsWidget();
UpdateDisplayOptions(); UpdateDisplayOptions();
@ -1394,6 +1396,51 @@ void APPEARANCE_CONTROLS::ApplyLayerPreset( const LAYER_PRESET& aPreset )
} }
std::vector<VIEWPORT> APPEARANCE_CONTROLS::GetUserViewports() const
{
std::vector<VIEWPORT> ret;
for( const std::pair<const wxString, VIEWPORT>& pair : m_viewports )
ret.emplace_back( pair.second );
return ret;
}
void APPEARANCE_CONTROLS::SetUserViewports( std::vector<VIEWPORT>& aViewportList )
{
m_viewports.clear();
for( const VIEWPORT& viewport : aViewportList )
{
if( m_viewports.count( viewport.name ) )
continue;
m_viewports[viewport.name] = viewport;
m_viewportMRU.Add( viewport.name );
}
rebuildViewportsWidget();
}
void APPEARANCE_CONTROLS::ApplyViewport( const wxString& aViewportName )
{
updateViewportSelection( aViewportName );
wxCommandEvent dummy;
onViewportChanged( dummy );
}
void APPEARANCE_CONTROLS::ApplyViewport( const VIEWPORT& aViewport )
{
updateViewportSelection( aViewport.name );
doApplyViewport( aViewport );
}
void APPEARANCE_CONTROLS::rebuildLayers() void APPEARANCE_CONTROLS::rebuildLayers()
{ {
BOARD* board = m_frame->GetBoard(); BOARD* board = m_frame->GetBoard();
@ -2343,7 +2390,7 @@ void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget()
m_cbLayerPresets->SetSelection( 0 ); m_cbLayerPresets->SetSelection( 0 );
// At least the build in presets should always be present // At least the built-in presets should always be present
wxASSERT( !m_layerPresets.empty() ); wxASSERT( !m_layerPresets.empty() );
// Default preset: all layers // Default preset: all layers
@ -2541,6 +2588,144 @@ void APPEARANCE_CONTROLS::doApplyLayerPreset( const LAYER_PRESET& aPreset )
} }
void APPEARANCE_CONTROLS::rebuildViewportsWidget()
{
m_cbViewports->Clear();
for( std::pair<const wxString, VIEWPORT>& pair : m_viewports )
m_cbViewports->Append( pair.first, static_cast<void*>( &pair.second ) );
m_cbViewports->Append( wxT( "-----" ) );
m_cbViewports->Append( _( "Save viewport..." ) );
m_cbViewports->Append( _( "Delete viewport..." ) );
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
m_lastSelectedViewport = nullptr;
}
void APPEARANCE_CONTROLS::updateViewportSelection( const wxString& aName )
{
int idx = m_cbViewports->FindString( aName );
if( idx >= 0 && m_cbViewports->GetSelection() != idx )
{
m_cbViewports->SetSelection( idx );
m_lastSelectedViewport = static_cast<VIEWPORT*>( m_cbViewports->GetClientData( idx ) );
}
else if( idx < 0 )
{
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 ); // separator
m_lastSelectedViewport = nullptr;
}
}
void APPEARANCE_CONTROLS::onViewportChanged( wxCommandEvent& aEvent )
{
int count = m_cbViewports->GetCount();
int index = m_cbViewports->GetSelection();
if( index >= 0 && index < count - 3 )
{
VIEWPORT* viewport = static_cast<VIEWPORT*>( m_cbViewports->GetClientData( index ) );
if( viewport )
doApplyViewport( *viewport );
if( !viewport->name.IsEmpty() )
{
m_viewportMRU.Remove( viewport->name );
m_viewportMRU.Insert( viewport->name, 0 );
}
}
else if( index == count - 2 )
{
// Save current state to new preset
wxString name;
wxTextEntryDialog dlg( this, _( "Viewport name:" ), _( "Save Viewport" ), name );
if( dlg.ShowModal() != wxID_OK )
{
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
return;
}
name = dlg.GetValue();
bool exists = m_viewports.count( name );
if( !exists )
{
m_viewports[name] = VIEWPORT( name, m_frame->GetCanvas()->GetView()->GetViewport() );
index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) );
}
else
{
index = m_cbViewports->FindString( name );
m_viewportMRU.Remove( name );
}
m_cbViewports->SetSelection( index );
m_viewportMRU.Insert( name, 0 );
return;
}
else if( index == count - 1 )
{
// Delete an existing preset
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Viewports" ) );
for( std::pair<const wxString, VIEWPORT>& pair : m_viewports )
{
wxArrayString item;
item.Add( pair.first );
items.emplace_back( item );
}
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Viewport" ), headers, items );
dlg.SetListLabel( _( "Select viewport:" ) );
if( dlg.ShowModal() == wxID_OK )
{
wxString viewportName = dlg.GetTextSelection();
int idx = m_cbViewports->FindString( viewportName );
if( idx != wxNOT_FOUND )
{
m_layerPresets.erase( viewportName );
m_cbViewports->Delete( idx );
m_viewportMRU.Remove( viewportName );
}
}
if( m_lastSelectedViewport )
m_cbViewports->SetStringSelection( m_lastSelectedViewport->name );
else
m_cbViewports->SetSelection( m_cbViewports->GetCount() - 3 );
return;
}
passOnFocus();
}
void APPEARANCE_CONTROLS::doApplyViewport( const VIEWPORT& aViewport )
{
m_frame->GetCanvas()->GetView()->SetViewport( aViewport.rect );
m_frame->GetCanvas()->Refresh();
}
void APPEARANCE_CONTROLS::OnColorSwatchChanged( wxCommandEvent& aEvent ) void APPEARANCE_CONTROLS::OnColorSwatchChanged( wxCommandEvent& aEvent )
{ {
COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() ); COLOR_SWATCH* swatch = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );

View File

@ -260,6 +260,21 @@ public:
return m_presetMRU; return m_presetMRU;
} }
///< Return a list of viewports created by the user.
std::vector<VIEWPORT> GetUserViewports() const;
///< Update the current viewports from those saved in the project file.
void SetUserViewports( std::vector<VIEWPORT>& aPresetList );
void ApplyViewport( const wxString& aPresetName );
void ApplyViewport( const VIEWPORT& aPreset );
const wxArrayString& GetViewportsMRU()
{
return m_viewportMRU;
}
void OnColorSwatchChanged( wxCommandEvent& aEvent ); void OnColorSwatchChanged( wxCommandEvent& aEvent );
void OnLayerContextMenu( wxCommandEvent& aEvent ); void OnLayerContextMenu( wxCommandEvent& aEvent );
@ -311,6 +326,8 @@ private:
void syncLayerPresetSelection(); void syncLayerPresetSelection();
void rebuildViewportsWidget();
void onLayerLeftClick( wxMouseEvent& aEvent ); void onLayerLeftClick( wxMouseEvent& aEvent );
void rightClickHandler( wxMouseEvent& aEvent ); void rightClickHandler( wxMouseEvent& aEvent );
@ -335,6 +352,12 @@ private:
void doApplyLayerPreset( const LAYER_PRESET& aPreset ); void doApplyLayerPreset( const LAYER_PRESET& aPreset );
void updateViewportSelection( const wxString& aName );
void onViewportChanged( wxCommandEvent& aEvent ) override;
void doApplyViewport( const VIEWPORT& aViewport );
void onNetclassVisibilityChanged( wxCommandEvent& aEvent ); void onNetclassVisibilityChanged( wxCommandEvent& aEvent );
void showNetclass( const wxString& aClassName, bool aShow = true ); void showNetclass( const wxString& aClassName, bool aShow = true );
@ -397,15 +420,14 @@ private:
// TODO(JE) Move preset storage to the PCB_CONTROL tool // TODO(JE) Move preset storage to the PCB_CONTROL tool
// Storage for all layer presets
std::map<wxString, LAYER_PRESET> m_layerPresets; std::map<wxString, LAYER_PRESET> m_layerPresets;
LAYER_PRESET* m_currentPreset;
LAYER_PRESET* m_lastSelectedUserPreset;
wxArrayString m_presetMRU;
LAYER_PRESET* m_currentPreset; std::map<wxString, VIEWPORT> m_viewports;
VIEWPORT* m_lastSelectedViewport;
/// The last user (non-read-only) preset selected by the user wxArrayString m_viewportMRU;
LAYER_PRESET* m_lastSelectedUserPreset;
wxArrayString m_presetMRU;
wxMenu* m_layerContextMenu; wxMenu* m_layerContextMenu;

View File

@ -171,7 +171,28 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 ); bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 );
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bBottomMargin->Add( bPresets, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bBottomMargin->Add( 0, 2, 0, wxEXPAND, 5 );
wxBoxSizer* bViewports;
bViewports = new wxBoxSizer( wxVERTICAL );
m_viewportsLabel = new wxStaticText( this, wxID_ANY, _("Viewports (Alt+Tab):"), wxDefaultPosition, wxDefaultSize, 0 );
m_viewportsLabel->Wrap( -1 );
bViewports->Add( m_viewportsLabel, 1, wxRIGHT|wxLEFT, 2 );
wxString m_cbViewportsChoices[] = { _("(unsaved)") };
int m_cbViewportsNChoices = sizeof( m_cbViewportsChoices ) / sizeof( wxString );
m_cbViewports = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbViewportsNChoices, m_cbViewportsChoices, 0 );
m_cbViewports->SetSelection( 1 );
m_cbViewports->SetToolTip( _("Layer presets") );
bViewports->Add( m_cbViewports, 0, wxALL|wxEXPAND, 2 );
bBottomMargin->Add( bViewports, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sizerOuter->Add( bBottomMargin, 0, wxBOTTOM|wxEXPAND, 2 ); m_sizerOuter->Add( bBottomMargin, 0, wxBOTTOM|wxEXPAND, 2 );
@ -195,6 +216,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_netsGrid->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_netsGrid->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this );
m_panelNetclasses->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_panelNetclasses->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this );
m_cbLayerPresets->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this ); m_cbLayerPresets->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this );
m_cbViewports->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onViewportChanged ), NULL, this );
} }
APPEARANCE_CONTROLS_BASE::~APPEARANCE_CONTROLS_BASE() APPEARANCE_CONTROLS_BASE::~APPEARANCE_CONTROLS_BASE()
@ -214,5 +236,6 @@ APPEARANCE_CONTROLS_BASE::~APPEARANCE_CONTROLS_BASE()
m_netsGrid->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_netsGrid->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this );
m_panelNetclasses->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this ); m_panelNetclasses->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( APPEARANCE_CONTROLS_BASE::OnSetFocus ), NULL, this );
m_cbLayerPresets->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this ); m_cbLayerPresets->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onLayerPresetChanged ), NULL, this );
m_cbViewports->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( APPEARANCE_CONTROLS_BASE::onViewportChanged ), NULL, this );
} }

View File

@ -1118,7 +1118,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -1253,6 +1253,153 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">2</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bViewports</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Viewports (Alt+Tab):</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_viewportsLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;(unsaved)&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbViewports</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Layer presets</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChoice">onViewportChanged</event>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -66,6 +66,8 @@ class APPEARANCE_CONTROLS_BASE : public WX_PANEL
wxBoxSizer* m_netclassOuterSizer; wxBoxSizer* m_netclassOuterSizer;
wxStaticText* m_presetsLabel; wxStaticText* m_presetsLabel;
wxChoice* m_cbLayerPresets; wxChoice* m_cbLayerPresets;
wxStaticText* m_viewportsLabel;
wxChoice* m_cbViewports;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); } virtual void OnSetFocus( wxFocusEvent& event ) { event.Skip(); }
@ -75,6 +77,7 @@ class APPEARANCE_CONTROLS_BASE : public WX_PANEL
virtual void OnNetGridDoubleClick( wxGridEvent& event ) { event.Skip(); } virtual void OnNetGridDoubleClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnNetGridRightClick( wxGridEvent& event ) { event.Skip(); } virtual void OnNetGridRightClick( wxGridEvent& event ) { event.Skip(); }
virtual void onLayerPresetChanged( wxCommandEvent& event ) { event.Skip(); } virtual void onLayerPresetChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void onViewportChanged( wxCommandEvent& event ) { event.Skip(); }
public: public: