Commit 15403684 authored by jean-pierre charras's avatar jean-pierre charras

Minor fixes and changes:

Remove a minor warning message in Debug mode for 2 dialogs.
Pcbnew: update Gerber X2 file format (File Attribute) to very last X2 specification
Eeschema: Fix a minor bug in block selection (sometimes the last selected component was select instead of items in selected area)
and better drag behavior when draging an item by the drag hotkey.
parent 57e53769
......@@ -71,6 +71,10 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
msg = _( "Block Drag" );
break;
case BLOCK_DRAG_ITEM: // Drag
msg = _( "Drag item" );
break;
case BLOCK_COPY: // Copy
msg = _( "Block Copy" );
break;
......
......@@ -717,17 +717,18 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
case BLOCK_IDLE:
break;
case BLOCK_MOVE: /* Move */
case BLOCK_DRAG: /* Drag */
case BLOCK_COPY: /* Copy */
case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MOVE: // Move
case BLOCK_DRAG: // Drag (block defined)
case BLOCK_DRAG_ITEM: // Drag from a drag item command
case BLOCK_COPY: // Copy
case BLOCK_DELETE: // Delete
case BLOCK_SAVE: // Save
case BLOCK_ROTATE: // Rotate 90 deg
case BLOCK_FLIP: // Flip
case BLOCK_ZOOM: // Window Zoom
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_MIRROR_Y: // mirror
case BLOCK_PRESELECT_MOVE: // Move with preselection list
Block->InitData( m_canvas, aPosition );
break;
......@@ -736,7 +737,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
Block->SetLastCursorPosition( wxPoint( 0, 0 ) );
InitBlockPasteInfos();
if( Block->GetCount() == 0 ) /* No data to paste */
if( Block->GetCount() == 0 ) // No data to paste
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
......@@ -771,10 +772,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
}
// See comment in classpcb.cpp near line 66
//static const double MAX_AXIS = 1518500251;
// However I am not seeing a problem with this size yet:
// I am not seeing a problem with this size yet:
static const double MAX_AXIS = INT_MAX - 100;
#define VIRT_MIN (-MAX_AXIS/2.0) ///< min X or Y coordinate in virtual space
......
......@@ -133,8 +133,9 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
switch( block->GetCommand() )
{
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_DRAG: // Drag from mouse
case BLOCK_DRAG_ITEM: // Drag from a component selection and drag command
case BLOCK_MOVE:
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
......@@ -238,19 +239,24 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
break;
case BLOCK_DRAG:
case BLOCK_DRAG_ITEM: // Drag from a drag command
GetScreen()->BreakSegmentsOnJunctions();
// fall through
case BLOCK_MOVE:
case BLOCK_COPY:
if( GetScreen()->GetCurItem() != NULL )
if( block->GetCommand() == BLOCK_DRAG_ITEM &&
GetScreen()->GetCurItem() != NULL )
{
// This is a drag command, not a mouse block command
// Only this item is put in list
ITEM_PICKER picker;
picker.SetItem( GetScreen()->GetCurItem() );
block->PushItem( picker );
}
else
{
// Collect all items in the locate block
GetScreen()->UpdatePickList();
}
// fall through
......
......@@ -109,9 +109,10 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
case BLOCK_DRAG:
case BLOCK_DRAG_ITEM:
case BLOCK_MOVE:
case BLOCK_COPY:
if ( m_component )
ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
m_unit, m_convert,
......@@ -132,7 +133,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
}
break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
case BLOCK_PRESELECT_MOVE: // Move with preselection list
nextCmd = true;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
......@@ -232,8 +233,9 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_IDLE:
break;
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_DRAG:
case BLOCK_DRAG_ITEM:
case BLOCK_MOVE:
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.ClearItemsList();
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -32,7 +32,6 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizeText = new wxBoxSizer( wxVERTICAL );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_textLabelSingleLine->SetMaxLength( 0 );
m_textLabelSingleLine->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelText ) );
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
......@@ -54,7 +53,6 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextSize->SetMaxLength( 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
......
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -234,7 +236,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
......@@ -510,7 +512,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......
......@@ -759,8 +759,6 @@ void SCH_SCREEN::GetHierarchicalItems( EDA_ITEMS& aItems )
void SCH_SCREEN::SelectBlockItems()
{
SCH_ITEM* item;
PICKED_ITEMS_LIST* pickedlist = &m_BlockLocate.GetItems();
if( pickedlist->GetCount() == 0 )
......@@ -770,7 +768,7 @@ void SCH_SCREEN::SelectBlockItems()
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{
item = (SCH_ITEM*) pickedlist->GetPickedItem( ii );
SCH_ITEM* item = (SCH_ITEM*) pickedlist->GetPickedItem( ii );
item->SetFlags( SELECTED );
}
......@@ -781,18 +779,17 @@ void SCH_SCREEN::SelectBlockItems()
// be sure end lines that are on the block limits are seen inside this block
m_BlockLocate.Inflate( 1 );
unsigned last_select_id = pickedlist->GetCount();
unsigned ii = 0;
for( ; ii < last_select_id; ii++ )
for( unsigned ii = 0; ii < last_select_id; ii++ )
{
item = (SCH_ITEM*)pickedlist->GetPickedItem( ii );
SCH_ITEM* item = (SCH_ITEM*)pickedlist->GetPickedItem( ii );
item->SetFlags( IS_DRAGGED );
if( item->Type() == SCH_LINE_T )
{
item->IsSelectStateChanged( m_BlockLocate );
if( ( item->GetFlags() & SELECTED ) == 0 )
if( !item->IsSelected() )
{ // This is a special case:
// this selected wire has no ends in block.
// But it was selected (because it intersects the selecting area),
......@@ -814,8 +811,8 @@ void SCH_SCREEN::SelectBlockItems()
item->GetConnectionPoints( connections );
for( size_t i = 0; i < connections.size(); i++ )
addConnectedItemsToBlock( connections[i] );
for( size_t jj = 0; jj < connections.size(); jj++ )
addConnectedItemsToBlock( connections[jj] );
}
}
......
......@@ -940,7 +940,14 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
// The easiest way to handle a menu or a hot key drag command
// is to simulate a block drag command
//
// When a drag item is requested, some items use a BLOCK_DRAG_ITEM drag type
// an some items use a BLOCK_DRAG drag type (mainly a junction)
// a BLOCK_DRAG collects all items in a block (here a 2x2 rect centered on the cursor)
// and BLOCK_DRAG_ITEM drag only the selected item
BLOCK_COMMAND_T dragType = BLOCK_DRAG_ITEM;
if( item == NULL )
{
......@@ -958,42 +965,43 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
return;
// When a junction or a node is found, a BLOCK_DRAG is better
if( m_collectedItems.IsCorner() || m_collectedItems.IsNode( false )
|| m_collectedItems.IsDraggableJunction() )
dragType = BLOCK_DRAG;
}
switch( item->Type() )
{
case SCH_BUS_BUS_ENTRY_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_LINE_T:
case SCH_JUNCTION_T:
if( item->GetLayer() == LAYER_BUS )
break;
case SCH_BUS_BUS_ENTRY_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_LINE_T:
case SCH_JUNCTION_T:
case SCH_COMPONENT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_T:
m_canvas->MoveCursorToCrossHair();
// Fall thru if item is not on bus layer.
case SCH_COMPONENT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_T:
m_canvas->MoveCursorToCrossHair();
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
// The easiest way to handle a drag component or sheet command
// is to simulate a block drag command
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{
if( !HandleBlockBegin( &dc, BLOCK_DRAG, GetCrossHairPosition() ) )
break;
if( !HandleBlockBegin( &dc, dragType, GetCrossHairPosition() ) )
break;
// Give a non null size to the search block:
screen->m_BlockLocate.Inflate( 1 );
HandleBlockEnd( &dc );
}
// Give a non null size to the search block:
screen->m_BlockLocate.Inflate( 1 );
HandleBlockEnd( &dc );
}
break;
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Cannot drag schematic item type %s." ),
GetChars( item->GetClass() ) ) );
default:
wxFAIL_MSG( wxString::Format( wxT( "Cannot drag schematic item type %s." ),
GetChars( item->GetClass() ) ) );
}
}
......
......@@ -55,6 +55,8 @@ typedef enum {
BLOCK_DELETE,
BLOCK_PASTE,
BLOCK_DRAG,
BLOCK_DRAG_ITEM, // like BLOCK_DRAG, when used to drag a selected component
// and not using an area defined by a mouse drag
BLOCK_ROTATE,
BLOCK_FLIP,
BLOCK_ZOOM,
......@@ -166,7 +168,10 @@ public:
* Function IsDragging
* returns true if the current block command is a drag operation.
*/
bool IsDragging() const { return m_command == BLOCK_DRAG; }
bool IsDragging() const
{
return m_command == BLOCK_DRAG || m_command == BLOCK_DRAG_ITEM;
}
/**
* Function IsIdle
......
......@@ -159,7 +159,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bSizerNetlistFilename = new wxBoxSizer( wxHORIZONTAL );
m_NetlistFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NetlistFilenameCtrl->SetMaxLength( 0 );
bSizerNetlistFilename->Add( m_NetlistFilenameCtrl, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
......
......@@ -1712,7 +1712,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
......
......@@ -146,14 +146,17 @@ wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer )
break;
case B_Cu:
attrib = wxString::Format( wxT( "Copper,L%d" ), aBoard->GetCopperLayerCount() );
attrib = wxString::Format( wxT( "Copper,L%d,Bot" ), aBoard->GetCopperLayerCount() );
break;
case F_Cu:
attrib = wxString::Format( wxT( "Copper,L1,Top" ) );
break;
default:
if( IsCopperLayer( aLayer ) )
{
attrib = wxString::Format( wxT( "Copper,L%d" ), aLayer+1 );
attrib = wxString::Format( wxT( "Copper,L%d,Inr" ), aLayer+1 );
}
break;
}
......
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