Commit bbda48f9 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Unify Eeschema orient commands and other minor fixes.

* Create command event handler for orienting schematic items and block.
* Remove redundant orient item and block command handler code and IDs.
* Remove redundant cancel current command event table entry.
* Remove unnecessary schematic bitmap object virtual functions.
* Set path when saving schematic sheet files to prevent assertion in
  updated path and file write permission test function.
* Restore directory and file name write permission test function to it's
  previous behavior to prevent unexpected save results.
* Add an assertion to verify the path is not empty to directory and file
  write permission test function.
* Improve documentation for path and file write permission test function.
* Fix Doxygen link warnings.
parent a834c47b
......@@ -543,25 +543,21 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
{
wxString msg;
wxCHECK_MSG( aFileName.IsOk(), false, wxT( "Invalid file name object. Bad programmer!" ) );
wxCHECK_MSG( aFileName.IsOk(), false,
wxT( "File name object is invalid. Bad programmer!" ) );
wxCHECK_MSG( !aFileName.GetPath().IsEmpty(), false,
wxT( "File name object path <" ) + aFileName.GetFullPath() +
wxT( "> is not set. Bad programmer!" ) );
if( aFileName.IsDir() && !aFileName.IsDirWritable() )
{
msg.Printf( _( "You do not have write permissions to folder <%s>." ),
GetChars( aFileName.GetPath() ) );
}
else if( !aFileName.FileExists() )
{
// Extract filename path, and if void, uses the CWD
// because IsDirWritable does not like void path
wxString filedir = aFileName.GetPath();
if( filedir.IsEmpty() )
filedir = wxGetCwd();
if( !aFileName.IsDirWritable(filedir) )
else if( !aFileName.FileExists() && !aFileName.IsDirWritable() )
{
msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ),
GetChars( aFileName.GetFullName() ), GetChars( filedir ) );
}
GetChars( aFileName.GetFullName() ), GetChars( aFileName.GetPath() ) );
}
else if( aFileName.FileExists() && !aFileName.IsFileWritable() )
{
......
......@@ -117,9 +117,6 @@ enum id_eeschema_frm
ID_POPUP_SCH_ADD_LABEL,
ID_POPUP_SCH_ADD_GLABEL,
ID_POPUP_SCH_GETINFO_MARKER,
// Edit or change image orientation or context menu command IDs.
ID_POPUP_SCH_MIRROR_X_IMAGE,
ID_POPUP_SCH_MIRROR_Y_IMAGE,
ID_POPUP_END_RANGE,
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
......@@ -160,22 +157,21 @@ enum id_eeschema_frm
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
// Change component orientation context menu command IDs.
ID_POPUP_SCH_MIRROR_X_CMP,
ID_POPUP_SCH_MIRROR_Y_CMP,
ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE,
ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE,
ID_POPUP_SCH_ORIENT_NORMAL_CMP,
ID_SELECT_ITEM_START,
ID_SELECT_ITEM_END = ID_SELECT_ITEM_START + MAX_SELECT_ITEM_IDS,
ID_SCH_ROTATE_ITEM,
// Change orientation command IDs.
ID_SCH_MIRROR_X,
ID_SCH_MIRROR_Y,
ID_SCH_ORIENT_NORMAL,
ID_SCH_ROTATE_CLOCKWISE,
ID_SCH_ROTATE_COUNTERCLOCKWISE,
ID_SCH_EDIT_ITEM,
ID_SCH_EDIT_COMPONENT_VALUE,
ID_SCH_EDIT_COMPONENT_REFERENCE,
ID_SCH_EDIT_COMPONENT_FOOTPRINT,
ID_POPUP_SCH_MOVE_ITEM,
ID_SCH_MOVE_ITEM,
ID_SCH_DRAG_ITEM,
// Schematic editor commmands. These are command IDs that are generated by multiple
......
......@@ -59,6 +59,11 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
case FILE_SAVE_AS:
schematicFileName = aScreen->GetFileName();
// Sheet file names are relative to the root sheet path which is the current
// working directory. The IsWritable funtion expects the path to be set.
if( schematicFileName.GetPath().IsEmpty() )
schematicFileName.Assign( wxFileName::GetCwd(), schematicFileName.GetFullName() );
if( aCreateBackupFile )
{
backupFileName = schematicFileName;
......@@ -74,7 +79,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
if( !wxRenameFile( schematicFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg.Printf(_( "Could not save backup of file <%s>" ),
msg.Printf( _( "Could not save backup of file <%s>" ),
GetChars( schematicFileName.GetFullPath() ) );
DisplayError( this, msg );
}
......
......@@ -242,7 +242,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
/*
* Routine to rotate and mirror a component.
*/
void SCH_EDIT_FRAME::OnChangeComponentOrientation( wxCommandEvent& aEvent )
void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
{
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
......@@ -252,31 +252,6 @@ void SCH_EDIT_FRAME::OnChangeComponentOrientation( wxCommandEvent& aEvent )
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
int orientation;
switch( aEvent.GetId() )
{
case ID_POPUP_SCH_MIRROR_X_CMP:
orientation = CMP_MIRROR_X;
break;
case ID_POPUP_SCH_MIRROR_Y_CMP:
orientation = CMP_MIRROR_Y;
break;
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
orientation = CMP_ROTATE_COUNTERCLOCKWISE;
break;
case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE:
orientation = CMP_ROTATE_CLOCKWISE;
break;
case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
default:
orientation = CMP_NORMAL;
}
DrawPanel->MoveCursorToCrossHair();
if( component->GetFlags() == 0 )
......@@ -296,7 +271,7 @@ void SCH_EDIT_FRAME::OnChangeComponentOrientation( wxCommandEvent& aEvent )
else
DrawPanel->RefreshDrawingRect( component->GetBoundingBox() );
component->SetOrientation( orientation );
component->SetOrientation( aOrientation );
/* Redraw the component in the new position. */
if( component->GetFlags() )
......
......@@ -154,11 +154,13 @@ static EDA_HOTKEY HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GR
'I', ID_LINE_COMMENT_BUTT );
static EDA_HOTKEY HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
ID_TEXT_COMMENT_BUTT );
static EDA_HOTKEY HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' );
static EDA_HOTKEY HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' );
static EDA_HOTKEY HkMirrorY( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y',
ID_SCH_MIRROR_Y );
static EDA_HOTKEY HkMirrorX( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X',
ID_SCH_MIRROR_X );
static EDA_HOTKEY HkOrientNormalComponent( wxT( "Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' );
static EDA_HOTKEY HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_ITEM );
HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL );
static EDA_HOTKEY HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE );
static EDA_HOTKEY HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM );
static EDA_HOTKEY HkEditComponentValue( wxT( "Edit Component Value" ),
HK_EDIT_COMPONENT_VALUE, 'V',
......@@ -168,7 +170,7 @@ static EDA_HOTKEY HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
static EDA_HOTKEY HkMove( wxT( "Move Schematic Item" ),
HK_MOVE_COMPONENT_OR_ITEM, 'M',
ID_POPUP_SCH_MOVE_ITEM );
ID_SCH_MOVE_ITEM );
static EDA_HOTKEY HkCopyComponentOrText( wxT( "Copy Component or Label" ),
HK_COPY_COMPONENT_OR_LABEL, 'C',
......@@ -222,8 +224,8 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] =
&HkAddComponent,
&HkAddPower,
&HkRotate,
&HkMirrorXComponent,
&HkMirrorYComponent,
&HkMirrorX,
&HkMirrorY,
&HkOrientNormalComponent,
&HkEdit,
&HkEditComponentValue,
......@@ -440,55 +442,6 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK )
{
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, aDC );
break;
}
if( aItem == NULL )
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::ComponentsOnly );
if( aItem )
{
screen->SetCurItem( (SCH_ITEM*) aItem );
cmd.SetId( ID_POPUP_SCH_MIRROR_Y_CMP );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK ) //allows bloc operation on hotkey
{
HandleBlockEndByPopUp( BLOCK_MIRROR_X, aDC );
break;
}
if( aItem == NULL )
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::ComponentsOnly );
if( aItem )
{
screen->SetCurItem( (SCH_ITEM*) aItem );
cmd.SetId( ID_POPUP_SCH_MIRROR_X_CMP );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
if( aItem == NULL )
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::ComponentsOnly );
if( aItem )
{
screen->SetCurItem( (SCH_ITEM*) aItem );
cmd.SetId( ID_POPUP_SCH_ORIENT_NORMAL_CMP );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_COPY_COMPONENT_OR_LABEL: // Duplicate component or text/label
if( itemInEdit )
break;
......@@ -505,6 +458,9 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
wxPostEvent( this, cmd );
break;
case HK_MIRROR_Y_COMPONENT: // Mirror Y
case HK_MIRROR_X_COMPONENT: // Mirror X
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
case HK_DRAG: // Start drag
case HK_ROTATE: // Rotate schematic item or block.
case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
......
This diff is collapsed.
......@@ -237,11 +237,6 @@ void SCH_BITMAP::Rotate( wxPoint rotationPoint )
}
void SCH_BITMAP::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{
}
bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
......@@ -255,11 +250,6 @@ bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect )
}
void SCH_BITMAP::GetConnectionPoints( vector<wxPoint>& aPoints ) const
{
}
#if defined(DEBUG)
void SCH_BITMAP::Show( int nestLevel, std::ostream& os )
{
......
......@@ -154,14 +154,8 @@ public:
virtual void Rotate( wxPoint rotationPoint );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return false; }
virtual void GetConnectionPoints( vector<wxPoint>& aPoints ) const;
virtual wxString GetSelectMenuText() const { return wxString( _( "Image" ) ); }
virtual BITMAP_DEF GetMenuImage() const { return image_xpm; }
......
......@@ -172,6 +172,13 @@ const KICAD_T SCH_COLLECTOR::SheetsAndSheetLabels[] = {
};
const KICAD_T SCH_COLLECTOR::OrientableItems[] = {
SCH_COMPONENT_T,
SCH_BITMAP_T,
EOT
};
SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, const void* aTestData )
{
if( aItem->Type() != LIB_PIN_T && !aItem->HitTest( m_RefPos ) )
......
......@@ -91,6 +91,11 @@ public:
*/
static const KICAD_T SheetsAndSheetLabels[];
/**
* A scan list for schematic items that can be mirrored.
*/
static const KICAD_T OrientableItems[];
/**
* Constructor SCH_COLLECTOR
*/
......
......@@ -82,8 +82,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_DRAG_BLOCK:
case ID_POPUP_COPY_BLOCK:
case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION:
case ID_POPUP_SCH_ENTER_SHEET:
......@@ -91,8 +89,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION:
case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_GETINFO_MARKER:
case ID_POPUP_SCH_MIRROR_X_IMAGE:
case ID_POPUP_SCH_MIRROR_Y_IMAGE:
/* At this point: Do nothing. these commands do not need to stop the
* current command (mainly a block command) or reset the current state
......@@ -310,16 +306,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetSheetNumberAndCount();
break;
case ID_POPUP_MIRROR_X_BLOCK:
DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
break;
case ID_POPUP_MIRROR_Y_BLOCK:
DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc );
break;
case ID_POPUP_COPY_BLOCK:
DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_COPY, &dc );
......@@ -358,16 +344,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_SCH_MIRROR_X_IMAGE:
if( item )
MirrorImage( (SCH_BITMAP*) item, true );
break;
case ID_POPUP_SCH_MIRROR_Y_IMAGE:
if( item )
MirrorImage( (SCH_BITMAP*) item, false );
break;
default: // Log error:
wxFAIL_MSG( wxString::Format( wxT( "Cannot process command event ID %d" ),
event.GetId() ) );
......@@ -724,10 +700,6 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
if( item == NULL )
{
// If we didn't get here by a hot key, then something has gone wrong.
if( aEvent.GetInt() == 0 )
return;
// Allows block rotate operation on hot key.
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK )
{
......@@ -735,6 +707,10 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
return;
}
// If we didn't get here by a hot key, then something has gone wrong.
if( aEvent.GetInt() == 0 )
return;
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
......@@ -750,9 +726,14 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
switch( item->Type() )
{
case SCH_COMPONENT_T:
aEvent.SetId( ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE );
wxPostEvent( this, aEvent );
return;
if( aEvent.GetId() == ID_SCH_ROTATE_CLOCKWISE )
OrientComponent( CMP_ROTATE_CLOCKWISE );
else if( aEvent.GetId() == ID_SCH_ROTATE_COUNTERCLOCKWISE )
OrientComponent( CMP_ROTATE_COUNTERCLOCKWISE );
else
wxFAIL_MSG( wxT( "Unknown rotate item command ID." ) );
break;
case SCH_TEXT_T:
case SCH_LABEL_T:
......@@ -932,3 +913,74 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// Since the drag is actually a block command, clear the current item.
screen->SetCurItem( NULL );
}
void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
{
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
if( item == NULL )
{
// Allows block rotate operation on hot key.
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK )
{
if( aEvent.GetId() == ID_SCH_MIRROR_X )
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc );
else
wxFAIL_MSG( wxT( "Unknown block oriention command ID." ) );
return;
}
// If we didn't get here by a hot key, then something has gone wrong.
if( aEvent.GetInt() == 0 )
return;
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
item = LocateAndShowItem( data->GetPosition(), SCH_COLLECTOR::OrientableItems,
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
return;
}
switch( item->Type() )
{
case SCH_COMPONENT_T:
if( aEvent.GetId() == ID_SCH_MIRROR_X )
OrientComponent( CMP_MIRROR_X );
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
OrientComponent( CMP_MIRROR_Y );
else if( aEvent.GetId() == ID_SCH_ORIENT_NORMAL )
OrientComponent( CMP_NORMAL );
else
wxFAIL_MSG( wxT( "Invalid orient schematic component command ID." ) );
break;
case SCH_BITMAP_T:
if( aEvent.GetId() == ID_SCH_MIRROR_X )
MirrorImage( (SCH_BITMAP*) item, true );
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
MirrorImage( (SCH_BITMAP*) item, false );
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Schematic object type %s cannot be oriented." ),
GetChars( item->GetClass() ) ) );
}
if( item->GetFlags() == 0 )
screen->SetCurItem( NULL );
}
......@@ -121,25 +121,26 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile )
EVT_TOOL( ID_POPUP_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem )
EVT_TOOL( ID_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem )
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
// Tools and buttons for vertical toolbar.
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::OnSelectTool )
EVT_MENU( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
EVT_MENU( ID_SCH_ROTATE_ITEM, SCH_EDIT_FRAME::OnRotate )
EVT_MENU( ID_SCH_DRAG_ITEM, SCH_EDIT_FRAME::OnDragItem )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_SCH_ROTATE_CLOCKWISE, ID_SCH_ROTATE_COUNTERCLOCKWISE,
SCH_EDIT_FRAME::OnRotate )
EVT_MENU_RANGE( ID_SCH_EDIT_ITEM, ID_SCH_EDIT_COMPONENT_FOOTPRINT,
SCH_EDIT_FRAME::OnEditItem )
EVT_MENU_RANGE( ID_SCH_MIRROR_X, ID_SCH_ORIENT_NORMAL, SCH_EDIT_FRAME::OnOrient )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
SCH_EDIT_FRAME::Process_Special_Functions )
// Tools and buttons options toolbar
EVT_TOOL( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnSelectOptionToolbar )
......@@ -151,8 +152,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
SCH_EDIT_FRAME::OnSelectUnit )
EVT_MENU_RANGE( ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
SCH_EDIT_FRAME::OnConvertTextType )
EVT_MENU_RANGE( ID_POPUP_SCH_MIRROR_X_CMP, ID_POPUP_SCH_ORIENT_NORMAL_CMP,
SCH_EDIT_FRAME::OnChangeComponentOrientation )
// Multple item selection context menu commands.
EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, SCH_EDIT_FRAME::OnSelectItem )
......@@ -518,7 +517,7 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
}
void SCH_EDIT_FRAME::OnModify( )
void SCH_EDIT_FRAME::OnModify()
{
GetScreen()->SetModify();
GetScreen()->SetSave();
......@@ -707,7 +706,9 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
ExecuteFile( this, PCBNEW_EXE, filename );
}
else
{
ExecuteFile( this, PCBNEW_EXE );
}
}
......@@ -722,7 +723,9 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) );
}
else
{
ExecuteFile( this, CVPCB_EXE );
}
}
......@@ -745,8 +748,8 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
if( event.GetId() == ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP )
{
SCH_ITEM* item = GetScreen()->GetCurItem();
if( (item == NULL) || (item->GetFlags() != 0) ||
( item->Type() != SCH_COMPONENT_T ) )
if( (item == NULL) || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
{
wxMessageBox( _("Error: not a component or no component" ) );
return;
......@@ -759,18 +762,24 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
{
if( m_LibeditFrame->IsIconized() )
m_LibeditFrame->Iconize( false );
m_LibeditFrame->Raise();
}
else
{
m_LibeditFrame = new LIB_EDIT_FRAME( this,
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
}
if( component )
{
LIB_ALIAS* entry = CMP_LIBRARY::FindLibraryEntry( component->GetLibName() );
if( entry == NULL ) // Should not occur
return;
CMP_LIBRARY* library = entry->GetLibrary();
m_LibeditFrame->LoadComponentAndSelectLib( entry, library );
}
......
......@@ -65,7 +65,7 @@ class wxFindReplaceData;
/* enum used in RotationMiroir() */
enum fl_rot_cmp {
enum COMPONENT_ORIENTATION_T {
CMP_NORMAL, // Normal orientation, no rotation or mirror
CMP_ROTATE_CLOCKWISE, // Rotate -90
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
......@@ -625,7 +625,8 @@ private:
/**
* Function OnRotate
* handles the #ID_SCH_ROTATE_ITEM event used to rotate schematic itams and blocks.
* handles the #ID_SCH_ROTATE_CLOCKWISE and #ID_SCH_ROTATE_COUNTERCLOCKWISE events
* used to rotate schematic itams and blocks.
*/
void OnRotate( wxCommandEvent& aEvent );
......@@ -641,6 +642,13 @@ private:
*/
void OnDragItem( wxCommandEvent& aEvent );
/**
* Function OnOrient
* handles the #ID_SCH_MIRROR_X, #ID_SCH_MIRROR_Y, and #ID_SCH_ORIENT_NORMAL events
* used to orient schematic itams and blocks.
*/
void OnOrient( wxCommandEvent& aEvent );
void OnExit( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
......@@ -852,7 +860,7 @@ private:
void EditComponent( SCH_COMPONENT* aComponent );
public:
void OnChangeComponentOrientation( wxCommandEvent& aEvent );
void OrientComponent( COMPONENT_ORIENTATION_T aOrientation = CMP_NORMAL );
private:
void OnSelectUnit( wxCommandEvent& aEvent );
......
......@@ -329,11 +329,16 @@ public:
* Function IsWritable
* checks if \a aFileName can be written.
* <p>
* The function performs a number of tests on \a aFileName to verify that it can
* be saved. The file name is tested for validity and if the user has write
* permissions.
* The function performs a number of tests on \a aFileName to verify that it
* can be saved. If \a aFileName defines a path with no file name, them the
* path is tested for user write permission. If \a aFileName defines a file
* name that does not exist in the path, the path is tested for user write
* permission. If \a aFileName defines a file that already exits, the file
* name is tested for user write permissions.
* </p>
*
* @note The file name path must be set or an assertion will be raised on debug
* builds and return false on release builds.
* @param aFileName The full path and/or file name of the file to test.
* @return False if \a aFileName cannot be written.
*/
......
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