Commit 9cc4f5d0 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: add compil option in sch_field.cpp to go back to old behavior for...

Eeschema: add compil option in sch_field.cpp to go back to old behavior for field texts justifications (this option is not activated)
Note: only vertical texts have a modified behavior.
Minor other changes.
parent 148aecf9
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -36,6 +36,19 @@
 * They can be renamed and can appear in reports
 */

/* set USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR to 0 to use
 * a justification relative to the text itself
 * i.e. justification relative to an horizontal text
 * or to 1 to keep the initial Eeschema behavior
 * The initial behavior is:
 *  For vertical texts, exchange the horizontal and the vertical justification
 *  The idea is to keep the justification always left or top for instance,
 *  no matter the text orientation
 *  This is a bit tricky when you want to change a text field justification
 *  when the fiels and the component are both rotated 90.0 degrees
 */
#define USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR 0

#include "fctsys.h"
#include "class_drawpanel.h"
#include "base_struct.h"
@@ -265,7 +278,29 @@ EDA_RECT SCH_FIELD::GetBoundingBox() const
    linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );

    // Calculate the text bounding box:
    EDA_RECT rect = GetTextBox( -1, linewidth );
    EDA_RECT rect;

    // set USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR to 0 to use
    // a justification relative to the text itself
    // i.e. justification relative to an horizontal text
    // or to 1 to keep the initial behavior
#if (USE_TEXT_JUSTIFY_INITIAL_BEHAVIOR == 1 )
    if( m_Orient == TEXT_ORIENT_VERT )
    {
        // For vertical texts, exchange the horizontal and the vertical justification
        // The idea is to keep the justification always left or top for instance,
        // no matter the text orientation
        SCH_FIELD text( *this );    // Make a local copy to swap justifications
                                    // because GetBoundingBox() is const
        int tmp = (int)text.m_VJustify;
        NEGATE( tmp );
        text.m_VJustify  = (EDA_TEXT_VJUSTIFY_T)text.m_HJustify;
        text.m_HJustify = (EDA_TEXT_HJUSTIFY_T)tmp;
        rect = text.GetTextBox( -1, linewidth );
    }
    else
#endif
        rect = GetTextBox( -1, linewidth );

    // Calculate the bounding box position relative to the component:
    wxPoint origin = parentComponent->GetPosition();
+0 −8
Original line number Diff line number Diff line
@@ -233,14 +233,6 @@ public:
                                 bool            aOverwrite,
                                 bool            aDisplayDialog );

    /**
     * Function Archive_Modules
     * Save in the library:
     * All new modules (ie modules not found in this lib) (if NewModulesOnly == true)
     * all modules (if NewModulesOnly == false)
     */
    void Archive_Modules( const wxString& LibName, bool NewModulesOnly );

    MODULE* GetModuleByName();

    /**
+10 −0
Original line number Diff line number Diff line
@@ -784,6 +784,16 @@ public:
     */
    void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );

    /**
     * Function ArchiveModulesOnBoard
     * Save modules in a library:
     * @param aLibName: the full filename of the library to create or modify
     * @param aNewModulesOnly:
     *              true : save modules not already existing in this lib
     *              false: save all modules
     */
    void ArchiveModulesOnBoard( const wxString& aLibName, bool aNewModulesOnly );

    /**
     * Function RecreateBOMFileFromBoard
     * Creates a BOM file from the current loaded board
+0 −9
Original line number Diff line number Diff line
@@ -123,12 +123,6 @@ void C_MICROSTRIP::delta_u_thickness()
 */
void C_MICROSTRIP::compute_single_line()
{
    double w_h, ht_h;
    double Z0_single, er_eff_single;

    ht_h = ht / h;
    w_h  = w / h;

    if( aux_ms == NULL )
        aux_ms = new MICROSTRIP();

@@ -144,9 +138,6 @@ void C_MICROSTRIP::compute_single_line()
    aux_ms->murC = murC;
    aux_ms->microstrip_Z0();
    aux_ms->dispersion();

    er_eff_single = aux_ms->er_eff_0;
    Z0_single     = aux_ms->Z0_0;
}


+2 −2
Original line number Diff line number Diff line
@@ -1076,11 +1076,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
    break;

    case ID_MENU_ARCHIVE_NEW_MODULES:
        Archive_Modules( wxEmptyString, true );
        ArchiveModulesOnBoard( wxEmptyString, true );
        break;

    case ID_MENU_ARCHIVE_ALL_MODULES:
        Archive_Modules( wxEmptyString, false );
        ArchiveModulesOnBoard( wxEmptyString, false );
        break;

    default:
Loading