mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot get disassociated from their true PROJECT. *) Allow loading eeschema library editor from kicad.exe *) Allow loading pcbnew library editor from kicad.exe *) Rename LIB_COMPONENT to LIB_PART. *) Add class PART_LIBS, and PART_LIB. *) Make PART_LIBS non-global, i.e. PROJECT specific. *) Implement "data on demand" for PART_LIBS *) Implement "data on demand" for schematic SEARCH_STACK. *) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited. *) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use a weak pointer. *) Remove all chdir() calls so projects don't need to be CWD. *) Romove APPEND support from OpenProjectFiles(). *) Make OpenProjectFiles() robust, even for creating new projects. *) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open, and save them in the .eeschema config file, not in the project file. *) Fix bug with wxDir() while accessing protected dirs in kicad.exe *) Consolidate template copying into PROJECT class, not in kicad.exe source. *) Generally untangle eeschema, making its libraries not global but rather held in the PROJECT.
110 lines
2.6 KiB
C++
110 lines
2.6 KiB
C++
/********************************************/
|
|
/* library editor: undo and redo functions */
|
|
/********************************************/
|
|
|
|
#include <fctsys.h>
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <general.h>
|
|
#include <protos.h>
|
|
#include <libeditframe.h>
|
|
#include <class_libentry.h>
|
|
|
|
|
|
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag )
|
|
{
|
|
LIB_PART* CopyItem;
|
|
PICKED_ITEMS_LIST* lastcmd;
|
|
|
|
CopyItem = new LIB_PART( * (LIB_PART*) ItemToCopy );
|
|
|
|
// Clear current flags (which can be temporary set by a current edit command).
|
|
CopyItem->ClearStatus();
|
|
|
|
lastcmd = new PICKED_ITEMS_LIST();
|
|
ITEM_PICKER wrapper( CopyItem, UR_LIBEDIT );
|
|
lastcmd->PushItem(wrapper);
|
|
GetScreen()->PushCommandToUndoList( lastcmd );
|
|
|
|
// Clear redo list, because after new save there is no redo to do.
|
|
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
|
|
}
|
|
|
|
|
|
void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
|
{
|
|
if( GetScreen()->GetRedoCommandCount() <= 0 )
|
|
return;
|
|
|
|
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
ITEM_PICKER wrapper( part, UR_LIBEDIT );
|
|
|
|
lastcmd->PushItem( wrapper );
|
|
GetScreen()->PushCommandToUndoList( lastcmd );
|
|
|
|
lastcmd = GetScreen()->PopCommandFromRedoList();
|
|
|
|
wrapper = lastcmd->PopItem();
|
|
|
|
part = (LIB_PART*) wrapper.GetItem();
|
|
|
|
SetCurPart( part );
|
|
|
|
if( !part )
|
|
return;
|
|
|
|
if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
|
|
m_aliasName = part->GetName();
|
|
|
|
m_drawItem = NULL;
|
|
UpdateAliasSelectList();
|
|
UpdatePartSelectList();
|
|
SetShowDeMorgan( part->HasConversion() );
|
|
DisplayLibInfos();
|
|
DisplayCmpDoc();
|
|
OnModify();
|
|
m_canvas->Refresh();
|
|
}
|
|
|
|
|
|
void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
|
|
{
|
|
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
|
return;
|
|
|
|
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
ITEM_PICKER wrapper( part, UR_LIBEDIT );
|
|
|
|
lastcmd->PushItem( wrapper );
|
|
GetScreen()->PushCommandToRedoList( lastcmd );
|
|
|
|
lastcmd = GetScreen()->PopCommandFromUndoList();
|
|
|
|
wrapper = lastcmd->PopItem();
|
|
|
|
part = (LIB_PART* ) wrapper.GetItem();
|
|
|
|
SetCurPart( part );
|
|
|
|
if( !part )
|
|
return;
|
|
|
|
if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) )
|
|
m_aliasName = part->GetName();
|
|
|
|
m_drawItem = NULL;
|
|
UpdateAliasSelectList();
|
|
UpdatePartSelectList();
|
|
SetShowDeMorgan( part->HasConversion() );
|
|
DisplayLibInfos();
|
|
DisplayCmpDoc();
|
|
OnModify();
|
|
m_canvas->Refresh();
|
|
}
|