Hook up import-page-layout and change-background-color actions.
This commit is contained in:
parent
2901fee9a0
commit
71f188f3de
|
@ -748,10 +748,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if( !fullFileName.IsEmpty() )
|
if( !fullFileName.IsEmpty() )
|
||||||
{
|
wxLogMessage( wxT("Page layout file <%s> not found"), fullFileName.GetData() );
|
||||||
wxLogMessage( wxT("Page layout file <%s> not found"),
|
|
||||||
fullFileName.GetData() );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
SetDefaultLayout();
|
SetDefaultLayout();
|
||||||
return;
|
return;
|
||||||
|
@ -771,8 +768,7 @@ void WORKSHEET_LAYOUT::SetPageLayout( const wxString& aFullFileName, bool Append
|
||||||
char * buffer = new char[filelen+10];
|
char * buffer = new char[filelen+10];
|
||||||
|
|
||||||
if( wksFile.Read( buffer, filelen ) != filelen )
|
if( wksFile.Read( buffer, filelen ) != filelen )
|
||||||
wxLogMessage( _("The file \"%s\" was not fully read"),
|
wxLogMessage( _("The file \"%s\" was not fully read"), fullFileName.GetData() );
|
||||||
fullFileName.GetData() );
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[filelen]=0;
|
buffer[filelen]=0;
|
||||||
|
|
|
@ -55,9 +55,25 @@
|
||||||
#include <worksheet_dataitem.h>
|
#include <worksheet_dataitem.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <page_info.h>
|
#include <page_info.h>
|
||||||
|
#include <layers_id_colors_and_visibility.h>
|
||||||
|
|
||||||
// ============================ BASE CLASS ==============================
|
// ============================ BASE CLASS ==============================
|
||||||
|
|
||||||
|
void WS_DRAW_ITEM_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
|
{
|
||||||
|
aCount = 1;
|
||||||
|
|
||||||
|
WORKSHEET_DATAITEM* dataItem = GetPeer();
|
||||||
|
|
||||||
|
if( dataItem->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||||
|
aLayers[0] = LAYER_WORKSHEET_PAGE1;
|
||||||
|
else if( dataItem->GetPage1Option() == SUBSEQUENT_PAGES )
|
||||||
|
aLayers[0] = LAYER_WORKSHEET_PAGEn;
|
||||||
|
else
|
||||||
|
aLayers[0] = LAYER_WORKSHEET;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// A generic HitTest that can be used by some, but not all, sub-classes.
|
// A generic HitTest that can be used by some, but not all, sub-classes.
|
||||||
bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,6 +195,8 @@ enum GAL_LAYER_ID: int
|
||||||
LAYER_VIAS_HOLES, ///< to draw via holes (pad holes do not use this layer)
|
LAYER_VIAS_HOLES, ///< to draw via holes (pad holes do not use this layer)
|
||||||
LAYER_DRC, ///< drc markers
|
LAYER_DRC, ///< drc markers
|
||||||
LAYER_WORKSHEET, ///< worksheet frame
|
LAYER_WORKSHEET, ///< worksheet frame
|
||||||
|
LAYER_WORKSHEET_PAGE1, ///< for pageLayout editor previewing
|
||||||
|
LAYER_WORKSHEET_PAGEn, ///< for pageLayout editor previewing
|
||||||
LAYER_GP_OVERLAY, ///< general purpose overlay
|
LAYER_GP_OVERLAY, ///< general purpose overlay
|
||||||
LAYER_SELECT_OVERLAY, ///< currently selected items overlay
|
LAYER_SELECT_OVERLAY, ///< currently selected items overlay
|
||||||
LAYER_PCB_BACKGROUND, ///< PCB background color
|
LAYER_PCB_BACKGROUND, ///< PCB background color
|
||||||
|
|
|
@ -66,6 +66,8 @@ public:
|
||||||
|
|
||||||
WORKSHEET_DATAITEM* GetPeer() const { return m_peer; }
|
WORKSHEET_DATAITEM* GetPeer() const { return m_peer; }
|
||||||
|
|
||||||
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
virtual const wxPoint GetPosition() const = 0;
|
virtual const wxPoint GetPosition() const = 0;
|
||||||
virtual void SetPosition( wxPoint aPos ) = 0;
|
virtual void SetPosition( wxPoint aPos ) = 0;
|
||||||
virtual void SetEnd( wxPoint aPos ) { /* not all types will need this */ }
|
virtual void SetEnd( wxPoint aPos ) { /* not all types will need this */ }
|
||||||
|
|
|
@ -20,11 +20,8 @@ set( PL_EDITOR_SRCS
|
||||||
dialogs/dialog_new_dataitem.cpp
|
dialogs/dialog_new_dataitem.cpp
|
||||||
pl_editor_screen.cpp
|
pl_editor_screen.cpp
|
||||||
pl_editor_layout.cpp
|
pl_editor_layout.cpp
|
||||||
events_functions.cpp
|
|
||||||
controle.cpp
|
|
||||||
files.cpp
|
files.cpp
|
||||||
page_layout_writer.cpp
|
page_layout_writer.cpp
|
||||||
pl_editor_config.cpp
|
|
||||||
pl_editor_frame.cpp
|
pl_editor_frame.cpp
|
||||||
pl_editor_undo_redo.cpp
|
pl_editor_undo_redo.cpp
|
||||||
properties_frame.cpp
|
properties_frame.cpp
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
/**
|
|
||||||
* @file pagelayout_editor/controle.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 CERN
|
|
||||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <class_drawpanel.h>
|
|
||||||
#include <pl_editor_frame.h>
|
|
||||||
|
|
||||||
|
|
||||||
bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
|
|
||||||
{
|
|
||||||
bool eventHandled = true;
|
|
||||||
|
|
||||||
// Filter out the 'fake' mouse motion after a keyboard movement
|
|
||||||
if( !aHotKey && m_movingCursorWithKeyboard )
|
|
||||||
{
|
|
||||||
m_movingCursorWithKeyboard = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint pos = aPosition;
|
|
||||||
wxPoint oldpos = GetCrossHairPosition();
|
|
||||||
GeneralControlKeyMovement( aHotKey, &pos, true );
|
|
||||||
|
|
||||||
// Update cursor position.
|
|
||||||
SetCrossHairPosition( pos, true );
|
|
||||||
RefreshCrossHair( oldpos, aPosition, aDC );
|
|
||||||
|
|
||||||
if( aHotKey )
|
|
||||||
{
|
|
||||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition );
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateStatusBar();
|
|
||||||
|
|
||||||
return eventHandled;
|
|
||||||
}
|
|
|
@ -1,356 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 CERN
|
|
||||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file pagelayout_editor/events_functions.cpp
|
|
||||||
* @brief page layout editor command event functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <wx/treectrl.h>
|
|
||||||
#include <pgm_base.h>
|
|
||||||
#include <class_drawpanel.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <macros.h>
|
|
||||||
|
|
||||||
#include <pl_editor_frame.h>
|
|
||||||
#include <kicad_device_context.h>
|
|
||||||
#include <pl_editor_id.h>
|
|
||||||
#include <dialog_helpers.h>
|
|
||||||
#include <menus_helpers.h>
|
|
||||||
#include <ws_draw_item.h>
|
|
||||||
#include <worksheet_dataitem.h>
|
|
||||||
#include <dialog_page_settings.h>
|
|
||||||
#include <invoke_pl_editor_dialog.h>
|
|
||||||
#include <properties_frame.h>
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
|
||||||
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
|
|
||||||
// Menu Files:
|
|
||||||
EVT_MENU( wxID_NEW, PL_EDITOR_FRAME::Files_io )
|
|
||||||
EVT_MENU( wxID_OPEN, PL_EDITOR_FRAME::Files_io )
|
|
||||||
EVT_MENU( wxID_SAVE, PL_EDITOR_FRAME::Files_io )
|
|
||||||
EVT_MENU( wxID_SAVEAS, PL_EDITOR_FRAME::Files_io )
|
|
||||||
EVT_MENU( wxID_FILE, PL_EDITOR_FRAME::Files_io )
|
|
||||||
EVT_MENU( ID_APPEND_DESCR_FILE, PL_EDITOR_FRAME::Files_io )
|
|
||||||
|
|
||||||
EVT_MENU( ID_GEN_PLOT, PL_EDITOR_FRAME::ToPlotter )
|
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory )
|
|
||||||
|
|
||||||
EVT_MENU( wxID_EXIT, PL_EDITOR_FRAME::OnQuit )
|
|
||||||
|
|
||||||
// menu Preferences
|
|
||||||
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, PL_EDITOR_FRAME::Process_Config )
|
|
||||||
EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Config )
|
|
||||||
|
|
||||||
EVT_TOOL( wxID_DELETE, PL_EDITOR_FRAME::Process_Special_Functions )
|
|
||||||
EVT_TOOL( wxID_PRINT, PL_EDITOR_FRAME::ToPrinter )
|
|
||||||
EVT_TOOL( wxID_PREVIEW, PL_EDITOR_FRAME::ToPrinter )
|
|
||||||
EVT_TOOL( ID_SHEET_SET, PL_EDITOR_FRAME::Process_Special_Functions )
|
|
||||||
EVT_TOOL( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
|
|
||||||
EVT_TOOL( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
|
|
||||||
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
|
|
||||||
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
|
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
|
||||||
PL_EDITOR_FRAME::Process_Special_Functions )
|
|
||||||
|
|
||||||
EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
|
|
||||||
EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode )
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
/* Handles the selection of tools, menu, and popup menu commands.
|
|
||||||
*/
|
|
||||||
void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
|
||||||
cmd.SetEventObject( this );
|
|
||||||
|
|
||||||
switch( event.GetId() )
|
|
||||||
{
|
|
||||||
case ID_SELECT_PAGE_NUMBER:
|
|
||||||
m_canvas->Refresh();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_SHEET_SET:
|
|
||||||
{
|
|
||||||
DIALOG_PAGES_SETTINGS dlg( this, wxSize( MAX_PAGE_SIZE_EDITORS_MILS,
|
|
||||||
MAX_PAGE_SIZE_EDITORS_MILS ) );
|
|
||||||
dlg.SetWksFileName( GetCurrFileName() );
|
|
||||||
dlg.EnableWksFileNamePicker( false );
|
|
||||||
dlg.ShowModal();
|
|
||||||
|
|
||||||
cmd.SetId( ID_ZOOM_PAGE );
|
|
||||||
wxPostEvent( this, cmd );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_POPUP_ITEM_APPEND_PAGE_LAYOUT:
|
|
||||||
cmd.SetId( ID_APPEND_DESCR_FILE );
|
|
||||||
wxPostEvent( this, cmd );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Function moveItem: called when the mouse cursor is moving
|
|
||||||
* moves the item currently selected (or the start point or the end point)
|
|
||||||
* to the cursor position
|
|
||||||
DPOINT initialPosition; // The initial position of the item to move, in mm
|
|
||||||
wxPoint initialPositionUi; // The initial position of the item to move, in Ui
|
|
||||||
wxPoint initialCursorPosition; // The initial position of the cursor
|
|
||||||
|
|
||||||
static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
|
|
||||||
{
|
|
||||||
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
|
|
||||||
WORKSHEET_DATAITEM *item = screen->GetCurItem();
|
|
||||||
|
|
||||||
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
|
|
||||||
wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
|
|
||||||
- ( initialCursorPosition - initialPositionUi );
|
|
||||||
wxPoint previous_position;
|
|
||||||
|
|
||||||
if( (item->GetFlags() & LOCATE_STARTPOINT) )
|
|
||||||
{
|
|
||||||
previous_position = item->GetStartPosUi();
|
|
||||||
item->MoveStartPointToUi( position );
|
|
||||||
}
|
|
||||||
else if( (item->GetFlags() & LOCATE_ENDPOINT) )
|
|
||||||
{
|
|
||||||
previous_position = item->GetEndPosUi();
|
|
||||||
item->MoveEndPointToUi( position );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
previous_position = item->GetStartPosUi();
|
|
||||||
item->MoveToUi( position );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the item item at it's new position, if it is modified,
|
|
||||||
// (does not happen each time the mouse is moved, because the
|
|
||||||
// item is placed on grid)
|
|
||||||
// to avoid useless computation time.
|
|
||||||
if( previous_position != position )
|
|
||||||
aPanel->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
* Function abortMoveItem: called when an item is currently moving,
|
|
||||||
* and when the user aborts the move command.
|
|
||||||
* Restores the initial position of the item
|
|
||||||
static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
|
||||||
{
|
|
||||||
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
|
|
||||||
WORKSHEET_DATAITEM *item = screen->GetCurItem();
|
|
||||||
|
|
||||||
if( item->GetFlags() & NEW_ITEM )
|
|
||||||
{
|
|
||||||
PL_EDITOR_FRAME* plframe = (PL_EDITOR_FRAME*) aPanel->GetParent();
|
|
||||||
plframe->RemoveLastCommandInUndoList();
|
|
||||||
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
|
|
||||||
pglayout.Remove( item );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( (item->GetFlags() & LOCATE_STARTPOINT) )
|
|
||||||
{
|
|
||||||
item->MoveStartPointTo( initialPosition );
|
|
||||||
}
|
|
||||||
else if( (item->GetFlags() & LOCATE_ENDPOINT) )
|
|
||||||
{
|
|
||||||
item->MoveEndPointTo( initialPosition );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
item->MoveTo( initialPosition );
|
|
||||||
}
|
|
||||||
|
|
||||||
aPanel->SetMouseCapture( NULL, NULL );
|
|
||||||
screen->SetCurItem( NULL );
|
|
||||||
aPanel->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
|
||||||
{
|
|
||||||
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
|
|
||||||
initialPosition = aItem->GetStartPos();
|
|
||||||
initialPositionUi = aItem->GetStartPosUi();
|
|
||||||
initialCursorPosition = GetCrossHairPosition();
|
|
||||||
|
|
||||||
if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
|
|
||||||
{
|
|
||||||
initialPosition = aItem->GetEndPos();
|
|
||||||
initialPositionUi = aItem->GetEndPosUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
|
|
||||||
{
|
|
||||||
SetCrossHairPosition( initialPositionUi, false );
|
|
||||||
initialCursorPosition = GetCrossHairPosition();
|
|
||||||
|
|
||||||
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
|
|
||||||
{
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
|
||||||
m_canvas->Refresh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RedrawScreen( initialCursorPosition, true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( moveItem, abortMoveItem );
|
|
||||||
GetScreen()->SetCurItem( aItem );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
* Save in Undo list the layout, and place an item being moved.
|
|
||||||
* @param aItem is the item moved
|
|
||||||
void PL_EDITOR_FRAME::PlaceItem( WORKSHEET_DATAITEM* aItem )
|
|
||||||
{
|
|
||||||
DPOINT currStartPos = aItem->GetStartPos();
|
|
||||||
DPOINT currEndPos = aItem->GetEndPos();
|
|
||||||
|
|
||||||
aItem->ClearFlags( NEW_ITEM );
|
|
||||||
|
|
||||||
// Save the curren layout before changes
|
|
||||||
if( (aItem->GetFlags() & LOCATE_STARTPOINT) )
|
|
||||||
{
|
|
||||||
aItem->MoveStartPointTo( initialPosition );
|
|
||||||
}
|
|
||||||
else if( aItem->GetFlags() & LOCATE_ENDPOINT )
|
|
||||||
{
|
|
||||||
aItem->MoveEndPointTo( initialPosition );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
aItem->MoveTo( initialPosition );
|
|
||||||
|
|
||||||
SaveCopyInUndoList();
|
|
||||||
|
|
||||||
// Re-place the item
|
|
||||||
aItem->MoveStartPointTo( currStartPos );
|
|
||||||
aItem->MoveEndPointTo( currEndPos );
|
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( NULL, NULL );
|
|
||||||
GetScreen()->SetCurItem( NULL );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* called when the user select one of the 4 page corner as corner
|
|
||||||
* reference (or the left top paper corner)
|
|
||||||
*/
|
|
||||||
void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
m_originSelectChoice = m_originSelectBox->GetSelection();
|
|
||||||
UpdateStatusBar(); // Update grid origin
|
|
||||||
m_canvas->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
WORKSHEET_DATAITEM::m_SpecialMode = (event.GetId() == ID_SHOW_PL_EDITOR_MODE);
|
|
||||||
m_canvas->Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
Close( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
wxMessageBox( wxT( "Not yet available" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::ToPrinter(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
// static print data and page setup data, to remember settings during the session
|
|
||||||
static wxPrintData* s_PrintData;
|
|
||||||
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
|
|
||||||
|
|
||||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
|
||||||
|
|
||||||
if( s_PrintData == NULL ) // First print
|
|
||||||
{
|
|
||||||
s_PrintData = new wxPrintData();
|
|
||||||
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !s_PrintData->Ok() )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "Error Init Printer info" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( s_pageSetupData == NULL )
|
|
||||||
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
|
|
||||||
|
|
||||||
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
|
|
||||||
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
|
|
||||||
|
|
||||||
if( pageInfo.IsCustom() )
|
|
||||||
{
|
|
||||||
if( pageInfo.IsPortrait() )
|
|
||||||
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
|
|
||||||
Mils2mm( pageInfo.GetHeightMils() ) ) );
|
|
||||||
else
|
|
||||||
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
|
|
||||||
Mils2mm( pageInfo.GetWidthMils() ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
*s_PrintData = s_pageSetupData->GetPrintData();
|
|
||||||
|
|
||||||
if( event.GetId() == wxID_PREVIEW )
|
|
||||||
InvokeDialogPrintPreview( this, s_PrintData );
|
|
||||||
else
|
|
||||||
InvokeDialogPrint( this, s_PrintData, s_pageSetupData );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& event )
|
|
||||||
{
|
|
||||||
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& event )
|
|
||||||
{
|
|
||||||
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,10 @@ PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindo
|
||||||
|
|
||||||
setDefaultLayerDeps();
|
setDefaultLayerDeps();
|
||||||
|
|
||||||
|
m_view->SetLayerVisible( LAYER_WORKSHEET, true );
|
||||||
|
m_view->SetLayerVisible( LAYER_WORKSHEET_PAGE1, true );
|
||||||
|
m_view->SetLayerVisible( LAYER_WORKSHEET_PAGEn, false );
|
||||||
|
|
||||||
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
/**
|
|
||||||
* @file pl_editor_config.cpp
|
|
||||||
* @brief page layout editor configuration.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013 CERN
|
|
||||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <class_drawpanel.h>
|
|
||||||
#include <gestfich.h>
|
|
||||||
#include <config_params.h>
|
|
||||||
|
|
||||||
#include <pl_editor_frame.h>
|
|
||||||
#include <hotkeys.h>
|
|
||||||
#include <panel_hotkeys_editor.h>
|
|
||||||
#include <pl_editor_id.h>
|
|
||||||
|
|
||||||
#define GROUP wxT("/pl_editor")
|
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
int id = event.GetId();
|
|
||||||
|
|
||||||
switch( id )
|
|
||||||
{
|
|
||||||
case wxID_PREFERENCES:
|
|
||||||
ShowPreferences( PlEditorHotkeysDescr, PlEditorHotkeysDescr, wxT( "pl_editor" ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
|
||||||
DisplayHotkeyList( this, PlEditorHotkeysDescr );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Config error" ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PARAM_CFG_ARRAY& PL_EDITOR_FRAME::GetConfigurationSettings()
|
|
||||||
{
|
|
||||||
if( !m_configSettings.empty() )
|
|
||||||
return m_configSettings;
|
|
||||||
|
|
||||||
// Add settings here....
|
|
||||||
|
|
||||||
return m_configSettings;
|
|
||||||
}
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
|
#include <pgm_base.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <msgpanel.h>
|
#include <msgpanel.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
@ -34,11 +35,9 @@
|
||||||
#include <pl_draw_panel_gal.cpp>
|
#include <pl_draw_panel_gal.cpp>
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
#include <pl_editor_screen.h>
|
#include <pl_editor_screen.h>
|
||||||
#include <ws_draw_item.h>
|
|
||||||
#include <worksheet_dataitem.h>
|
#include <worksheet_dataitem.h>
|
||||||
#include <properties_frame.h>
|
#include <properties_frame.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <tool/selection.h>
|
#include <tool/selection.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
|
@ -51,6 +50,39 @@
|
||||||
#include <tools/pl_edit_tool.h>
|
#include <tools/pl_edit_tool.h>
|
||||||
#include <tools/pl_point_editor.h>
|
#include <tools/pl_point_editor.h>
|
||||||
#include <tools/pl_picker_tool.h>
|
#include <tools/pl_picker_tool.h>
|
||||||
|
#include <dialog_page_settings.h>
|
||||||
|
#include <invoke_pl_editor_dialog.h>
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
||||||
|
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
|
||||||
|
// Menu Files:
|
||||||
|
EVT_MENU( wxID_NEW, PL_EDITOR_FRAME::Files_io )
|
||||||
|
EVT_MENU( wxID_OPEN, PL_EDITOR_FRAME::Files_io )
|
||||||
|
EVT_MENU( wxID_SAVE, PL_EDITOR_FRAME::Files_io )
|
||||||
|
EVT_MENU( wxID_SAVEAS, PL_EDITOR_FRAME::Files_io )
|
||||||
|
EVT_MENU( wxID_FILE, PL_EDITOR_FRAME::Files_io )
|
||||||
|
|
||||||
|
EVT_MENU( ID_GEN_PLOT, PL_EDITOR_FRAME::ToPlotter )
|
||||||
|
|
||||||
|
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory )
|
||||||
|
|
||||||
|
EVT_MENU( wxID_EXIT, PL_EDITOR_FRAME::OnQuit )
|
||||||
|
|
||||||
|
// menu Preferences
|
||||||
|
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||||
|
EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||||
|
|
||||||
|
EVT_TOOL( wxID_PRINT, PL_EDITOR_FRAME::ToPrinter )
|
||||||
|
EVT_TOOL( wxID_PREVIEW, PL_EDITOR_FRAME::ToPrinter )
|
||||||
|
EVT_TOOL( ID_SHEET_SET, PL_EDITOR_FRAME::Process_Special_Functions )
|
||||||
|
EVT_TOOL( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
|
||||||
|
EVT_TOOL( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
|
||||||
|
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
|
||||||
|
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
|
||||||
|
|
||||||
|
EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
|
||||||
|
EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
@ -240,6 +272,139 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Handles the selection of tools, menu, and popup menu commands.
|
||||||
|
*/
|
||||||
|
void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
|
switch( event.GetId() )
|
||||||
|
{
|
||||||
|
case wxID_PREFERENCES:
|
||||||
|
ShowPreferences( PlEditorHotkeysDescr, PlEditorHotkeysDescr, wxT( "pl_editor" ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
|
||||||
|
DisplayHotkeyList( this, PlEditorHotkeysDescr );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_SELECT_PAGE_NUMBER:
|
||||||
|
{
|
||||||
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
|
view->SetLayerVisible( LAYER_WORKSHEET_PAGE1, m_pageSelectBox->GetSelection() == 0 );
|
||||||
|
view->SetLayerVisible( LAYER_WORKSHEET_PAGEn, m_pageSelectBox->GetSelection() == 1 );
|
||||||
|
m_canvas->Refresh();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_SHEET_SET:
|
||||||
|
{
|
||||||
|
DIALOG_PAGES_SETTINGS dlg( this, wxSize( MAX_PAGE_SIZE_EDITORS_MILS,
|
||||||
|
MAX_PAGE_SIZE_EDITORS_MILS ) );
|
||||||
|
dlg.SetWksFileName( GetCurrFileName() );
|
||||||
|
dlg.EnableWksFileNamePicker( false );
|
||||||
|
dlg.ShowModal();
|
||||||
|
|
||||||
|
cmd.SetId( ID_ZOOM_PAGE );
|
||||||
|
wxPostEvent( this, cmd );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* called when the user select one of the 4 page corner as corner
|
||||||
|
* reference (or the left top paper corner)
|
||||||
|
*/
|
||||||
|
void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
m_originSelectChoice = m_originSelectBox->GetSelection();
|
||||||
|
UpdateStatusBar(); // Update grid origin
|
||||||
|
m_canvas->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
WORKSHEET_DATAITEM::m_SpecialMode = (event.GetId() == ID_SHOW_PL_EDITOR_MODE);
|
||||||
|
m_canvas->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
Close( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxMessageBox( wxT( "Not yet available" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::ToPrinter(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
// static print data and page setup data, to remember settings during the session
|
||||||
|
static wxPrintData* s_PrintData;
|
||||||
|
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
|
||||||
|
|
||||||
|
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||||
|
|
||||||
|
if( s_PrintData == NULL ) // First print
|
||||||
|
{
|
||||||
|
s_PrintData = new wxPrintData();
|
||||||
|
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !s_PrintData->Ok() )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "Error Init Printer info" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( s_pageSetupData == NULL )
|
||||||
|
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
|
||||||
|
|
||||||
|
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
|
||||||
|
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
|
||||||
|
|
||||||
|
if( pageInfo.IsCustom() )
|
||||||
|
{
|
||||||
|
if( pageInfo.IsPortrait() )
|
||||||
|
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
|
||||||
|
Mils2mm( pageInfo.GetHeightMils() ) ) );
|
||||||
|
else
|
||||||
|
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
|
||||||
|
Mils2mm( pageInfo.GetWidthMils() ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
*s_PrintData = s_pageSetupData->GetPrintData();
|
||||||
|
|
||||||
|
if( event.GetId() == wxID_PREVIEW )
|
||||||
|
InvokeDialogPrintPreview( this, s_PrintData );
|
||||||
|
else
|
||||||
|
InvokeDialogPrint( this, s_PrintData, s_pageSetupData );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const BOX2I PL_EDITOR_FRAME::GetDocumentExtents() const
|
const BOX2I PL_EDITOR_FRAME::GetDocumentExtents() const
|
||||||
{
|
{
|
||||||
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU() );
|
BOX2I rv( VECTOR2I( 0, 0 ), GetPageLayout().GetPageSettings().GetSizeIU() );
|
||||||
|
|
|
@ -53,7 +53,6 @@ class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
|
||||||
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
||||||
// usefull when there are some items which are
|
// usefull when there are some items which are
|
||||||
// only on page 1, not on page 1
|
// only on page 1, not on page 1
|
||||||
|
|
||||||
wxPoint m_grid_origin;
|
wxPoint m_grid_origin;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -197,7 +196,7 @@ public:
|
||||||
* source code (mainly in dialogs). If you need to define a configuration
|
* source code (mainly in dialogs). If you need to define a configuration
|
||||||
* setting that need to be loaded at run time, this is the place to define it.
|
* setting that need to be loaded at run time, this is the place to define it.
|
||||||
*/
|
*/
|
||||||
PARAM_CFG_ARRAY& GetConfigurationSettings();
|
PARAM_CFG_ARRAY& GetConfigurationSettings() { return m_configSettings; }
|
||||||
|
|
||||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||||
|
|
||||||
|
@ -245,8 +244,6 @@ public:
|
||||||
bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
|
bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
|
||||||
EDA_ITEM* aItem = NULL ) override;
|
EDA_ITEM* aItem = NULL ) override;
|
||||||
|
|
||||||
void Process_Config( wxCommandEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ToPlotter
|
* Function ToPlotter
|
||||||
* Open a dialog frame to create plot and drill files
|
* Open a dialog frame to create plot and drill files
|
||||||
|
@ -261,7 +258,6 @@ public:
|
||||||
void ToPrinter( wxCommandEvent& event );
|
void ToPrinter( wxCommandEvent& event );
|
||||||
|
|
||||||
void Files_io( wxCommandEvent& event );
|
void Files_io( wxCommandEvent& event );
|
||||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
|
|
||||||
|
|
||||||
/** Virtual function PrintPage
|
/** Virtual function PrintPage
|
||||||
* used to print a page
|
* used to print a page
|
||||||
|
|
|
@ -43,10 +43,6 @@ enum pl_editor_ids
|
||||||
{
|
{
|
||||||
ID_MAIN_MENUBAR = ID_END_LIST,
|
ID_MAIN_MENUBAR = ID_END_LIST,
|
||||||
|
|
||||||
ID_PL_EDITOR_SHOW_SOURCE,
|
|
||||||
ID_MENU_PL_EDITOR_SELECT_PREFERED_EDITOR,
|
|
||||||
ID_DESIGN_TREE_FRAME,
|
|
||||||
|
|
||||||
ID_SHOW_REAL_MODE,
|
ID_SHOW_REAL_MODE,
|
||||||
ID_SHOW_PL_EDITOR_MODE,
|
ID_SHOW_PL_EDITOR_MODE,
|
||||||
ID_SELECT_COORDINATE_ORIGIN,
|
ID_SELECT_COORDINATE_ORIGIN,
|
||||||
|
@ -61,18 +57,6 @@ enum pl_editor_ids
|
||||||
ID_PL_IMAGE_TOOL,
|
ID_PL_IMAGE_TOOL,
|
||||||
ID_PL_DELETE_TOOL,
|
ID_PL_DELETE_TOOL,
|
||||||
|
|
||||||
ID_POPUP_START_RANGE,
|
|
||||||
ID_POPUP_ITEM_DELETE,
|
|
||||||
ID_POPUP_DESIGN_TREE_ITEM_DELETE,
|
|
||||||
ID_POPUP_ITEM_APPEND_PAGE_LAYOUT,
|
|
||||||
ID_POPUP_ITEM_MOVE,
|
|
||||||
ID_POPUP_ITEM_PLACE,
|
|
||||||
ID_POPUP_ITEM_MOVE_START_POINT,
|
|
||||||
ID_POPUP_ITEM_MOVE_END_POINT,
|
|
||||||
ID_POPUP_ITEM_PLACE_CANCEL,
|
|
||||||
ID_POPUP_ITEM_EDIT_BITMAP,
|
|
||||||
ID_POPUP_END_RANGE,
|
|
||||||
|
|
||||||
ID_PLEDITOR_END_LIST
|
ID_PLEDITOR_END_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -288,6 +288,7 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||||
// Be sure what is displayed is what is set for item
|
// Be sure what is displayed is what is set for item
|
||||||
// (mainly, texts can be modified if they contain "\n")
|
// (mainly, texts can be modified if they contain "\n")
|
||||||
CopyPrmsFromItemToPanel( dataItem );
|
CopyPrmsFromItemToPanel( dataItem );
|
||||||
|
m_parent->GetGalCanvas()->GetView()->Update( drawItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyPrmsFromPanelToGeneral();
|
CopyPrmsFromPanelToGeneral();
|
||||||
|
|
|
@ -132,16 +132,17 @@ void PL_EDITOR_FRAME::ReCreateVToolbar()
|
||||||
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
||||||
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
||||||
|
|
||||||
m_drawToolBar->Add( PL_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
||||||
|
|
||||||
KiScaledSeparator( m_drawToolBar, this );
|
KiScaledSeparator( m_drawToolBar, this );
|
||||||
m_drawToolBar->Add( PL_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
|
||||||
m_drawToolBar->Add( PL_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
||||||
m_drawToolBar->Add( PL_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
|
||||||
m_drawToolBar->Add( PL_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
|
||||||
|
m_drawToolBar->Add( PL_ACTIONS::appendImportedWorksheet, ACTION_TOOLBAR::TOGGLE );
|
||||||
|
|
||||||
KiScaledSeparator( m_drawToolBar, this );
|
KiScaledSeparator( m_drawToolBar, this );
|
||||||
m_drawToolBar->Add( PL_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE );
|
m_drawToolBar->Add( PL_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE );
|
||||||
|
|
||||||
m_drawToolBar->Realize();
|
m_drawToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
@ -165,5 +166,7 @@ void PL_EDITOR_FRAME::SyncMenusAndToolbars()
|
||||||
m_drawToolBar->Toggle( PL_ACTIONS::placeText, GetToolId() == ID_PL_TEXT_TOOL );
|
m_drawToolBar->Toggle( PL_ACTIONS::placeText, GetToolId() == ID_PL_TEXT_TOOL );
|
||||||
m_drawToolBar->Toggle( PL_ACTIONS::placeImage, GetToolId() == ID_PL_IMAGE_TOOL );
|
m_drawToolBar->Toggle( PL_ACTIONS::placeImage, GetToolId() == ID_PL_IMAGE_TOOL );
|
||||||
m_drawToolBar->Toggle( PL_ACTIONS::deleteItemCursor, GetToolId() == ID_PL_DELETE_TOOL );
|
m_drawToolBar->Toggle( PL_ACTIONS::deleteItemCursor, GetToolId() == ID_PL_DELETE_TOOL );
|
||||||
|
|
||||||
|
m_drawToolBar->Toggle( PL_ACTIONS::appendImportedWorksheet, false ); // Not really a tool
|
||||||
m_drawToolBar->Refresh();
|
m_drawToolBar->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,12 +79,6 @@ TOOL_ACTION PL_ACTIONS::addImage( "plEditor.InteractiveDrawing.addImage",
|
||||||
_( "Add Bitmap" ), _( "Add a bitmap image" ),
|
_( "Add Bitmap" ), _( "Add a bitmap image" ),
|
||||||
image_xpm, AF_ACTIVATE );
|
image_xpm, AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION PL_ACTIONS::appendImportedWorksheet( "plEditor.InteractiveDrawing.appendWorksheet",
|
|
||||||
AS_GLOBAL, 0,
|
|
||||||
_( "Append Existing Page Layout File..." ),
|
|
||||||
_( "Append an existing page layout design file to current file" ),
|
|
||||||
pagelayout_load_xpm, AF_ACTIVATE );
|
|
||||||
|
|
||||||
|
|
||||||
PL_DRAWING_TOOLS::PL_DRAWING_TOOLS() :
|
PL_DRAWING_TOOLS::PL_DRAWING_TOOLS() :
|
||||||
TOOL_INTERACTIVE( "plEditor.InteractiveDrawing" ),
|
TOOL_INTERACTIVE( "plEditor.InteractiveDrawing" ),
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <pl_editor_frame.h>
|
#include <pl_editor_frame.h>
|
||||||
#include <pl_editor_id.h>
|
#include <pl_editor_id.h>
|
||||||
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
|
|
||||||
TOOL_ACTION PL_ACTIONS::move( "plEditor.InteractiveEdit.move",
|
TOOL_ACTION PL_ACTIONS::move( "plEditor.InteractiveEdit.move",
|
||||||
|
@ -43,6 +44,12 @@ TOOL_ACTION PL_ACTIONS::move( "plEditor.InteractiveEdit.move",
|
||||||
_( "Move" ), _( "Moves the selected item(s)" ),
|
_( "Move" ), _( "Moves the selected item(s)" ),
|
||||||
move_xpm, AF_ACTIVATE );
|
move_xpm, AF_ACTIVATE );
|
||||||
|
|
||||||
|
TOOL_ACTION PL_ACTIONS::appendImportedWorksheet( "plEditor.InteractiveEdit.appendWorksheet",
|
||||||
|
AS_GLOBAL, 0,
|
||||||
|
_( "Append Existing Page Layout File..." ),
|
||||||
|
_( "Append an existing page layout design file to current file" ),
|
||||||
|
import_xpm, AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION PL_ACTIONS::deleteItemCursor( "plEditor.InteractiveEdit.deleteTool",
|
TOOL_ACTION PL_ACTIONS::deleteItemCursor( "plEditor.InteractiveEdit.deleteTool",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
_( "Delete Items" ), _( "Delete clicked items" ),
|
_( "Delete Items" ), _( "Delete clicked items" ),
|
||||||
|
@ -304,6 +311,17 @@ bool PL_EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PL_EDIT_TOOL::ImportWorksheetContent( const TOOL_EVENT& aEvent )
|
||||||
|
{
|
||||||
|
wxCommandEvent evt( wxEVT_NULL, ID_APPEND_DESCR_FILE );
|
||||||
|
m_frame->Files_io( evt );
|
||||||
|
|
||||||
|
m_frame->SetNoToolSelected();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
SELECTION& selection = m_selectionTool->RequestSelection();
|
SELECTION& selection = m_selectionTool->RequestSelection();
|
||||||
|
@ -387,11 +405,12 @@ int PL_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
void PL_EDIT_TOOL::setTransitions()
|
void PL_EDIT_TOOL::setTransitions()
|
||||||
{
|
{
|
||||||
Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
|
Go( &PL_EDIT_TOOL::Main, PL_ACTIONS::move.MakeEvent() );
|
||||||
|
|
||||||
Go( &PL_EDIT_TOOL::DoDelete, PL_ACTIONS::doDelete.MakeEvent() );
|
Go( &PL_EDIT_TOOL::ImportWorksheetContent, PL_ACTIONS::appendImportedWorksheet.MakeEvent() );
|
||||||
Go( &PL_EDIT_TOOL::DeleteItemCursor, PL_ACTIONS::deleteItemCursor.MakeEvent() );
|
Go( &PL_EDIT_TOOL::DoDelete, PL_ACTIONS::doDelete.MakeEvent() );
|
||||||
|
Go( &PL_EDIT_TOOL::DeleteItemCursor, PL_ACTIONS::deleteItemCursor.MakeEvent() );
|
||||||
|
|
||||||
Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
|
Go( &PL_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
|
||||||
Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
|
Go( &PL_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ public:
|
||||||
int Undo( const TOOL_EVENT& aEvent );
|
int Undo( const TOOL_EVENT& aEvent );
|
||||||
int Redo( const TOOL_EVENT& aEvent );
|
int Redo( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
int ImportWorksheetContent( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DoDelete()
|
* Function DoDelete()
|
||||||
*
|
*
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
#include <tool/selection.h>
|
#include <tool/selection.h>
|
||||||
#include <tools/pl_actions.h>
|
#include <tools/pl_actions.h>
|
||||||
#include <worksheet_dataitem.h>
|
#include <worksheet_dataitem.h>
|
||||||
|
#include <worksheet_painter.h>
|
||||||
#include <ws_draw_item.h>
|
#include <ws_draw_item.h>
|
||||||
#include <collector.h>
|
#include <collector.h>
|
||||||
#include <properties_frame.h>
|
#include <properties_frame.h>
|
||||||
|
|
||||||
#include "pl_selection_tool.h"
|
#include "pl_selection_tool.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -743,6 +743,9 @@ int PL_SELECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
||||||
int PL_SELECTION_TOOL::ToggleBackgroundColor( const TOOL_EVENT& aEvent )
|
int PL_SELECTION_TOOL::ToggleBackgroundColor( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->SetDrawBgColor( m_frame->GetDrawBgColor() == WHITE ? BLACK : WHITE );
|
m_frame->SetDrawBgColor( m_frame->GetDrawBgColor() == WHITE ? BLACK : WHITE );
|
||||||
|
getView()->GetPainter()->GetSettings()->SetBackgroundColor( m_frame->GetDrawBgColor() );
|
||||||
|
|
||||||
|
m_frame->GetGalCanvas()->GetView()->UpdateAllLayersColor();
|
||||||
m_frame->GetCanvas()->Refresh();
|
m_frame->GetCanvas()->Refresh();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue