Commit 38a5e9af authored by jean-pierre charras's avatar jean-pierre charras

3D viewer: fix Bug #1183581 (pcbnew 3D viewer: recent UI inconsistency )

Pcbnew: fix bug in drag module: connected tracks were not dragged.
worksheet: code cleaning.
parent dc9122c5
......@@ -100,7 +100,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
CreateStatusBar( 5 );
SetStatusWidths( 5, dims );
ReCreateMenuBar();
CreateMenuBar();
ReCreateHToolbar();
// ReCreateAuxiliaryToolbar();
......
......@@ -136,7 +136,7 @@ void EDA_3D_FRAME::ReCreateVToolbar()
}
void EDA_3D_FRAME::ReCreateMenuBar()
void EDA_3D_FRAME::CreateMenuBar()
{
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* fileMenu = new wxMenu;
......@@ -180,15 +180,12 @@ void EDA_3D_FRAME::ReCreateMenuBar()
item = AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS]);
item = AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE]);
item = AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE]);
item = AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
......@@ -196,27 +193,59 @@ void EDA_3D_FRAME::ReCreateMenuBar()
item = AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN]);
item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK]);
item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE]);
item = AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS]);
item = AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO]);
SetMenuBarOptionsState();
SetMenuBar( menuBar );
}
void EDA_3D_FRAME::SetMenuBarOptionsState()
{
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
return;
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_USE_COPPER_THICKNESS );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS]);
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE]);
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE]);
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE]);
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN]);
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK]);
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE]);
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS]);
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Check(g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO]);
}
void EDA_3D_FRAME::SetToolbars()
{
......
......@@ -118,7 +118,9 @@ private:
void Install_3D_ViewOptionDialog( wxCommandEvent& event );
// initialisation
void ReCreateMenuBar();
void CreateMenuBar();
void SetMenuBarOptionsState(); // Set the state of toggle menus according
// to the current display options
void ReCreateHToolbar();
void ReCreateVToolbar();
void SetToolbars();
......
#include "dialog_3D_view_option_base.h"
#include <3d_viewer.h>
#include <info3d_visu.h>
class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE
{
public:
DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent );
private:
EDA_3D_FRAME* m_parent;
void initDialog();
// Event functions:
void OnShowAllClick( wxCommandEvent& event );
void OnShowNoneClick( wxCommandEvent& event );
void OnOKClick( wxCommandEvent& event );
};
void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
{
DIALOG_3D_VIEW_OPTIONS dlg( this );
dlg.ShowModal();
}
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
:DIALOG_3D_VIEW_OPTIONS_BASE( parent )
{
m_parent = parent;
initDialog();
Layout();
GetSizer()->SetSizeHints(this);
Centre();
}
void DIALOG_3D_VIEW_OPTIONS::initDialog()
{
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
m_bitmapSilkscreen->SetBitmap( KiBitmap( add_text_xpm ) );
m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
m_bitmapComments->SetBitmap( KiBitmap( edit_sheet_xpm ) );
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
// Check/uncheck checkboxes
m_checkBoxCuThickness->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] );
m_checkBox3Dshapes->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] );
m_checkBoxAreas->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] );
m_checkBoxSilkscreen->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] );
m_checkBoxSolderMask->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] );
m_checkBoxSolderpaste->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] );
m_checkBoxAdhesive->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] );
m_checkBoxComments->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] );
m_checkBoxECO->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
{
bool state = true;
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state );
m_checkBoxAreas->SetValue( state );
m_checkBoxSilkscreen->SetValue( state );
m_checkBoxSolderMask->SetValue( state );
m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
m_checkBoxComments->SetValue( state );
m_checkBoxECO->SetValue( state );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
{
bool state = false;
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state );
m_checkBoxAreas->SetValue( state );
m_checkBoxSilkscreen->SetValue( state );
m_checkBoxSolderMask->SetValue( state );
m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
m_checkBoxComments->SetValue( state );
m_checkBoxECO->SetValue( state );
}
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
{
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] =
m_checkBoxCuThickness->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] =
m_checkBox3Dshapes->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] =
m_checkBoxAreas->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] =
m_checkBoxSilkscreen->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] =
m_checkBoxSolderMask->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] =
m_checkBoxSolderpaste->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] =
m_checkBoxAdhesive->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] =
m_checkBoxComments->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] =
m_checkBoxECO->GetValue();
EndModal( wxID_OK );
m_parent->NewDisplay();
}
#include "dialog_3D_view_option_base.h"
#include <3d_viewer.h>
#include <info3d_visu.h>
class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE
{
public:
DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent );
private:
EDA_3D_FRAME* m_parent;
void initDialog();
// Event functions:
void OnShowAllClick( wxCommandEvent& event );
void OnShowNoneClick( wxCommandEvent& event );
void OnOKClick( wxCommandEvent& event );
};
void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
{
DIALOG_3D_VIEW_OPTIONS dlg( this );
if( dlg.ShowModal() == wxID_OK )
{
SetMenuBarOptionsState();
NewDisplay();
}
}
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
:DIALOG_3D_VIEW_OPTIONS_BASE( parent )
{
m_parent = parent;
initDialog();
Layout();
GetSizer()->SetSizeHints(this);
Centre();
}
void DIALOG_3D_VIEW_OPTIONS::initDialog()
{
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
m_bitmapSilkscreen->SetBitmap( KiBitmap( add_text_xpm ) );
m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
m_bitmapComments->SetBitmap( KiBitmap( edit_sheet_xpm ) );
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
// Check/uncheck checkboxes
m_checkBoxCuThickness->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] );
m_checkBox3Dshapes->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] );
m_checkBoxAreas->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] );
m_checkBoxSilkscreen->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] );
m_checkBoxSolderMask->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] );
m_checkBoxSolderpaste->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] );
m_checkBoxAdhesive->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] );
m_checkBoxComments->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] );
m_checkBoxECO->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
{
bool state = true;
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state );
m_checkBoxAreas->SetValue( state );
m_checkBoxSilkscreen->SetValue( state );
m_checkBoxSolderMask->SetValue( state );
m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
m_checkBoxComments->SetValue( state );
m_checkBoxECO->SetValue( state );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
{
bool state = false;
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state );
m_checkBoxAreas->SetValue( state );
m_checkBoxSilkscreen->SetValue( state );
m_checkBoxSolderMask->SetValue( state );
m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
m_checkBoxComments->SetValue( state );
m_checkBoxECO->SetValue( state );
}
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
{
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] =
m_checkBoxCuThickness->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] =
m_checkBox3Dshapes->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] =
m_checkBoxAreas->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] =
m_checkBoxSilkscreen->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] =
m_checkBoxSolderMask->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] =
m_checkBoxSolderpaste->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] =
m_checkBoxAdhesive->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] =
m_checkBoxComments->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] =
m_checkBoxECO->GetValue();
EndModal( wxID_OK );
}
......@@ -616,23 +616,27 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
// Get logical page size and margins.
PAGE_INFO pageDUMMY;
pageDUMMY.SetWidthMils( clamped_layout_size.x );
pageDUMMY.SetHeightMils( clamped_layout_size.y );
// Get page type
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
wxString paperType = m_pageFmt[idx].Left( m_pageFmt[idx].Index( wxT( " " ) ) );
wxString pageFmtName = m_pageFmt[idx].BeforeFirst( ' ' );
bool portrait = clamped_layout_size.x < clamped_layout_size.y;
pageDUMMY.SetType( pageFmtName, portrait );
if( m_customFmt )
{
pageDUMMY.SetWidthMils( clamped_layout_size.x );
pageDUMMY.SetHeightMils( clamped_layout_size.y );
}
// Draw layout preview.
wxString emptyString;
GRResetPenAndBrush( &memDC );
DrawPageLayout( &memDC, NULL, pageDUMMY,
paperType, emptyString, emptyString,
emptyString, emptyString,
m_tb, m_Screen->m_NumberOfScreens,
m_Screen->m_ScreenNumber, 1, appScale, DARKGRAY, RED );
......@@ -684,7 +688,6 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
&PAGE_INFO::C,
&PAGE_INFO::D,
&PAGE_INFO::E,
//&PAGE_INFO::GERBER,
&PAGE_INFO::USLetter,
&PAGE_INFO::USLegal,
&PAGE_INFO::USLedger,
......
......@@ -35,10 +35,8 @@
#include <fctsys.h>
#include <drawtxt.h>
#include <appl_wxstruct.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h>
#define GRID_REF_W Mm2mils( 1.8 ) // height of the band reference grid
......@@ -72,26 +70,6 @@
#define BLOCK_COMMENT3_Y (TEXTSIZE * 17)
#define BLOCK_COMMENT4_Y (TEXTSIZE * 19)
/*
* Basic texts in Ki_WorkSheetData struct use format "C" type to
* identify the user text which should be shown, at runtime.
* Currently formats are % and a letter , or 2 letters
*
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %Y = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path or sheet full name
* %T = title
* Other fields like Developer, Verifier, Approver could use %Cx
* and are seen as comments for format
*/
// Text attributes set in m_Flags (ORed bits)
#define USE_BOLD 1 // has meaning for texts
......@@ -321,15 +299,6 @@ Ki_WorkSheetData WS_Segm7 =
#include <worksheet_shape_builder.h>
// Helper function which returns the text corresponding to the aIdent identifier
static wxString BuildFullText( const wxString& aTextbase,
const TITLE_BLOCK& aTitleBlock,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
int aSheetCount, int aSheetNumber );
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const wxString& aPaperFormat,
const wxString& aFileName,
......@@ -342,6 +311,12 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
FRMREF_TXTSIZE * m_milsToIu );
wxString msg;
m_titleBlock = &aTitleBlock,
m_paperFormat = &aPaperFormat,
m_fileName = &aFileName,
m_sheetFullName = &aSheetPathHumanReadable;
// Left top corner position
wxPoint lt_corner;
lt_corner.x = m_LTmargin.x;
......@@ -460,8 +435,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
msg.Empty();
if( WsItem->m_Type == WS_TEXT && WsItem->m_TextBase )
msg = BuildFullText( WsItem->m_TextBase, aTitleBlock, aPaperFormat, aFileName,
aSheetPathHumanReadable, m_sheetCount, m_sheetNumber );
msg = BuildFullText( WsItem->m_TextBase );
switch( WsItem->m_Type )
{
......@@ -508,123 +482,3 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
}
}
}
// returns the full text corresponding to the aTextbase,
// after replacing format symbols by the corresponding value
wxString BuildFullText( const wxString& aTextbase,
const TITLE_BLOCK& aTitleBlock,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
int aSheetCount, int aSheetNumber )
{
wxString msg;
/* Known formats
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %Y = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path (sheet full name)
* %T = title
*/
for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
{
if( aTextbase[ii] != '%' )
{
msg << aTextbase[ii];
continue;
}
ii++;
if( ii >= aTextbase.Len() )
break;
wxChar format = aTextbase[ii];
switch( format )
{
case '%':
msg += '%';
break;
case 'D':
msg += aTitleBlock.GetDate();
break;
case 'R':
msg += aTitleBlock.GetRevision();
break;
case 'K':
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
break;
case 'Z':
msg += aPaperFormat;
break;
case 'S':
msg << aSheetNumber;
break;
case 'N':
msg << aSheetCount;
break;
case 'F':
{
wxFileName fn( aFileName );
msg += fn.GetFullName();
}
break;
case 'P':
msg += aSheetPathHumanReadable;
break;
case 'Y':
msg = aTitleBlock.GetCompany();
break;
case 'T':
msg += aTitleBlock.GetTitle();
break;
case 'C':
format = aTextbase[++ii];
switch( format )
{
case '1':
msg += aTitleBlock.GetComment1();
break;
case '2':
msg += aTitleBlock.GetComment2();
break;
case '3':
msg += aTitleBlock.GetComment3();
break;
case '4':
msg += aTitleBlock.GetComment4();
break;
default:
break;
}
default:
break;
}
}
return msg;
}
......@@ -31,6 +31,7 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <gr_basic.h>
#include <common.h>
#include <class_drawpanel.h>
......@@ -39,12 +40,12 @@
#include <wxstruct.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h>
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
const PAGE_INFO& aPageInfo,
const wxString& aPaperFormat,
const wxString &aFullSheetName,
const wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
......@@ -67,7 +68,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
drawList.SetSheetCount( aSheetCount );
drawList.BuildWorkSheetGraphicList(
aPaperFormat, aFullSheetName, aFileName,
aPageInfo.GetType(), aFullSheetName, aFileName,
aTitleBlock, aLineColor, aTextColor );
// Draw item list
......@@ -139,12 +140,11 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
wxString paper = pageInfo.GetType();
TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED;
DrawPageLayout( aDC, m_canvas, pageInfo,
paper, aFilename, GetScreenDesc(), t_block,
aFilename, GetScreenDesc(), t_block,
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
aLineWidth, aScalar, color, color );
}
......@@ -205,6 +205,121 @@ wxString EDA_DRAW_FRAME::GetScreenDesc()
return msg;
}
// returns the full text corresponding to the aTextbase,
// after replacing format symbols by the corresponding value
wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
{
wxString msg;
/* Known formats
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %Y = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path (sheet full name)
* %T = title
*/
for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
{
if( aTextbase[ii] != '%' )
{
msg << aTextbase[ii];
continue;
}
ii++;
if( ii >= aTextbase.Len() )
break;
wxChar format = aTextbase[ii];
switch( format )
{
case '%':
msg += '%';
break;
case 'D':
msg += m_titleBlock->GetDate();
break;
case 'R':
msg += m_titleBlock->GetRevision();
break;
case 'K':
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
break;
case 'Z':
msg += *m_paperFormat;
break;
case 'S':
msg << m_sheetNumber;
break;
case 'N':
msg << m_sheetCount;
break;
case 'F':
{
wxFileName fn( *m_fileName );
msg += fn.GetFullName();
}
break;
case 'P':
msg += *m_sheetFullName;
break;
case 'Y':
msg = m_titleBlock->GetCompany();
break;
case 'T':
msg += m_titleBlock->GetTitle();
break;
case 'C':
format = aTextbase[++ii];
switch( format )
{
case '1':
msg += m_titleBlock->GetComment1();
break;
case '2':
msg += m_titleBlock->GetComment2();
break;
case '3':
msg += m_titleBlock->GetComment3();
break;
case '4':
msg += m_titleBlock->GetComment4();
break;
default:
break;
}
default:
break;
}
}
return msg;
}
void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR )
......
......@@ -31,8 +31,7 @@ public:
* @param aDC The device context.
* @param aCanvas The EDA_DRAW_PANEL to draw into, or NULL if the page
* layout is not drawn into the main panel.
* @param aPageInfo for margins and page siez (in mils).
* @param aPaperFormat The paper size type, for basic inscriptions.
* @param aPageInfo for margins and page size (in mils).
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for basic inscriptions.
......@@ -50,7 +49,6 @@ public:
*/
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
const PAGE_INFO& aPageInfo,
const wxString& aPaperFormat,
const wxString &aFullSheetName,
const wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
......
......@@ -137,6 +137,11 @@ class WS_DRAW_ITEM_LIST
int m_sheetNumber; // the value of the sheet number, for basic inscriptions
int m_sheetCount; // the value of the number of sheets, in schematic
// for basic inscriptions, in schematic
const TITLE_BLOCK* m_titleBlock; // for basic inscriptions
const wxString* m_paperFormat; // for basic inscriptions
const wxString* m_fileName; // for basic inscriptions
const wxString* m_sheetFullName; // for basic inscriptions
public:
WS_DRAW_ITEM_LIST()
......@@ -146,6 +151,10 @@ public:
m_penSize = 1;
m_sheetNumber = 1;
m_sheetCount = 1;
m_titleBlock = NULL;
m_paperFormat = NULL;
m_fileName = NULL;
m_sheetFullName = NULL;
}
~WS_DRAW_ITEM_LIST()
......@@ -256,6 +265,35 @@ public:
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor );
/**
* Function BuildFullText
* returns the full text corresponding to the aTextbase,
* after replacing format symbols by the corresponding value
*
* Basic texts in Ki_WorkSheetData struct use format notation
* like "Title %T" to identify at run time the full text
* to display.
* Currently format identifier is % followed by a letter or 2 letters
*
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter)
* %Y = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path or sheet full name
* %T = title
* Other fields like Developer, Verifier, Approver could use %Cx
* and are seen as comments for format
*
* @param aTextbase = the text with format symbols
* @return the text, after replacing the format symbols by the actual value
*/
wxString BuildFullText( const wxString& aTextbase );
};
......
......@@ -227,13 +227,13 @@ void DRAG_LIST::fillList( CONNECTIONS& aConnections )
if( pad->HitTest( track->GetStart() ) )
{
track->start = pad;
track->SetState( START_ON_PAD, false );
track->SetState( START_ON_PAD, true );
}
if( pad->HitTest( track->GetEnd() ) )
{
track->end = pad;
track->SetState( END_ON_PAD, false );
track->SetState( END_ON_PAD, true );
}
DRAG_SEGM_PICKER wrapper( track );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment