diff --git a/common/block_commande.cpp b/common/block_commande.cpp index dfc27995b3..990fa6cee0 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -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; diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index b43d1669d0..fe259933b4 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -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 diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 98ea9e62a1..01c7c3fb04 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -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 diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index abf7fc66ed..139e6cf3ff 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_edit_label_base.cpp b/eeschema/dialogs/dialog_edit_label_base.cpp index 739f6a03d0..c46b70895b 100644 --- a/eeschema/dialogs/dialog_edit_label_base.cpp +++ b/eeschema/dialogs/dialog_edit_label_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// 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 ); diff --git a/eeschema/dialogs/dialog_edit_label_base.fbp b/eeschema/dialogs/dialog_edit_label_base.fbp index 3008bf2acc..1d8f475b0e 100644 --- a/eeschema/dialogs/dialog_edit_label_base.fbp +++ b/eeschema/dialogs/dialog_edit_label_base.fbp @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 1 0 @@ -234,7 +236,7 @@ 0 - 0 + 0 @@ -510,7 +512,7 @@ 0 - 0 + 0 diff --git a/eeschema/dialogs/dialog_edit_label_base.h b/eeschema/dialogs/dialog_edit_label_base.h index c704426370..7f92c37c39 100644 --- a/eeschema/dialogs/dialog_edit_label_base.h +++ b/eeschema/dialogs/dialog_edit_label_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// 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! diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 9a7d2a5390..fff8788f30 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -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] ); } } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index ff42fdc9af..d9accae049 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -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 ) + 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(); + + if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK ) + { + INSTALL_UNBUFFERED_DC( dc, m_canvas ); + + if( !HandleBlockBegin( &dc, dragType, GetCrossHairPosition() ) ) + break; + + // Give a non null size to the search block: + screen->m_BlockLocate.Inflate( 1 ); + HandleBlockEnd( &dc ); + } + break; - // 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(); - - // 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; - - // Give a non null size to the search block: - screen->m_BlockLocate.Inflate( 1 ); - HandleBlockEnd( &dc ); - } - - 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() ) ) ); } } diff --git a/include/block_commande.h b/include/block_commande.h index c8579c1c14..cf2c140237 100644 --- a/include/block_commande.h +++ b/include/block_commande.h @@ -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 diff --git a/pcbnew/dialogs/dialog_netlist_fbp.cpp b/pcbnew/dialogs/dialog_netlist_fbp.cpp index 716e38c6a1..13ebd9d7ab 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.cpp +++ b/pcbnew/dialogs/dialog_netlist_fbp.cpp @@ -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 ); diff --git a/pcbnew/dialogs/dialog_netlist_fbp.fbp b/pcbnew/dialogs/dialog_netlist_fbp.fbp index cdc4eb9c25..393a071cb5 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.fbp +++ b/pcbnew/dialogs/dialog_netlist_fbp.fbp @@ -1712,7 +1712,7 @@ 0 - 0 + 0 diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index d638439bbf..c5ad76183c 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -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; }