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, ...@@ -100,7 +100,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
CreateStatusBar( 5 ); CreateStatusBar( 5 );
SetStatusWidths( 5, dims ); SetStatusWidths( 5, dims );
ReCreateMenuBar(); CreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
// ReCreateAuxiliaryToolbar(); // ReCreateAuxiliaryToolbar();
......
...@@ -136,7 +136,7 @@ void EDA_3D_FRAME::ReCreateVToolbar() ...@@ -136,7 +136,7 @@ void EDA_3D_FRAME::ReCreateVToolbar()
} }
void EDA_3D_FRAME::ReCreateMenuBar() void EDA_3D_FRAME::CreateMenuBar()
{ {
wxMenuBar* menuBar = new wxMenuBar; wxMenuBar* menuBar = new wxMenuBar;
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
...@@ -180,15 +180,12 @@ void EDA_3D_FRAME::ReCreateMenuBar() ...@@ -180,15 +180,12 @@ void EDA_3D_FRAME::ReCreateMenuBar()
item = AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS, item = AddMenuItem( prefsMenu, ID_MENU3D_USE_COPPER_THICKNESS,
_( "Show Copper Thickness" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D F&ootprints" ), KiBitmap( shape_3d_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_ADHESIVE_ONOFF,
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK ); _( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
...@@ -196,27 +193,59 @@ void EDA_3D_FRAME::ReCreateMenuBar() ...@@ -196,27 +193,59 @@ void EDA_3D_FRAME::ReCreateMenuBar()
item = AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF, item = AddMenuItem( prefsMenu, ID_MENU3D_SILKSCREEN_ONOFF,
_( "Show &Silkscreen Layer" ), KiBitmap( add_text_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK ); _( "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, item = AddMenuItem( prefsMenu, ID_MENU3D_ECO_ONOFF,
_( "Show &Eco Layers" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK ); _( "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 ); 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() void EDA_3D_FRAME::SetToolbars()
{ {
......
...@@ -118,7 +118,9 @@ private: ...@@ -118,7 +118,9 @@ private:
void Install_3D_ViewOptionDialog( wxCommandEvent& event ); void Install_3D_ViewOptionDialog( wxCommandEvent& event );
// initialisation // initialisation
void ReCreateMenuBar(); void CreateMenuBar();
void SetMenuBarOptionsState(); // Set the state of toggle menus according
// to the current display options
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void SetToolbars(); void SetToolbars();
......
#include "dialog_3D_view_option_base.h" #include "dialog_3D_view_option_base.h"
#include <3d_viewer.h> #include <3d_viewer.h>
#include <info3d_visu.h> #include <info3d_visu.h>
class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE class DIALOG_3D_VIEW_OPTIONS : public DIALOG_3D_VIEW_OPTIONS_BASE
{ {
public: public:
DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent ); DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent );
private: private:
EDA_3D_FRAME* m_parent; EDA_3D_FRAME* m_parent;
void initDialog(); void initDialog();
// Event functions: // Event functions:
void OnShowAllClick( wxCommandEvent& event ); void OnShowAllClick( wxCommandEvent& event );
void OnShowNoneClick( wxCommandEvent& event ); void OnShowNoneClick( wxCommandEvent& event );
void OnOKClick( wxCommandEvent& event ); void OnOKClick( wxCommandEvent& event );
}; };
void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event ) void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
{ {
DIALOG_3D_VIEW_OPTIONS dlg( this ); DIALOG_3D_VIEW_OPTIONS dlg( this );
dlg.ShowModal(); 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;
DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
initDialog(); :DIALOG_3D_VIEW_OPTIONS_BASE( parent )
{
Layout(); m_parent = parent;
GetSizer()->SetSizeHints(this);
Centre(); initDialog();
}
Layout();
void DIALOG_3D_VIEW_OPTIONS::initDialog() GetSizer()->SetSizeHints(this);
{ Centre();
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) ); }
m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) ); void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapSilkscreen->SetBitmap( KiBitmap( add_text_xpm ) ); {
m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) ); m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) ); m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) ); m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
m_bitmapComments->SetBitmap( KiBitmap( edit_sheet_xpm ) ); m_bitmapSilkscreen->SetBitmap( KiBitmap( add_text_xpm ) );
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) ); m_bitmapSolderMask->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
m_bitmapSolderPaste->SetBitmap( KiBitmap( pads_mask_layers_xpm ) );
// Check/uncheck checkboxes m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
m_checkBoxCuThickness->SetValue( m_bitmapComments->SetBitmap( KiBitmap( edit_sheet_xpm ) );
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] ); m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
m_checkBox3Dshapes->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] ); // Check/uncheck checkboxes
m_checkBoxAreas->SetValue( m_checkBoxCuThickness->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] );
m_checkBoxSilkscreen->SetValue( m_checkBox3Dshapes->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] );
m_checkBoxSolderMask->SetValue( m_checkBoxAreas->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] );
m_checkBoxSolderpaste->SetValue( m_checkBoxSilkscreen->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] );
m_checkBoxAdhesive->SetValue( m_checkBoxSolderMask->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] );
m_checkBoxComments->SetValue( m_checkBoxSolderpaste->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] ); g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] );
m_checkBoxECO->SetValue( m_checkBoxAdhesive->SetValue(
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] ); 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] );
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event ) m_checkBoxECO->SetValue(
{ g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] );
bool state = true; }
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state ); void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
m_checkBoxAreas->SetValue( state ); {
m_checkBoxSilkscreen->SetValue( state ); bool state = true;
m_checkBoxSolderMask->SetValue( state ); m_checkBoxCuThickness->SetValue( state );
m_checkBoxSolderpaste->SetValue( state ); m_checkBox3Dshapes->SetValue( state );
m_checkBoxAdhesive->SetValue( state ); m_checkBoxAreas->SetValue( state );
m_checkBoxComments->SetValue( state ); m_checkBoxSilkscreen->SetValue( state );
m_checkBoxECO->SetValue( state ); m_checkBoxSolderMask->SetValue( state );
} m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event ) m_checkBoxComments->SetValue( state );
{ m_checkBoxECO->SetValue( state );
bool state = false; }
m_checkBoxCuThickness->SetValue( state );
m_checkBox3Dshapes->SetValue( state ); void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
m_checkBoxAreas->SetValue( state ); {
m_checkBoxSilkscreen->SetValue( state ); bool state = false;
m_checkBoxSolderMask->SetValue( state ); m_checkBoxCuThickness->SetValue( state );
m_checkBoxSolderpaste->SetValue( state ); m_checkBox3Dshapes->SetValue( state );
m_checkBoxAdhesive->SetValue( state ); m_checkBoxAreas->SetValue( state );
m_checkBoxComments->SetValue( state ); m_checkBoxSilkscreen->SetValue( state );
m_checkBoxECO->SetValue( state ); m_checkBoxSolderMask->SetValue( state );
} m_checkBoxSolderpaste->SetValue( state );
m_checkBoxAdhesive->SetValue( state );
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event ) m_checkBoxComments->SetValue( state );
{ m_checkBoxECO->SetValue( state );
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] = void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
m_checkBox3Dshapes->GetValue(); {
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_USE_COPPER_THICKNESS] =
m_checkBoxAreas->GetValue(); m_checkBoxCuThickness->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_MODULE] =
m_checkBoxSilkscreen->GetValue(); m_checkBox3Dshapes->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ZONE] =
m_checkBoxSolderMask->GetValue(); m_checkBoxAreas->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SILKSCREEN] =
m_checkBoxSolderpaste->GetValue(); m_checkBoxSilkscreen->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERMASK] =
m_checkBoxAdhesive->GetValue(); m_checkBoxSolderMask->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_SOLDERPASTE] =
m_checkBoxComments->GetValue(); m_checkBoxSolderpaste->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ECO] = g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_ADHESIVE] =
m_checkBoxECO->GetValue(); m_checkBoxAdhesive->GetValue();
g_Parm_3D_Visu.m_DrawFlags[g_Parm_3D_Visu.FL_COMMENTS] =
EndModal( wxID_OK ); m_checkBoxComments->GetValue();
m_parent->NewDisplay(); 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() ...@@ -616,23 +616,27 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
// Get logical page size and margins. // Get logical page size and margins.
PAGE_INFO pageDUMMY; PAGE_INFO pageDUMMY;
pageDUMMY.SetWidthMils( clamped_layout_size.x );
pageDUMMY.SetHeightMils( clamped_layout_size.y );
// Get page type // Get page type
int idx = m_paperSizeComboBox->GetSelection(); int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 ) if( idx < 0 )
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. // Draw layout preview.
wxString emptyString; wxString emptyString;
GRResetPenAndBrush( &memDC ); GRResetPenAndBrush( &memDC );
DrawPageLayout( &memDC, NULL, pageDUMMY, DrawPageLayout( &memDC, NULL, pageDUMMY,
paperType, emptyString, emptyString, emptyString, emptyString,
m_tb, m_Screen->m_NumberOfScreens, m_tb, m_Screen->m_NumberOfScreens,
m_Screen->m_ScreenNumber, 1, appScale, DARKGRAY, RED ); m_Screen->m_ScreenNumber, 1, appScale, DARKGRAY, RED );
...@@ -684,7 +688,6 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() ...@@ -684,7 +688,6 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
&PAGE_INFO::C, &PAGE_INFO::C,
&PAGE_INFO::D, &PAGE_INFO::D,
&PAGE_INFO::E, &PAGE_INFO::E,
//&PAGE_INFO::GERBER,
&PAGE_INFO::USLetter, &PAGE_INFO::USLetter,
&PAGE_INFO::USLegal, &PAGE_INFO::USLegal,
&PAGE_INFO::USLedger, &PAGE_INFO::USLedger,
......
...@@ -35,10 +35,8 @@ ...@@ -35,10 +35,8 @@
#include <fctsys.h> #include <fctsys.h>
#include <drawtxt.h> #include <drawtxt.h>
#include <appl_wxstruct.h>
#include <worksheet.h> #include <worksheet.h>
#include <class_title_block.h> #include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h> #include <worksheet_shape_builder.h>
#define GRID_REF_W Mm2mils( 1.8 ) // height of the band reference grid #define GRID_REF_W Mm2mils( 1.8 ) // height of the band reference grid
...@@ -72,26 +70,6 @@ ...@@ -72,26 +70,6 @@
#define BLOCK_COMMENT3_Y (TEXTSIZE * 17) #define BLOCK_COMMENT3_Y (TEXTSIZE * 17)
#define BLOCK_COMMENT4_Y (TEXTSIZE * 19) #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) // Text attributes set in m_Flags (ORed bits)
#define USE_BOLD 1 // has meaning for texts #define USE_BOLD 1 // has meaning for texts
...@@ -321,15 +299,6 @@ Ki_WorkSheetData WS_Segm7 = ...@@ -321,15 +299,6 @@ Ki_WorkSheetData WS_Segm7 =
#include <worksheet_shape_builder.h> #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( void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
const wxString& aPaperFormat, const wxString& aPaperFormat,
const wxString& aFileName, const wxString& aFileName,
...@@ -342,6 +311,12 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -342,6 +311,12 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
FRMREF_TXTSIZE * m_milsToIu ); FRMREF_TXTSIZE * m_milsToIu );
wxString msg; wxString msg;
m_titleBlock = &aTitleBlock,
m_paperFormat = &aPaperFormat,
m_fileName = &aFileName,
m_sheetFullName = &aSheetPathHumanReadable;
// Left top corner position // Left top corner position
wxPoint lt_corner; wxPoint lt_corner;
lt_corner.x = m_LTmargin.x; lt_corner.x = m_LTmargin.x;
...@@ -460,8 +435,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -460,8 +435,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
msg.Empty(); msg.Empty();
if( WsItem->m_Type == WS_TEXT && WsItem->m_TextBase ) if( WsItem->m_Type == WS_TEXT && WsItem->m_TextBase )
msg = BuildFullText( WsItem->m_TextBase, aTitleBlock, aPaperFormat, aFileName, msg = BuildFullText( WsItem->m_TextBase );
aSheetPathHumanReadable, m_sheetCount, m_sheetNumber );
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
...@@ -508,123 +482,3 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -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 @@ ...@@ -31,6 +31,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <common.h> #include <common.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
...@@ -39,12 +40,12 @@ ...@@ -39,12 +40,12 @@
#include <wxstruct.h> #include <wxstruct.h>
#include <worksheet.h> #include <worksheet.h>
#include <class_title_block.h> #include <class_title_block.h>
#include <build_version.h>
#include <worksheet_shape_builder.h> #include <worksheet_shape_builder.h>
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
const wxString& aPaperFormat,
const wxString &aFullSheetName, const wxString &aFullSheetName,
const wxString& aFileName, const wxString& aFileName,
TITLE_BLOCK& aTitleBlock, TITLE_BLOCK& aTitleBlock,
...@@ -67,7 +68,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, ...@@ -67,7 +68,7 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
drawList.SetSheetCount( aSheetCount ); drawList.SetSheetCount( aSheetCount );
drawList.BuildWorkSheetGraphicList( drawList.BuildWorkSheetGraphicList(
aPaperFormat, aFullSheetName, aFileName, aPageInfo.GetType(), aFullSheetName, aFileName,
aTitleBlock, aLineColor, aTextColor ); aTitleBlock, aLineColor, aTextColor );
// Draw item list // Draw item list
...@@ -139,12 +140,11 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi ...@@ -139,12 +140,11 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY ); g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
} }
wxString paper = pageInfo.GetType();
TITLE_BLOCK t_block = GetTitleBlock(); TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED; EDA_COLOR_T color = RED;
DrawPageLayout( aDC, m_canvas, pageInfo, DrawPageLayout( aDC, m_canvas, pageInfo,
paper, aFilename, GetScreenDesc(), t_block, aFilename, GetScreenDesc(), t_block,
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
aLineWidth, aScalar, color, color ); aLineWidth, aScalar, color, color );
} }
...@@ -205,6 +205,121 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() ...@@ -205,6 +205,121 @@ wxString EDA_DRAW_FRAME::GetScreenDesc()
return msg; 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 void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR ) throw( IO_ERROR )
......
...@@ -31,8 +31,7 @@ public: ...@@ -31,8 +31,7 @@ public:
* @param aDC The device context. * @param aDC The device context.
* @param aCanvas The EDA_DRAW_PANEL to draw into, or NULL if the page * @param aCanvas The EDA_DRAW_PANEL to draw into, or NULL if the page
* layout is not drawn into the main panel. * layout is not drawn into the main panel.
* @param aPageInfo for margins and page siez (in mils). * @param aPageInfo for margins and page size (in mils).
* @param aPaperFormat The paper size type, for basic inscriptions.
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions. * @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions. * @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for basic inscriptions. * @param aTitleBlock The sheet title block, for basic inscriptions.
...@@ -50,7 +49,6 @@ public: ...@@ -50,7 +49,6 @@ public:
*/ */
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
const wxString& aPaperFormat,
const wxString &aFullSheetName, const wxString &aFullSheetName,
const wxString& aFileName, const wxString& aFileName,
TITLE_BLOCK& aTitleBlock, TITLE_BLOCK& aTitleBlock,
......
...@@ -137,6 +137,11 @@ class WS_DRAW_ITEM_LIST ...@@ -137,6 +137,11 @@ class WS_DRAW_ITEM_LIST
int m_sheetNumber; // the value of the sheet number, for basic inscriptions int m_sheetNumber; // the value of the sheet number, for basic inscriptions
int m_sheetCount; // the value of the number of sheets, in schematic int m_sheetCount; // the value of the number of sheets, in schematic
// for basic inscriptions, 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: public:
WS_DRAW_ITEM_LIST() WS_DRAW_ITEM_LIST()
...@@ -146,6 +151,10 @@ public: ...@@ -146,6 +151,10 @@ public:
m_penSize = 1; m_penSize = 1;
m_sheetNumber = 1; m_sheetNumber = 1;
m_sheetCount = 1; m_sheetCount = 1;
m_titleBlock = NULL;
m_paperFormat = NULL;
m_fileName = NULL;
m_sheetFullName = NULL;
} }
~WS_DRAW_ITEM_LIST() ~WS_DRAW_ITEM_LIST()
...@@ -256,6 +265,35 @@ public: ...@@ -256,6 +265,35 @@ public:
const wxString& aSheetPathHumanReadable, const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock, const TITLE_BLOCK& aTitleBlock,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor ); 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 ) ...@@ -227,13 +227,13 @@ void DRAG_LIST::fillList( CONNECTIONS& aConnections )
if( pad->HitTest( track->GetStart() ) ) if( pad->HitTest( track->GetStart() ) )
{ {
track->start = pad; track->start = pad;
track->SetState( START_ON_PAD, false ); track->SetState( START_ON_PAD, true );
} }
if( pad->HitTest( track->GetEnd() ) ) if( pad->HitTest( track->GetEnd() ) )
{ {
track->end = pad; track->end = pad;
track->SetState( END_ON_PAD, false ); track->SetState( END_ON_PAD, true );
} }
DRAG_SEGM_PICKER wrapper( track ); 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