diff --git a/copyright.h b/copyright.h index 2a4c181137..be55f9706f 100644 --- a/copyright.h +++ b/copyright.h @@ -12,8 +12,8 @@ choose to document this corresponding work in the AUTHORS.txt file. /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019 + * Copyright (C) 2019 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 as published by the diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt index 2187bfa9fb..63ead70507 100644 --- a/pagelayout_editor/CMakeLists.txt +++ b/pagelayout_editor/CMakeLists.txt @@ -17,6 +17,8 @@ set( PL_EDITOR_SRCS dialogs/dialogs_for_printing.cpp dialogs/dialog_new_dataitem_base.cpp dialogs/dialog_new_dataitem.cpp + dialogs/dialog_design_inspector_base.cpp + design_inspector.cpp pl_editor_screen.cpp pl_editor_layout.cpp files.cpp diff --git a/pagelayout_editor/design_inspector.cpp b/pagelayout_editor/design_inspector.cpp new file mode 100644 index 0000000000..a3fc1c2758 --- /dev/null +++ b/pagelayout_editor/design_inspector.cpp @@ -0,0 +1,337 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2019 jp.charras at wanadoo.fr + * Copyright (C) 2019 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 as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +/** + * @file design_inspector.cpp + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* XPM + * This bitmap is used to show item types + */ +static const char* root_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #008080", + " xxxx ", + " xxx ", + " xxx ", + " xxx ", + "xxxxxxxxxxx ", + "xxxxxxxxxxxx", + "xxxxxxxxxxx ", + " xxx ", + " xxx ", + " xxx ", + " xxxx ", + " " +}; + +static const char* line_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #008080", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xx ", + "xxxxxxxxxxxx", + "xxxxxxxxxxxx" +}; + +static const char* rect_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #000080", + "xxxxxxxxxxxx", + "xxxxxxxxxxxx", + "xx xx", + "xx xx", + "xx xx", + "xx xx", + "xx xx", + "xx xx", + "xx xx", + "xx xx", + "xxxxxxxxxxxx", + "xxxxxxxxxxxx" +}; + +static const char* text_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #800000", + " xxxxxxxxxx ", + "xxxxxxxxxxxx", + "xx xx xx", + " xx ", + " xx ", + " xx ", + " xx ", + " xx ", + " xx ", + " xx ", + " xxxx ", + " xxxxxx " +}; + +static const char* poly_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #008000", + " xx ", + " xxxx ", + " xxxxxx ", + " xxxxxxxx ", + " xxxxxxxxxx ", + "xxxxxxxxxxxx", + "xxxxxxxxxxxx", + " xxxxxxxxxx ", + " xxxxxxxx ", + " xxxxxx ", + " xxxx ", + " xx " +}; + +static const char* img_xpm[] = +{ + "12 12 2 1", + " c None", + "x c #800000", + " xx ", + " xxxxxx ", + " xx xx ", + "xx xx", + "xx xx", + " xx xx ", + " xxxxxx ", + " xx ", + " xx ", + " xx ", + " xx ", + " xx " +}; + +// A helper class to draw these bitmaps into a wxGrid cell: +class BitmapGridCellRenderer : public wxGridCellStringRenderer +{ + const char** m_BitmapXPM; +public: + BitmapGridCellRenderer( const char** aBitmapXPM ) + { + m_BitmapXPM = aBitmapXPM; + } + + void Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, + wxDC& aDc, const wxRect& aRect, + int aRow, int aCol, bool aIsSelected) override; +}; + +// Column ids for m_gridListItems +#define COL_BITMAP 0 +#define COL_TYPENAME 1 +#define COL_COUNT 2 +#define COL_COMMENT 3 +#define COL_TEXTSTRING 4 + + +DIALOG_INSPECTOR::DIALOG_INSPECTOR( PL_EDITOR_FRAME* aParent ) : + DIALOG_INSPECTOR_BASE( aParent ) +{ + m_editorFrame = aParent; + ReCreateDesignList(); + + // Now all widgets have the size fixed, call FinishDialogSettings + FinishDialogSettings(); +} + + +DIALOG_INSPECTOR::~DIALOG_INSPECTOR() +{ +} + + + +void DIALOG_INSPECTOR::ReCreateDesignList() +{ + wxWindowUpdateLocker dummy( this ); // Avoid flicker when rebuilding the tree + + if( m_gridListItems->GetNumberRows() > 1 ) + m_gridListItems->DeleteRows( 1, m_gridListItems->GetNumberRows() - 1 ); + + m_itemsList.clear(); + + WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance(); + + wxFileName fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrFileName() ); + + if( fn.GetName().IsEmpty() ) + SetTitle( "" ); + else + SetTitle( fn.GetName() ); + + // The first item is the entire page + int row = 0; + GetGridList()->SetCellValue( row, COL_TYPENAME, _( "Page" ) ); + GetGridList()->SetCellValue( row, COL_COMMENT, _( "A4" ) ); + GetGridList()->SetCellValue( row, COL_COUNT, "-" ); + GetGridList()->SetCellValue( row, COL_TEXTSTRING, _( "The current page" ) ); + GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( root_xpm ) ); + GetGridList()->SetReadOnly( row, COL_BITMAP ); + m_itemsList.push_back( nullptr ); // this item is not a WS_DATA_ITEM, just a pseudo item + + // Now adding all current items + row++; + for( WS_DATA_ITEM* item : pglayout.GetItems() ) + { + const char** img = nullptr; + + switch( item->GetType() ) + { + case WS_DATA_ITEM::WS_SEGMENT: + img = line_xpm; + break; + + case WS_DATA_ITEM::WS_RECT: + img = rect_xpm; + break; + + case WS_DATA_ITEM::WS_TEXT: + img = text_xpm; + break; + + case WS_DATA_ITEM::WS_POLYPOLYGON: + img = poly_xpm; + break; + + case WS_DATA_ITEM::WS_BITMAP: + img = img_xpm; + break; + } + + GetGridList()->AppendRows( 1 ); + GetGridList()->SetCellRenderer (row, COL_BITMAP, new BitmapGridCellRenderer( img ) ); + GetGridList()->SetReadOnly( row, COL_BITMAP ); + GetGridList()->SetCellValue( row, COL_TYPENAME,item->GetClassName() ); + GetGridList()->SetCellValue( row, COL_COUNT, + wxString::Format( "%d", item->m_RepeatCount ) ); + GetGridList()->SetCellValue( row, COL_COMMENT, item->m_Info ); + + if( item->GetType() == WS_DATA_ITEM::WS_TEXT ) + { + WS_DATA_ITEM_TEXT* t_item = static_cast( item ); + GetGridList()->SetCellValue( row, COL_TEXTSTRING, t_item->m_TextBase ); + } + + m_itemsList.push_back( item ); + row++; + } +} + + +// Select the row corresponding to the WS_DATA_ITEM aItem +void DIALOG_INSPECTOR::SelectRow( WS_DATA_ITEM* aItem ) +{ + // m_itemsList[0] is not a true WS_DATA_ITEM + for( unsigned row = 1; row < m_itemsList.size(); ++row ) + { + if( m_itemsList[row] == aItem ) + { + GetGridList()->GoToCell( row, COL_TYPENAME ); + GetGridList()->SelectRow( row ); + break; + } + } +} + +//return the page layout item managed by the cell +WS_DATA_ITEM* DIALOG_INSPECTOR::GetWsDataItem( int aRow ) const +{ + return ( aRow >= 0 && aRow < (int)m_itemsList.size() ) ? m_itemsList[aRow]: nullptr; +} + + +/* return the page layout item managed by the selected cell (or NULL) + */ +WS_DATA_ITEM* DIALOG_INSPECTOR::GetSelectedWsDataItem() const +{ + int idx = GetGridList()->GetGridCursorRow(); + return GetWsDataItem( idx ); +} + + +void DIALOG_INSPECTOR::onCellClicked( wxGridEvent& event ) +{ + int row = event.GetRow(); + GetGridList()->SelectRow( row ); + + WS_DATA_ITEM* item = GetWsDataItem( row ); + + if( !item ) // only WS_DATA_ITEM are returned. + return; + + // Select this item in page layout editor, and update the properties panel: + PL_SELECTION_TOOL* selectionTool = m_editorFrame->GetToolManager()->GetTool(); + selectionTool->ClearSelection(); + EDA_ITEM* draw_item = item->GetDrawItems()[0]; + selectionTool->AddItemToSel( draw_item ); + m_editorFrame->GetCanvas()->Refresh(); + m_editorFrame->GetPropertiesFrame()->CopyPrmsFromItemToPanel( item ); +} + + +void BitmapGridCellRenderer::Draw( wxGrid& aGrid, wxGridCellAttr& aAttr, + wxDC& aDc, const wxRect& aRect, + int aRow, int aCol, bool aIsSelected) +{ + wxGridCellStringRenderer::Draw( aGrid, aAttr, aDc, aRect, aRow, aCol, aIsSelected); + wxBitmap bm( m_BitmapXPM ); + aDc.DrawBitmap( bm,aRect.GetX()+5, aRect.GetY()+2, true); +} + + +void PL_EDITOR_FRAME::ShowDesignInspector() +{ + DIALOG_INSPECTOR dlg( this ); + + dlg.ShowModal(); +} diff --git a/pagelayout_editor/design_inspector.h b/pagelayout_editor/design_inspector.h new file mode 100644 index 0000000000..96c55e3330 --- /dev/null +++ b/pagelayout_editor/design_inspector.h @@ -0,0 +1,68 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2019 jp.charras at wanadoo.fr + * Copyright (C) 2019 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 as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + + +/** + * @file design_inspector.h + */ + +#ifndef _DESIGN_INSPECTOR_H +#define _DESIGN_INSPECTOR_H + +#include +#include +#include + + +/** + * Class DESIGN_INSPECTOR is the left window showing the list of items + */ + +class DIALOG_INSPECTOR : public DIALOG_INSPECTOR_BASE +{ + friend class PL_EDITOR_FRAME; + +private: + wxGrid* GetGridList() const { return m_gridListItems; } + void onCellClicked( wxGridEvent& event ) override; + + // The list of WS_DATA_ITEM found in page layout + std::vector m_itemsList; + PL_EDITOR_FRAME* m_editorFrame; + +public: + DIALOG_INSPECTOR( PL_EDITOR_FRAME* aParent ); + ~DIALOG_INSPECTOR(); + + void ReCreateDesignList(); + + /** @return the WS_DATA_ITEM item managed by the grid row + */ + WS_DATA_ITEM* GetWsDataItem( int aRow ) const; + + /** @return the page layout item managed by the selected row (or NULL) + */ + WS_DATA_ITEM* GetSelectedWsDataItem() const; + + // Select the tree item corresponding to the WS_DATA_ITEM aItem + void SelectRow( WS_DATA_ITEM* aItem ); +}; + +#endif /* _DESIGN_INSPECTOR_H */ diff --git a/pagelayout_editor/dialogs/dialog_design_inspector_base.cpp b/pagelayout_editor/dialogs/dialog_design_inspector_base.cpp new file mode 100644 index 0000000000..0cffa1ee03 --- /dev/null +++ b/pagelayout_editor/dialogs/dialog_design_inspector_base.cpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 1 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_design_inspector_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_INSPECTOR_BASE::DIALOG_INSPECTOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + m_panelList = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizerListMain; + bSizerListMain = new wxBoxSizer( wxVERTICAL ); + + m_gridListItems = new wxGrid( m_panelList, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridListItems->CreateGrid( 1, 5 ); + m_gridListItems->EnableEditing( true ); + m_gridListItems->EnableGridLines( true ); + m_gridListItems->EnableDragGridSize( false ); + m_gridListItems->SetMargins( 0, 0 ); + + // Columns + m_gridListItems->EnableDragColMove( false ); + m_gridListItems->EnableDragColSize( true ); + m_gridListItems->SetColLabelSize( 30 ); + m_gridListItems->SetColLabelValue( 0, _("Type") ); + m_gridListItems->SetColLabelValue( 1, _("Name") ); + m_gridListItems->SetColLabelValue( 2, _("Count") ); + m_gridListItems->SetColLabelValue( 3, _("Comment") ); + m_gridListItems->SetColLabelValue( 4, _("Text") ); + m_gridListItems->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + + // Rows + m_gridListItems->EnableDragRowSize( true ); + m_gridListItems->SetRowLabelSize( 40 ); + m_gridListItems->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + + // Label Appearance + + // Cell Defaults + m_gridListItems->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bSizerListMain->Add( m_gridListItems, 1, wxALL|wxEXPAND, 5 ); + + + m_panelList->SetSizer( bSizerListMain ); + m_panelList->Layout(); + bSizerListMain->Fit( m_panelList ); + bSizerMain->Add( m_panelList, 1, wxEXPAND, 5 ); + + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); + + bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + m_gridListItems->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_INSPECTOR_BASE::onCellClicked ), NULL, this ); +} + +DIALOG_INSPECTOR_BASE::~DIALOG_INSPECTOR_BASE() +{ + // Disconnect Events + m_gridListItems->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_INSPECTOR_BASE::onCellClicked ), NULL, this ); + +} diff --git a/pagelayout_editor/dialogs/dialog_design_inspector_base.fbp b/pagelayout_editor/dialogs/dialog_design_inspector_base.fbp new file mode 100644 index 0000000000..a7fd6e63b6 --- /dev/null +++ b/pagelayout_editor/dialogs/dialog_design_inspector_base.fbp @@ -0,0 +1,234 @@ + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_design_inspector_base + 1000 + none + + 1 + design_inspector + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_INSPECTOR_BASE + + 423,293 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h; forward_declare + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelList + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + bSizerListMain + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTER + 30 + "Type" "Name" "Count" "Comment" "Text" + wxALIGN_CENTER + 5 + + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridListItems + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTER + 40 + + wxALIGN_CENTER + + 1 + 1 + + ; ; forward_declare + 0 + + + + + onCellClicked + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + m_sdbSizer + protected + + + + + + diff --git a/pagelayout_editor/dialogs/dialog_design_inspector_base.h b/pagelayout_editor/dialogs/dialog_design_inspector_base.h new file mode 100644 index 0000000000..d98a438517 --- /dev/null +++ b/pagelayout_editor/dialogs/dialog_design_inspector_base.h @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 1 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_INSPECTOR_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_INSPECTOR_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxPanel* m_panelList; + wxGrid* m_gridListItems; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void onCellClicked( wxGridEvent& event ) { event.Skip(); } + + + public: + + DIALOG_INSPECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 423,293 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_INSPECTOR_BASE(); + +}; + diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index be64cf6f92..d10e1d6e0d 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -137,6 +137,12 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() viewMenu->Resolve(); + //-- Inspector menu ------------------------------------------------------- + // + CONDITIONAL_MENU* inspectorMenu = new CONDITIONAL_MENU( false, selTool ); + inspectorMenu->AddItem( PL_ACTIONS::showInspector, SELECTION_CONDITIONS::ShowAlways ); + inspectorMenu->Resolve(); + //-- Place menu ------------------------------------------------------- // CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool ); @@ -168,6 +174,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( inspectorMenu, _( "&Inspect" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); AddStandardHelpMenu( menuBar ); diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index 72c0580958..30f963d885 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -70,6 +70,11 @@ public: PROPERTIES_FRAME* GetPropertiesFrame() { return m_propertiesPagelayout; } + /** + * Show the dialog displaying the list of WS_DATA_ITEM items in the page layout + */ + void ShowDesignInspector(); + bool OpenProjectFiles( const std::vector& aFileSet, int aCtl ) override; /** diff --git a/pagelayout_editor/toolbars_pl_editor.cpp b/pagelayout_editor/toolbars_pl_editor.cpp index e34a28a726..a0a472ae26 100644 --- a/pagelayout_editor/toolbars_pl_editor.cpp +++ b/pagelayout_editor/toolbars_pl_editor.cpp @@ -57,6 +57,9 @@ void PL_EDITOR_FRAME::ReCreateHToolbar() m_mainToolBar->Add( ACTIONS::zoomFitScreen ); m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE ); + KiScaledSeparator( m_mainToolBar, this ); + m_mainToolBar->Add( PL_ACTIONS::showInspector ); + // Display mode switch KiScaledSeparator( m_mainToolBar, this ); m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString, diff --git a/pagelayout_editor/tools/pl_actions.h b/pagelayout_editor/tools/pl_actions.h index 0ba006e7bc..df55483c9f 100644 --- a/pagelayout_editor/tools/pl_actions.h +++ b/pagelayout_editor/tools/pl_actions.h @@ -77,6 +77,7 @@ public: static TOOL_ACTION deleteItemCursor; static TOOL_ACTION refreshPreview; static TOOL_ACTION toggleBackground; + static TOOL_ACTION showInspector; ///> @copydoc COMMON_ACTIONS::TranslateLegacyId() virtual OPT TranslateLegacyId( int aId ) override { return OPT(); } diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp index 0423d79902..5a05db8e54 100644 --- a/pagelayout_editor/tools/pl_editor_control.cpp +++ b/pagelayout_editor/tools/pl_editor_control.cpp @@ -44,6 +44,11 @@ TOOL_ACTION PL_ACTIONS::toggleBackground( "plEditor.EditorControl.ToggleBackgrou _( "Background White" ), _( "Switch between white and black background" ), palette_xpm ); +TOOL_ACTION PL_ACTIONS::showInspector( "plEditor.EditorControl.ShowInspector", + AS_GLOBAL, 0, "", + _( "Show Design Inspector" ), _( "Show the list of items in page layout" ), + spreadsheet_xpm ); + bool PL_EDITOR_CONTROL::Init() { @@ -146,6 +151,13 @@ int PL_EDITOR_CONTROL::ToggleBackgroundColor( const TOOL_EVENT& aEvent ) } +int PL_EDITOR_CONTROL::ShowInspector( const TOOL_EVENT& aEvent ) +{ + m_frame->ShowDesignInspector(); + return 0; +} + + int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) { PL_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); @@ -192,6 +204,7 @@ void PL_EDITOR_CONTROL::setTransitions() Go( &PL_EDITOR_CONTROL::Quit, ACTIONS::quit.MakeEvent() ); Go( &PL_EDITOR_CONTROL::ToggleBackgroundColor, PL_ACTIONS::toggleBackground.MakeEvent() ); + Go( &PL_EDITOR_CONTROL::ShowInspector, PL_ACTIONS::showInspector.MakeEvent() ); Go( &PL_EDITOR_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent ); Go( &PL_EDITOR_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent ); diff --git a/pagelayout_editor/tools/pl_editor_control.h b/pagelayout_editor/tools/pl_editor_control.h index 22dae925f3..a3ee62f470 100644 --- a/pagelayout_editor/tools/pl_editor_control.h +++ b/pagelayout_editor/tools/pl_editor_control.h @@ -61,6 +61,7 @@ public: int Quit( const TOOL_EVENT& aEvent ); int ToggleBackgroundColor( const TOOL_EVENT& aEvent ); + int ShowInspector( const TOOL_EVENT& aEvent ); /** * Update the message panel *and* the Properties frame, after change