pl_editor rework: add a design inspector (similar to what was existing previously, but as a dialog)
Wip.
This commit is contained in:
parent
51511eda85
commit
6dc8e96a34
|
@ -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 <author>
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019 <author>
|
||||
* 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file design_inspector.cpp
|
||||
*/
|
||||
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <fctsys.h>
|
||||
#include <ws_draw_item.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <pl_editor_id.h>
|
||||
#include <design_inspector.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pl_actions.h>
|
||||
#include <tools/pl_selection_tool.h>
|
||||
#include <properties_frame.h>
|
||||
|
||||
/* 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( "<default>" );
|
||||
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<WS_DATA_ITEM_TEXT*>( 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<PL_SELECTION_TOOL>();
|
||||
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();
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file design_inspector.h
|
||||
*/
|
||||
|
||||
#ifndef _DESIGN_INSPECTOR_H
|
||||
#define _DESIGN_INSPECTOR_H
|
||||
|
||||
#include <vector>
|
||||
#include <dialog_design_inspector_base.h>
|
||||
#include <pl_editor_frame.h>
|
||||
|
||||
|
||||
/**
|
||||
* 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<WS_DATA_ITEM*> 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 */
|
|
@ -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 );
|
||||
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_design_inspector_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">design_inspector</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_INSPECTOR_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">423,293</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
|
||||
<property name="title"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" 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="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_panelList</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="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">wxTAB_TRAVERSAL</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerListMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGrid" 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="autosize_cols">0</property>
|
||||
<property name="autosize_rows">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="cell_bg"></property>
|
||||
<property name="cell_font"></property>
|
||||
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="cell_text"></property>
|
||||
<property name="cell_vert_alignment">wxALIGN_TOP</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="col_label_size">30</property>
|
||||
<property name="col_label_values">"Type" "Name" "Count" "Comment" "Text"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">5</property>
|
||||
<property name="column_sizes"></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="drag_col_move">0</property>
|
||||
<property name="drag_col_size">1</property>
|
||||
<property name="drag_grid_size">0</property>
|
||||
<property name="drag_row_size">1</property>
|
||||
<property name="editing">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="grid_line_color"></property>
|
||||
<property name="grid_lines">1</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label_bg"></property>
|
||||
<property name="label_font"></property>
|
||||
<property name="label_text"></property>
|
||||
<property name="margin_height">0</property>
|
||||
<property name="margin_width">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_gridListItems</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="row_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_label_size">40</property>
|
||||
<property name="row_label_values"></property>
|
||||
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_sizes"></property>
|
||||
<property name="rows">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></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>
|
||||
<event name="OnGridCellLeftClick">onCellClicked</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">0</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -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 <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// 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();
|
||||
|
||||
};
|
||||
|
|
@ -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 );
|
||||
|
|
|
@ -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<wxString>& aFileSet, int aCtl ) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
|
||||
|
|
|
@ -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<PL_SELECTION_TOOL>();
|
||||
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue