Pl_editor rework: refinements in Design inspector.

This commit is contained in:
jean-pierre charras 2019-06-15 09:58:23 +02:00
parent 2dd82cbca7
commit 96935e0a7e
4 changed files with 49 additions and 15 deletions

View File

@ -301,6 +301,8 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
m_gal->SetLineWidth( aItem->GetThickness() );
m_gal->SetTextAttributes( aItem );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->StrokeText( aItem->GetShownText(), VECTOR2D( 0, 0 ), 0.0 );
m_gal->Restore();
}

View File

@ -167,11 +167,15 @@ public:
};
// 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
enum COL_INDEX
{
COL_BITMAP,
COL_TYPENAME,
COL_REPEAT_NUMBER,
COL_COMMENT,
COL_TEXTSTRING,
COL_COUNT //Sentinel
};
DIALOG_INSPECTOR::DIALOG_INSPECTOR( PL_EDITOR_FRAME* aParent ) :
@ -194,6 +198,7 @@ DIALOG_INSPECTOR::~DIALOG_INSPECTOR()
void DIALOG_INSPECTOR::ReCreateDesignList()
{
wxWindowUpdateLocker dummy( this ); // Avoid flicker when rebuilding the tree
const PAGE_INFO& page_info = m_editorFrame->GetPageLayout().GetPageSettings();
if( m_gridListItems->GetNumberRows() > 1 )
m_gridListItems->DeleteRows( 1, m_gridListItems->GetNumberRows() - 1 );
@ -205,16 +210,18 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
wxFileName fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrFileName() );
if( fn.GetName().IsEmpty() )
SetTitle( "<default>" );
SetTitle( "<default page layout>" );
else
SetTitle( fn.GetName() );
// The first item is the entire page
// The first item is the layout: Display info about the page: fmt, size...
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()->SetCellValue( row, COL_TYPENAME, _( "Layout" ) );
GetGridList()->SetCellValue( row, COL_COMMENT, page_info.GetType() ); // Display page format name
GetGridList()->SetCellValue( row, COL_REPEAT_NUMBER, "-" );
wxSize page_sizeIU = m_editorFrame->GetPageSizeIU();
GetGridList()->SetCellValue( row, COL_TEXTSTRING, wxString::Format( _( "Size: %.1fx%.1fmm" ),
Iu2Millimeter( page_sizeIU.x ), Iu2Millimeter( page_sizeIU.y ) ) );
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
@ -252,7 +259,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
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,
GetGridList()->SetCellValue( row, COL_REPEAT_NUMBER,
wxString::Format( "%d", item->m_RepeatCount ) );
GetGridList()->SetCellValue( row, COL_COMMENT, item->m_Info );
@ -265,6 +272,31 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
m_itemsList.push_back( item );
row++;
}
// Now resize the columns:
int cols_to_resize[] =
{
COL_BITMAP, COL_TYPENAME, COL_REPEAT_NUMBER, COL_COMMENT, COL_TEXTSTRING, COL_COUNT
};
for( int ii = 0; ; ii++ )
{
int col = cols_to_resize[ii];
if( col == COL_COUNT )
break;
if( col == COL_BITMAP )
{
#define BITMAP_SIZE 16
GetGridList()->SetColMinimalWidth( col, BITMAP_SIZE*2 );
GetGridList()->AutoSizeColumn( col, false );
}
else
GetGridList()->AutoSizeColumn( col );
GetGridList()->AutoSizeColLabelSize( col );
}
}

View File

@ -33,8 +33,8 @@ DIALOG_INSPECTOR_BASE::DIALOG_INSPECTOR_BASE( wxWindow* parent, wxWindowID id, c
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( 0, _("-") );
m_gridListItems->SetColLabelValue( 1, _("Type") );
m_gridListItems->SetColLabelValue( 2, _("Count") );
m_gridListItems->SetColLabelValue( 3, _("Comment") );
m_gridListItems->SetColLabelValue( 4, _("Text") );

View File

@ -146,7 +146,7 @@
<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">&quot;Type&quot; &quot;Name&quot; &quot;Count&quot; &quot;Comment&quot; &quot;Text&quot;</property>
<property name="col_label_values">&quot;-&quot; &quot;Type&quot; &quot;Count&quot; &quot;Comment&quot; &quot;Text&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">5</property>
<property name="column_sizes"></property>