Pl_Editor: bug fixes (default values not saved, and duplicate item names, when adding items)
This commit is contained in:
parent
fff2f017d8
commit
99535864e4
|
@ -199,9 +199,20 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
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:
|
||||
item = m_treePagelayout->GetPageLayoutSelectedItem();
|
||||
item->ClearFlags( LOCATE_STARTPOINT );
|
||||
MoveItem( item );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ITEM_MOVE:
|
||||
item = m_treePagelayout->GetPageLayoutSelectedItem();
|
||||
item->ClearFlags( LOCATE_ENDPOINT|LOCATE_STARTPOINT );
|
||||
MoveItem( item );
|
||||
break;
|
||||
|
||||
|
|
|
@ -182,10 +182,10 @@ void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
|
|||
// Write default values:
|
||||
m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) );
|
||||
m_out->Print( 0, "(textsize %s %s)",
|
||||
double2Str( TB_DEFAULT_TEXTSIZE ).c_str(),
|
||||
double2Str( TB_DEFAULT_TEXTSIZE ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)", double2Str( 0.15 ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)", double2Str( 0.15 ).c_str() );
|
||||
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.x ).c_str(),
|
||||
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultTextThickness ).c_str() );
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
// Write margin values
|
||||
|
|
|
@ -505,14 +505,35 @@ void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
|
|||
void PL_EDITOR_FRAME::RebuildDesignTree()
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
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()) );
|
||||
break;
|
||||
|
||||
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||
item->m_Name = wxString::Format( wxT("poly%d:%s"), ++polyId,
|
||||
GetChars(item->GetClassName()) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,6 +322,7 @@ public:
|
|||
|
||||
/**
|
||||
* Initialize a move item command
|
||||
* @param aItem is the item to move
|
||||
*/
|
||||
void MoveItem( WORKSHEET_DATAITEM* aItem );
|
||||
|
||||
|
|
Loading…
Reference in New Issue