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

Pl_Editor: bug fixes (default values not saved, and duplicate item names, when adding items)

parent fff2f017
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -199,9 +199,20 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
        break;
        break;


    case ID_POPUP_ITEM_MOVE_START_POINT:
    case ID_POPUP_ITEM_MOVE_START_POINT:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        item->ClearFlags( LOCATE_ENDPOINT );
        MoveItem( item );
        break;

    case ID_POPUP_ITEM_MOVE_END_POINT:
    case ID_POPUP_ITEM_MOVE_END_POINT:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        item->ClearFlags( LOCATE_STARTPOINT );
        MoveItem( item );
        break;

    case ID_POPUP_ITEM_MOVE:
    case ID_POPUP_ITEM_MOVE:
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        item = m_treePagelayout->GetPageLayoutSelectedItem();
        item->ClearFlags( LOCATE_ENDPOINT|LOCATE_STARTPOINT );
        MoveItem( item );
        MoveItem( item );
        break;
        break;


+4 −4
Original line number Original line Diff line number Diff line
@@ -182,10 +182,10 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
    // Write default values:
    // Write default values:
    m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) );
    m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) );
    m_out->Print( 0, "(textsize %s %s)",
    m_out->Print( 0, "(textsize %s %s)",
                  double2Str( TB_DEFAULT_TEXTSIZE ).c_str(),
                  double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.x ).c_str(),
                  double2Str( TB_DEFAULT_TEXTSIZE ).c_str() );
                  double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.y ).c_str() );
    m_out->Print( 0, "(linewidth %s)", double2Str( 0.15 ).c_str() );
    m_out->Print( 0, "(linewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultLineWidth ).c_str() );
    m_out->Print( 0, "(textlinewidth %s)", double2Str( 0.15 ).c_str() );
    m_out->Print( 0, "(textlinewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultTextThickness ).c_str() );
    m_out->Print( 0, "\n" );
    m_out->Print( 0, "\n" );


    // Write margin values
    // Write margin values
+24 −3
Original line number Original line Diff line number Diff line
@@ -505,14 +505,35 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
void PL_EDITOR_FRAME::RebuildDesignTree()
void PL_EDITOR_FRAME::RebuildDesignTree()
{
{
    const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
    const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
    int rectId = 0;
    int lineId = 0;
    int textId = 0;
    int polyId = 0;


    for( unsigned ii = 0; ii < pglayout.GetCount(); ii++ )
    for( unsigned ii = 0; ii < pglayout.GetCount(); ii++ )
    {
    {
        WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
        WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
        if( item->m_Name.IsEmpty() )
        switch( item->GetType() )
        {
        {
            item->m_Name = wxString::Format( wxT("item%d:%s"), ii+1,
            case WORKSHEET_DATAITEM::WS_TEXT:
                item->m_Name = wxString::Format( wxT("text%d:%s"), ++textId,
                                                 GetChars(item->GetClassName()) );
                break;

            case WORKSHEET_DATAITEM:: WS_SEGMENT:
                item->m_Name = wxString::Format( wxT("segm%d:%s"), ++lineId,
                                                 GetChars(item->GetClassName()) );
                break;

            case WORKSHEET_DATAITEM::WS_RECT:
                item->m_Name = wxString::Format( wxT("rect%d:%s"), ++rectId,
                                                 GetChars(item->GetClassName()) );
                                                 GetChars(item->GetClassName()) );
                break;

            case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
                item->m_Name = wxString::Format( wxT("poly%d:%s"), ++polyId,
                                                 GetChars(item->GetClassName()) );
                break;
        }
        }
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -322,6 +322,7 @@ public:


    /**
    /**
     * Initialize a move item command
     * Initialize a move item command
     * @param aItem is the item to move
     */
     */
    void MoveItem( WORKSHEET_DATAITEM* aItem );
    void MoveItem( WORKSHEET_DATAITEM* aItem );