← Back to team overview

kicad-developers team mailing list archive

Re: [feature] Add eeschema plot option: plot fields of values of components

 

Next patch is continuing previous my patch for printing (previous for plotting)

05.12.2015 16:27, Eldar Khayrullin пишет:
Hi.
For Russian documentation of constructor need to plot(to print to paper) schemes without fields of values of components in accordance with GOST (Russian standard) requirements of decoration. Values contain in another document BOM. I have add option for plotting that select visibility of plotting these fields (except power symbols).
I am wanting request to add this feature.
Thanks


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index cc53c2e..829d651 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -151,6 +151,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
 
     m_cursorLevel = 0;
     m_PrintIsMirrored = false;
+
+    m_printFieldValue = true;
 }
 
 
diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp
index 09257bd..cf89a83 100644
--- a/eeschema/dialogs/dialog_print_using_printer.cpp
+++ b/eeschema/dialogs/dialog_print_using_printer.cpp
@@ -146,6 +146,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
     wxASSERT( aParent != NULL );
 
     m_checkReference->SetValue( aParent->GetPrintSheetReference() );
+    m_checkFieldValue->SetValue( aParent->GetPrintFieldValue() );
     m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
     initDialog();
 
@@ -202,6 +203,7 @@ void DIALOG_PRINT_USING_PRINTER::GetPrintOptions()
 
     parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
     parent->SetPrintSheetReference( m_checkReference->IsChecked() );
+    parent->SetPrintFieldValue( m_checkFieldValue->IsChecked() );
 }
 
 
@@ -421,6 +423,8 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
     // Change scale factor and offset to print the whole page.
     bool printReference = m_parent->GetPrintSheetReference();
 
+    panel->SetPrintFieldValue( m_parent->GetPrintFieldValue() );
+
     pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
     FitThisSizeToPaper( pageSizeIU );
     fitRect = GetLogicalPaperRect();
@@ -476,6 +480,8 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
     aScreen->m_StartVisu = tmp_startvisu;
     aScreen->m_DrawOrg   = old_org;
     aScreen->SetZoom( oldZoom );
+
+    panel->SetPrintFieldValue( true );
 }
 
 
diff --git a/eeschema/dialogs/dialog_print_using_printer_base.cpp b/eeschema/dialogs/dialog_print_using_printer_base.cpp
index 6a163b1..2eb1bfd 100644
--- a/eeschema/dialogs/dialog_print_using_printer_base.cpp
+++ b/eeschema/dialogs/dialog_print_using_printer_base.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun  5 2014)
+// C++ code generated with wxFormBuilder (version Nov 29 2015)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO "NOT" EDIT THIS FILE!
@@ -31,6 +31,10 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
 	
 	bleftSizer->Add( m_checkReference, 0, wxALL, 10 );
 	
+	m_checkFieldValue = new wxCheckBox( this, wxID_ANY, _("Print fields of values of components"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_checkFieldValue->SetValue(true); 
+	bleftSizer->Add( m_checkFieldValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
+	
 	m_checkMonochrome = new wxCheckBox( this, wxID_ANY, _("Print in &black and white only"), wxDefaultPosition, wxDefaultSize, 0 );
 	m_checkMonochrome->SetValue(true); 
 	bleftSizer->Add( m_checkMonochrome, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
diff --git a/eeschema/dialogs/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp
index cf785e1..126fb03 100644
--- a/eeschema/dialogs/dialog_print_using_printer_base.fbp
+++ b/eeschema/dialogs/dialog_print_using_printer_base.fbp
@@ -306,6 +306,94 @@
                                 <property name="gripper">0</property>
                                 <property name="hidden">0</property>
                                 <property name="id">wxID_ANY</property>
+                                <property name="label">Print fields of values of components</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_checkFieldValue</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="style"></property>
+                                <property name="subclass"></property>
+                                <property name="toolbar_pane">0</property>
+                                <property name="tooltip"></property>
+                                <property name="validator_data_type"></property>
+                                <property name="validator_style">wxFILTER_NONE</property>
+                                <property name="validator_type">wxDefaultValidator</property>
+                                <property name="validator_variable"></property>
+                                <property name="window_extra_style"></property>
+                                <property name="window_name"></property>
+                                <property name="window_style"></property>
+                                <event name="OnChar"></event>
+                                <event name="OnCheckBox"></event>
+                                <event name="OnEnterWindow"></event>
+                                <event name="OnEraseBackground"></event>
+                                <event name="OnKeyDown"></event>
+                                <event name="OnKeyUp"></event>
+                                <event name="OnKillFocus"></event>
+                                <event name="OnLeaveWindow"></event>
+                                <event name="OnLeftDClick"></event>
+                                <event name="OnLeftDown"></event>
+                                <event name="OnLeftUp"></event>
+                                <event name="OnMiddleDClick"></event>
+                                <event name="OnMiddleDown"></event>
+                                <event name="OnMiddleUp"></event>
+                                <event name="OnMotion"></event>
+                                <event name="OnMouseEvents"></event>
+                                <event name="OnMouseWheel"></event>
+                                <event name="OnPaint"></event>
+                                <event name="OnRightDClick"></event>
+                                <event name="OnRightDown"></event>
+                                <event name="OnRightUp"></event>
+                                <event name="OnSetFocus"></event>
+                                <event name="OnSize"></event>
+                                <event name="OnUpdateUI"></event>
+                            </object>
+                        </object>
+                        <object class="sizeritem" expanded="1">
+                            <property name="border">10</property>
+                            <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
+                            <property name="proportion">0</property>
+                            <object class="wxCheckBox" 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="checked">1</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="label">Print in &amp;black and white only</property>
                                 <property name="max_size"></property>
                                 <property name="maximize_button">0</property>
diff --git a/eeschema/dialogs/dialog_print_using_printer_base.h b/eeschema/dialogs/dialog_print_using_printer_base.h
index 49994cf..68ba8d9 100644
--- a/eeschema/dialogs/dialog_print_using_printer_base.h
+++ b/eeschema/dialogs/dialog_print_using_printer_base.h
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun  5 2014)
+// C++ code generated with wxFormBuilder (version Nov 29 2015)
 // http://www.wxformbuilder.org/
 //
 // PLEASE DO "NOT" EDIT THIS FILE!
@@ -37,6 +37,7 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
 	protected:
 		wxStaticText* m_staticText1;
 		wxCheckBox* m_checkReference;
+		wxCheckBox* m_checkFieldValue;
 		wxCheckBox* m_checkMonochrome;
 		wxButton* m_buttonPageSetup;
 		wxButton* m_buttonPreview;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index f78458c..3cd859b 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -348,8 +348,11 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff
                           GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
                           bool aDrawPinText )
 {
+    bool power = false;
+
     if( PART_SPTR part = m_part.lock() )
     {
+        power = part->IsPower();
         // Draw pin targets if part is being dragged
         bool dragging = aPanel->GetScreen()->GetCurItem() == this && aPanel->IsMouseCaptured();
 
@@ -369,7 +372,11 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff
         field->Draw( aPanel, aDC, aOffset, aDrawMode );
     }
 
-    for( int ii = VALUE; ii < GetFieldCount(); ii++ )
+    int ii = VALUE;
+    if( !power && !aPanel->IsPrintFieldValue() )
+        ii++;
+
+    for( ; ii < GetFieldCount(); ii++ )
     {
         field = GetField( ii );
 
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index 2568576..e44d28d 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -337,6 +337,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
     m_previewSize = wxDefaultSize;
     m_printMonochrome = true;
     m_printSheetReference = true;
+    m_printFieldValue = true;
     SetShowPageLimits( true );
     m_hotkeysDescrList = g_Schematic_Hokeys_Descr;
     m_dlgFindReplace = NULL;
diff --git a/eeschema/schframe.h b/eeschema/schframe.h
index 0db8ea8..2bca681 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -128,6 +128,7 @@ private:
     wxSize                  m_printDialogSize;
     bool                    m_printMonochrome;     ///< Print monochrome instead of grey scale.
     bool                    m_printSheetReference;
+    bool                    m_printFieldValue;
     DIALOG_SCH_FIND*        m_dlgFindReplace;
     wxPoint                 m_findDialogPosition;
     wxSize                  m_findDialogSize;
@@ -664,6 +665,8 @@ public:
     void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
     bool GetPrintSheetReference() { return m_printSheetReference; }
     void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
+    bool GetPrintFieldValue() const { return m_printFieldValue; }
+    void SetPrintFieldValue( bool aShow ) { m_printFieldValue = aShow; }
 
     // Plot functions:
 //    void ToPostProcess( wxCommandEvent& event );
diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h
index 8c386f0..ca0b3ab 100644
--- a/include/class_drawpanel.h
+++ b/include/class_drawpanel.h
@@ -116,6 +116,9 @@ private:
     /// >= 0 (or >= n) if a block can start
     int     m_canStartBlock;
 
+    /// Enable print fields of values of components. Used printing of eeschema
+    bool    m_printFieldValue;
+
 public:
 
     EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
@@ -171,6 +174,9 @@ public:
 
     void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; }
 
+    bool IsPrintFieldValue() const { return m_printFieldValue; }
+    void SetPrintFieldValue( bool aPrinted ) { m_printFieldValue = aPrinted; }
+
     /**
      * Function DrawBackGround
      * @param DC = current Device Context

Follow ups

References