New EESchema find dialog and other minor fixes.

* Replaced find dialog with wxFormBuilder version.
* New find dialog is modeless, supports more advanced search features,
  remembers it's last position, size, search history, and search settings,
  and implements initial support for replacing.
* Added Shift+F5 hot key to search for next DRC marker.  F5 now just
  repeats previous search.
* Minor cosmetic enhancements to label edit dialog.
* Remove tab from grid size text printf to fix toolbar grid combobox
  display in wxGTK.
* Updated my TODO list items.
This commit is contained in:
stambaughw 2010-03-16 18:22:59 +00:00
parent 8931b1fcfe
commit 1bbc009da8
48 changed files with 2830 additions and 2526 deletions

View File

@ -45,11 +45,6 @@ C2) Write a tool to generate DSNLEXER keyword tables (and enums) as *.cpp and
CMake. CMake.
Wayne:
C1) Fix mouse wheel scrolling (ctrl + Mouse wheel) and (Shift + mouse wheel)
to move more than a single scroll increment.
CvPCB CvPCB
----- -----
* Preview of the already assigned footprint. * Preview of the already assigned footprint.
@ -61,8 +56,18 @@ EESchema
* Drag and drop between two EESchema windows. * Drag and drop between two EESchema windows.
Wayne: Wayne:
E1) Relpace find dialog with wxFormBuilder version using a modeless dialog E2) Finish adding replace capability to new Find dialog.
and event driven design similar to wxFindReplaceDialog implementation. E3) Hook up perform last library search hot key to replace search libraries for
component support removed from find dialog.
E4) Change add component dialog search text control to combobox and add component
search history save and restore capability. Also add session save and restore
to component history list control. Add advanced search capability similar to
new find dialog.
E5) Make escape key work correctly in add component dialog.
E6) Start initial work for changing component library file format to use Dick's
dsnlexer. See note C2 above. Come up with a workable library file format to
handle the wishes of the library implementation group. Add initial clipboard
support to the library editor.
GerbView GerbView
@ -118,27 +123,3 @@ L8) LAYER_WIDGET::GetBestSize() needs platform independence.
L9) On board load, ReFill() is called, this should also update the Render L9) On board load, ReFill() is called, this should also update the Render
checkboxes and colors. checkboxes and colors.
Use wxDC for coordinate scaling and offsetting fix. (Wayne)
------------------------------------------------------------
W1) Make wxAutoBufferedPaintDC function properly.
W2) Make bitmap grid drawing method function properly or figure out a more
efficient method for drawing the grid.
W3) Use one cursor position (preferrably logical (drawing) units) instead
of keeping track of both logical and device cursor positions at the same
time.
W4) Figure out why none of the apps render correctly using wxGCDC on Windows.
** After (if?) new code accepted as project default: **
W6) Remove all old coordinate scaling and offset code from Kicad.
W7) Remove conditional compilation pragmas and dead code paths.
W8) Remove redundant drawing helper functions from gr_basic.cpp.
W9) Remove all global variables used by old drawing code.

View File

@ -221,33 +221,40 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size,
} }
wxString ReturnUnitSymbol( int Units ) wxString ReturnUnitSymbol( int aUnits, const wxString& formatString )
{ {
wxString tmp;
wxString label; wxString label;
switch( Units ) switch( aUnits )
{ {
case INCHES: case INCHES:
label = _( " (\"):" ); tmp = _( "\"" );
break; break;
case MILLIMETRE: case MILLIMETRE:
label = _( " (mm):" ); tmp = _( "mm" );
break; break;
default: default:
tmp = _( "??" );
break; break;
} }
if( formatString.IsEmpty() )
return tmp;
label.Printf( formatString, GetChars( tmp ) );
return label; return label;
} }
wxString GetUnitsLabel( int units ) wxString GetUnitsLabel( int aUnits )
{ {
wxString label; wxString label;
switch( units ) switch( aUnits )
{ {
case INCHES: case INCHES:
label = _( "inches" ); label = _( "inches" );
@ -260,6 +267,7 @@ wxString GetUnitsLabel( int units )
case CENTIMETRE: case CENTIMETRE:
label = _( "centimeters" ); label = _( "centimeters" );
break; break;
default: default:
label = _( "Unknown" ); label = _( "Unknown" );
break; break;
@ -268,6 +276,34 @@ wxString GetUnitsLabel( int units )
return label; return label;
} }
wxString GetAbbreviatedUnitsLabel( int aUnits )
{
wxString label;
switch( aUnits )
{
case INCHES:
label = _( "in" );
break;
case MILLIMETRE:
label = _( "mm" );
break;
case CENTIMETRE:
label = _( "cm" );
break;
default:
label = _( "??" );
break;
}
return label;
}
/* /*
* Add string " (mm):" or " ("):" to the static text Stext. * Add string " (mm):" or " ("):" to the static text Stext.
* Used in dialog boxes for entering values depending on selected units * Used in dialog boxes for entering values depending on selected units

View File

@ -15,6 +15,9 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "../eeschema/dialog_schematic_find.h"
/* Constructor and destructor for SCH_ITEM */ /* Constructor and destructor for SCH_ITEM */
/* They are not inline because this creates problems with gcc at linking time /* They are not inline because this creates problems with gcc at linking time
* in debug mode * in debug mode
@ -60,3 +63,26 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
} }
} }
bool SCH_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
{
wxString text = aText;
wxString searchText = aSearchData.GetFindString();
if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
{
if( aSearchData.GetFlags() & wxFR_MATCHCASE )
return text.Matches( searchText );
return text.MakeUpper().Matches( searchText.MakeUpper() );
}
if( aSearchData.GetFlags() & wxFR_MATCHCASE )
return aText.Find( searchText ) != wxNOT_FOUND;
return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}

View File

@ -247,10 +247,10 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
else else
{ {
if( g_UnitMetric == 0 ) // inches if( g_UnitMetric == 0 ) // inches
msg.Printf( wxT( "%.1f mils\t(%.3f mm)" ), msg.Printf( wxT( "%.1f mils, (%.3f mm)" ),
gridValueInch * 1000, gridValue_mm ); gridValueInch * 1000, gridValue_mm );
else else
msg.Printf( wxT( "%.3f mm\t(%.1f mils)" ), msg.Printf( wxT( "%.3f mm, (%.1f mils)" ),
gridValue_mm, gridValueInch * 1000 ); gridValue_mm, gridValueInch * 1000 );
} }
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true ); gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );

View File

@ -56,7 +56,6 @@ set(EESCHEMA_SRCS
dialog_eeschema_options.cpp dialog_eeschema_options.cpp
dialog_erc.cpp dialog_erc.cpp
dialog_erc_base.cpp dialog_erc_base.cpp
# dialog_find.cpp
dialog_lib_edit_draw_item.cpp dialog_lib_edit_draw_item.cpp
dialog_lib_edit_draw_item_base.cpp dialog_lib_edit_draw_item_base.cpp
dialog_lib_edit_pin.cpp dialog_lib_edit_pin.cpp
@ -67,6 +66,8 @@ set(EESCHEMA_SRCS
dialog_print_using_printer.cpp dialog_print_using_printer.cpp
dialog_sch_sheet_props.cpp dialog_sch_sheet_props.cpp
dialog_sch_sheet_props_base.cpp dialog_sch_sheet_props_base.cpp
dialog_schematic_find.cpp
dialog_schematic_find_base.cpp
dialog_SVG_print.cpp dialog_SVG_print.cpp
dialog_SVG_print_base.cpp dialog_SVG_print_base.cpp
edit_component_in_lib.cpp edit_component_in_lib.cpp

View File

@ -694,6 +694,15 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position )
} }
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData )
{
if( !SCH_ITEM::Matches( m_SheetName, aSearchData ) )
return SCH_ITEM::Matches( m_FileName, aSearchData );
return true;
}
#if defined(DEBUG) #if defined(DEBUG)
void SCH_SHEET::Show( int nestLevel, std::ostream& os ) void SCH_SHEET::Show( int nestLevel, std::ostream& os )
{ {

View File

@ -28,9 +28,10 @@ public:
// m_Number >= 2 // m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename // value 0 is for sheet name and 1 for sheet filename
public: SCH_SHEET_PIN( SCH_SHEET* parent, public:
const wxPoint& pos = wxPoint( 0, 0 ), SCH_SHEET_PIN( SCH_SHEET* parent,
const wxString& text = wxEmptyString ); const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~SCH_SHEET_PIN() { } ~SCH_SHEET_PIN() { }
@ -107,6 +108,14 @@ public: SCH_SHEET_PIN( SCH_SHEET* parent,
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
} }
/**
* Compare schematic sheet entry (pin?) name against search string.
*
* @param aSearchData - Criteria to search against.
* @return True if this item matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
}; };
@ -308,6 +317,16 @@ public:
*/ */
virtual void Mirror_Y( int aYaxis_position ); virtual void Mirror_Y( int aYaxis_position );
/**
* Compare schematic sheet file and sheet name against search string.
*
* @param aSearchData - Criteria to search against.
* @param aCaseSensitive - True for case sensitive search.
* @param aWholeWord - True to match whole word.
* @return True if this item matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
#if defined(DEBUG) #if defined(DEBUG)
// comment inherited by Doxygen from Base_Struct // comment inherited by Doxygen from Base_Struct

View File

@ -1,5 +1,4 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp // Name: class_drawsheet.cpp
// Purpose: member functions for SCH_SHEET // Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h // header = class_drawsheet.h
@ -13,6 +12,9 @@
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "general.h" #include "general.h"
#include "dlist.h"
#include "dialog_schematic_find.h"
/**********************************************/ /**********************************************/
@ -34,9 +36,7 @@ SCH_SHEET_PATH::SCH_SHEET_PATH()
* @param aPath = path of the sheet to reach (in non human readable format) * @param aPath = path of the sheet to reach (in non human readable format)
* @return true if success else false * @return true if success else false
*/ */
bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound )
const wxString& aPath,
bool aFound )
{ {
if( aFound ) if( aFound )
return true; return true;
@ -129,6 +129,29 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
} }
SCH_ITEM* SCH_SHEET_PATH::FirstDrawList()
{
SCH_ITEM* item = NULL;
if( m_numSheets && m_sheets[0]->m_AssociatedScreen )
item = m_sheets[0]->m_AssociatedScreen->EEDrawList;
/* @fixme - These lists really should be one of the boost pointer containers. This
* is a brain dead hack to allow reverse iteration of EDA_BaseStruct linked
* list.
*/
SCH_ITEM* lastItem = NULL;
while( item != NULL )
{
lastItem = item;
item = item->Next();
}
return lastItem;
}
/** Function Push /** Function Push
* store (push) aSheet in list * store (push) aSheet in list
* @param aSheet = pointer to the SCH_SHEET to store in list * @param aSheet = pointer to the SCH_SHEET to store in list
@ -136,8 +159,11 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
void SCH_SHEET_PATH::Push( SCH_SHEET* aSheet ) void SCH_SHEET_PATH::Push( SCH_SHEET* aSheet )
{ {
if( m_numSheets > DSLSZ ) if( m_numSheets > DSLSZ )
wxMessageBox( wxT( "SCH_SHEET_PATH::Push() error: no room in buffer \ {
to store sheet" ) ); wxString msg;
msg.Printf( _( "Schematic sheets can only be nested %d levels deep." ), DSLSZ );
wxMessageBox( msg );
}
if( m_numSheets < DSLSZ ) if( m_numSheets < DSLSZ )
{ {
@ -225,6 +251,105 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
} }
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
{
bool hasWrapped = false;
bool firstItemFound = false;
SCH_ITEM* drawItem = LastDrawList();
while( drawItem != NULL )
{
if( drawItem->Type() == aType )
{
if( aLastItem == NULL || firstItemFound )
{
return drawItem;
}
else if( !firstItemFound && drawItem == aLastItem )
{
firstItemFound = true;
}
}
drawItem = drawItem->Next();
if( drawItem == NULL && aLastItem && aWrap && !hasWrapped )
{
hasWrapped = true;
drawItem = LastDrawList();
}
}
return NULL;
}
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
{
bool hasWrapped = false;
bool firstItemFound = false;
SCH_ITEM* drawItem = FirstDrawList();
while( drawItem != NULL )
{
if( drawItem->Type() == aType )
{
if( aLastItem == NULL || firstItemFound )
{
return drawItem;
}
else if( !firstItemFound && drawItem == aLastItem )
{
firstItemFound = true;
}
}
drawItem = drawItem->Back();
if( drawItem == NULL && aLastItem && aWrap && !hasWrapped )
{
hasWrapped = true;
drawItem = FirstDrawList();
}
}
return NULL;
}
SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData,
SCH_ITEM* aLastItem )
{
bool hasWrapped = false;
bool firstItemFound = false;
bool wrap = ( aSearchData.GetFlags() & FR_SEARCH_WRAP ) != 0;
SCH_ITEM* drawItem = LastDrawList();
while( drawItem != NULL )
{
if( aLastItem && !firstItemFound )
{
firstItemFound = ( drawItem == aLastItem );
}
else
{
if( drawItem->Matches( aSearchData ) )
return drawItem;
}
drawItem = drawItem->Next();
if( drawItem == NULL && aLastItem && firstItemFound && wrap && !hasWrapped )
{
hasWrapped = true;
drawItem = LastDrawList();
}
}
return NULL;
}
bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 ) bool SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 )
{ {
m_numSheets = d1.m_numSheets; m_numSheets = d1.m_numSheets;
@ -315,6 +440,28 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetNext()
} }
SCH_SHEET_PATH* SCH_SHEET_LIST::GetLast()
{
if( GetCount() == 0 )
return NULL;
m_index = GetCount() - 1;
return GetSheet( m_index );
}
SCH_SHEET_PATH* SCH_SHEET_LIST::GetPrevious()
{
if( m_index == 0 )
return NULL;
m_index -= 1;
return GetSheet( m_index );
}
/** Function GetSheet /** Function GetSheet
* @return the item (sheet) in aIndex position in m_List or NULL if less than * @return the item (sheet) in aIndex position in m_List or NULL if less than
* index items * index items
@ -372,3 +519,137 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
m_currList.Pop(); m_currList.Pop();
} }
SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn,
SCH_ITEM* aLastItem, bool aWrap )
{
bool hasWrapped = false;
bool firstItemFound = false;
SCH_ITEM* drawItem = NULL;
SCH_SHEET_PATH* sheet = GetFirst();
while( sheet != NULL )
{
drawItem = sheet->LastDrawList();
while( drawItem != NULL )
{
if( drawItem->Type() == aType )
{
if( aLastItem == NULL || firstItemFound )
{
if( aSheetFoundIn )
*aSheetFoundIn = sheet;
return drawItem;
}
else if( !firstItemFound && drawItem == aLastItem )
{
firstItemFound = true;
}
}
drawItem = drawItem->Next();
}
sheet = GetNext();
if( sheet == NULL && aLastItem && aWrap && !hasWrapped )
{
hasWrapped = true;
sheet = GetFirst();
}
}
return NULL;
}
SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn,
SCH_ITEM* aLastItem, bool aWrap )
{
bool hasWrapped = false;
bool firstItemFound = false;
SCH_ITEM* drawItem = NULL;
SCH_SHEET_PATH* sheet = GetLast();
while( sheet != NULL )
{
drawItem = sheet->FirstDrawList();
while( drawItem != NULL )
{
if( drawItem->Type() == aType )
{
if( aLastItem == NULL || firstItemFound )
{
if( aSheetFoundIn )
*aSheetFoundIn = sheet;
return drawItem;
}
else if( !firstItemFound && drawItem == aLastItem )
{
firstItemFound = true;
}
}
drawItem = drawItem->Back();
}
sheet = GetPrevious();
if( sheet == NULL && aLastItem && aWrap && !hasWrapped )
{
hasWrapped = true;
sheet = GetLast();
}
}
return NULL;
}
SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData,
SCH_SHEET_PATH** aSheetFoundIn,
SCH_ITEM* aLastItem )
{
bool hasWrapped = false;
bool firstItemFound = false;
bool wrap = ( aSearchData.GetFlags() & FR_SEARCH_WRAP ) != 0;
SCH_ITEM* drawItem = NULL;
SCH_SHEET_PATH* sheet = GetFirst();
while( sheet != NULL )
{
drawItem = sheet->LastDrawList();
while( drawItem != NULL )
{
if( aLastItem && !firstItemFound )
{
firstItemFound = ( drawItem == aLastItem );
}
else
{
if( drawItem->Matches( aSearchData ) )
{
if( aSheetFoundIn )
*aSheetFoundIn = sheet;
return drawItem;
}
}
drawItem = drawItem->Next();
}
sheet = GetNext();
if( sheet == NULL && aLastItem && firstItemFound && wrap && !hasWrapped )
{
hasWrapped = true;
sheet = GetFirst();
}
}
return NULL;
}

View File

@ -50,6 +50,9 @@
*/ */
class SCH_MARKER;
/****************************************/ /****************************************/
/* class to handle and access to a sheet */ /* class to handle and access to a sheet */
/* a 'path' so to speak.. */ /* a 'path' so to speak.. */
@ -72,9 +75,11 @@ public:
#define DSLSZ 32 // Max number of levels for a sheet path #define DSLSZ 32 // Max number of levels for a sheet path
SCH_SHEET * m_sheets[DSLSZ]; SCH_SHEET * m_sheets[DSLSZ];
public: SCH_SHEET_PATH(); public:
SCH_SHEET_PATH();
~SCH_SHEET_PATH() { }; ~SCH_SHEET_PATH() { };
void Clear()
void Clear()
{ {
m_numSheets = 0; m_numSheets = 0;
} }
@ -110,6 +115,14 @@ public: SCH_SHEET_PATH();
*/ */
SCH_ITEM* LastDrawList(); SCH_ITEM* LastDrawList();
/**
* Get the last schematic item relative to the first sheet in the list.
*
* @return Last schematic item relative to the first sheet in the list if list
* is not empty. Otherwise NULL.
*/
SCH_ITEM* FirstDrawList();
/** Function Push /** Function Push
* store (push) aSheet in list * store (push) aSheet in list
* @param aSheet = pointer to the SCH_SHEET to store in list * @param aSheet = pointer to the SCH_SHEET to store in list
@ -161,6 +174,39 @@ public: SCH_SHEET_PATH();
*/ */
void UpdateAllScreenReferences(); void UpdateAllScreenReferences();
/**
* Find the next schematic item in this sheet ojbect.
*
* @param aType - The type of schematic item object to search for.
* @param aLastItem - Start search from aLastItem. If no aLastItem, search from
* the beginning of the list.
* @param aWrap - Wrap around the end of the list to find the next item if aLastItem
* is defined.
* @return - The next schematic item if found. Otherwise, NULL is returned.
*/
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
/**
* Find the previous schematic item in this sheet path object.
*
* @param aItemType - The type of schematic item object to search for.
* @param aLastItem - Start search from aLastItem. If no aLastItem, search from
* the end of the list.
* @param aWrap - Wrap around the beginning of the list to find the next item if aLastItem
* is defined.
* @return - The previous schematic item if found. Otherwise, NULL is returned.
*/
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
/**
* Search this sheet path for the next item that matches the search criteria.
*
* @param aSearchData - Criteria to search item against.
* @param aLastItem - Find next item after aLastItem if not NULL.
* @return If found, Returns the next schematic item. Otherwise, returns NULL.
*/
SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem = NULL );
bool operator=( const SCH_SHEET_PATH& d1 ); bool operator=( const SCH_SHEET_PATH& d1 );
bool operator==( const SCH_SHEET_PATH& d1 ); bool operator==( const SCH_SHEET_PATH& d1 );
@ -228,6 +274,21 @@ public:
*/ */
SCH_SHEET_PATH* GetNext(); SCH_SHEET_PATH* GetNext();
/**
* Get the last sheet in the sheet list.
*
* @return Last sheet in the list or NULL if sheet list is empty.
*/
SCH_SHEET_PATH* GetLast();
/**
* Get the previous sheet in the sheet list.
*
* @return The previous sheet in the sheet list or NULL if already at the
* beginning of the list.
*/
SCH_SHEET_PATH* GetPrevious();
/** Function GetSheet /** Function GetSheet
* @return the item (sheet) in aIndex position in m_List or NULL if less * @return the item (sheet) in aIndex position in m_List or NULL if less
* than index items * than index items
@ -235,6 +296,45 @@ public:
*/ */
SCH_SHEET_PATH* GetSheet( int aIndex ); SCH_SHEET_PATH* GetSheet( int aIndex );
/**
* Search the entire schematic for the next schematic object.
*
* @param aType - The type of schematic item to find.
* @param aSheetFound - The sheet the item was found in. NULL if the next item
* is not found.
* @param aLastItem - Find next item after aLastItem if not NULL.
* @param aWrap - Wrap past around the end of the list of sheets.
* @return If found, Returns the next schematic item. Otherwise, returns NULL.
*/
SCH_ITEM* FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL,
SCH_ITEM* aLastItem = NULL, bool aWrap = true );
/**
* Search the entire schematic for the previous schematic item.
*
* @param aType - The type of schematic item to find.
* @param aSheetFound - The sheet the item was found in. NULL if the previous item
* is not found.
* @param aLastItem - Find the previous item before aLastItem if not NULL.
* @param aWrap - Wrap past around the beginning of the list of sheets.
* @return If found, the previous schematic item. Otherwise, NULL.
*/
SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL,
SCH_ITEM* aLastItem = NULL, bool aWrap = true );
/**
* Search the entire schematic for the next item that matches the search criteria.
*
* @param aSearchData - Criteria to search item against.
* @param aSheetFound - The sheet the item was found in. NULL if the next item
* is not found.
* @param aLastItem - Find next item after aLastItem if not NULL.
* @return If found, Returns the next schematic item. Otherwise, returns NULL.
*/
SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData,
SCH_SHEET_PATH** aSheetFound = NULL,
SCH_ITEM* aLastItem = NULL );
private: private:
/** Function BuildSheetList /** Function BuildSheetList

View File

@ -219,6 +219,12 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
} }
bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData )
{
return SCH_ITEM::Matches( m_Text, aSearchData );
}
#if defined(DEBUG) #if defined(DEBUG)
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os ) void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
{ {

View File

@ -252,19 +252,23 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
continue; continue;
LIB_COMPONENT* cparent = alias->GetComponent(); LIB_COMPONENT* cparent = alias->GetComponent();
if( cparent == NULL || // Lib error, should not occurs if( cparent == NULL || // Lib error, should not occur.
( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) ) ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) )
{ {
if( cparent )
msg = cparent->GetName();
else
msg = _( "unknown" );
wxString msg1; wxString msg1;
wxString parentName; wxString parentName;
if( cparent ) if( cparent )
parentName = cparent->GetName(); parentName = cparent->GetName();
else else
parentName = _("not found"); parentName = _("not found");
msg1.Printf( _("alias <%s> already exists and has root name<%s>"), msg1.Printf( _( "alias <%s> already exists and has root name<%s>" ),
GetChars( alias->GetName() ), GetChars( alias->GetName() ),
GetChars( parentName ) ); GetChars( parentName ) );
msg << msg1 << wxT("\n"); msg << msg1 << wxT( "\n" );
conflict_count++; conflict_count++;
} }
@ -278,10 +282,10 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
wxString msg1; wxString msg1;
title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName())); title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName()));
msg1.Printf( _("and appears in alias list of current component <%s>." ), msg1.Printf( _("and appears in alias list of current component <%s>." ),
GetChars( newCmp->GetName() ) ); GetChars( newCmp->GetName() ) );
msg << wxT("\n\n") << msg1; msg << wxT( "\n\n" ) << msg1;
msg << wxT("\n\n") << _("All old aliases will be removed. Continue ?"); msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" );
int diag = wxMessageBox(msg, title, wxYES | wxICON_QUESTION); int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION );
if( diag != wxYES ) if( diag != wxYES )
return NULL; return NULL;
} }
@ -299,7 +303,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
} }
else else
{ {
LIB_COMPONENT* cparent = alias->GetComponent(); LIB_COMPONENT* cparent = alias->GetComponent();
if( cparent == NULL || // Lib error, should not occurs if( cparent == NULL || // Lib error, should not occurs
( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) ) ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) )

View File

@ -114,6 +114,15 @@ void SCH_MARKER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData )
{
if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) )
return SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData );
return true;
}
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display purposes.

View File

@ -99,6 +99,14 @@ public:
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
} }
/**
* Compare DRC marker main and auxilary text against search string.
*
* @param aSearchData - Criteria to search against.
* @return True if the DRC main or auxiliary text matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif

View File

@ -418,3 +418,9 @@ void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
frame->OnModify( ); frame->OnModify( );
frame->SetCurrentField( NULL ); frame->SetCurrentField( NULL );
} }
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData )
{
return SCH_ITEM::Matches( m_Text, aSearchData );
}

View File

@ -114,6 +114,14 @@ public:
* this function is only needed by the virtual pure function of the * this function is only needed by the virtual pure function of the
* master class */ * master class */
} }
/**
* Compare schematic field text against search string.
*
* @param aSearchData - Criteria to search against.
* @return True if this field text matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
}; };

View File

@ -12,6 +12,7 @@
#include "macros.h" #include "macros.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_schematic_find.h"
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
@ -1150,3 +1151,23 @@ void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
GetField( ii )->m_Pos.x -= dx; GetField( ii )->m_Pos.x -= dx;
} }
} }
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData )
{
if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS ) )
{
if( !GetField( REFERENCE )->Matches( aSearchData ) )
return GetField( VALUE )->Matches( aSearchData );
return true;
}
for( size_t i = 0; i < NUMBER_OF_FIELDS; i++ )
{
if( GetField( i )->Matches( aSearchData ) )
return true;
}
return false;
}

View File

@ -349,6 +349,14 @@ public:
*/ */
virtual void Mirror_Y(int aYaxis_position); virtual void Mirror_Y(int aYaxis_position);
/**
* Compare schematic component reference and value fields against search string.
*
* @param aSearchData - Criteria to search against.
* @return True if this component reference or value field matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
#if defined (DEBUG) #if defined (DEBUG)
/** /**

View File

@ -181,6 +181,12 @@ wxPoint SCH_TEXT::GetSchematicTextOffset()
} }
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData )
{
return SCH_ITEM::Matches( m_Text, aSearchData );
}
/** function GetSchematicTextOffset (virtual) /** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself * @return the offset between the SCH_TEXT position and the text itself
* position * position

View File

@ -145,6 +145,14 @@ public:
*/ */
virtual void Mirror_Y( int aYaxis_position ); virtual void Mirror_Y( int aYaxis_position );
/**
* Compare schematic text entry against search string.
*
* @param aSearchData - Criterial to search against.
* @return True if this schematic text item matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );

View File

@ -1,5 +1,4 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.cpp // Name: dialog_edit_label.cpp
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
@ -19,31 +18,32 @@
#include "dialog_edit_label.h" #include "dialog_edit_label.h"
/*************************************************************************/
void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct )
{
/*************************************************************************/
/* Edit the properties of the text (Label, Global label, graphic text).. ) /* Edit the properties of the text (Label, Global label, graphic text).. )
* pointed by "TextStruct" * pointed by "aTextStruct"
*/ */
if( TextStruct == NULL ) void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* aTextItem )
{
if( aTextItem == NULL )
return; return;
DialogLabelEditor dialog( this, TextStruct ); DialogLabelEditor dialog( this, aTextItem );
dialog.ShowModal();
dialog.ShowModal();
} }
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* aParent, SCH_TEXT* aTextItem ) :
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) : DialogLabelEditor_Base( aParent )
DialogLabelEditor_Base( parent )
{ {
m_Parent = parent; m_Parent = aParent;
m_CurrentText = CurrentText; m_CurrentText = aTextItem;
InitDialog(); InitDialog();
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
Layout();
Fit();
SetMinSize( GetBestSize() );
Centre(); Centre();
} }
@ -51,22 +51,26 @@ DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* C
void DialogLabelEditor::InitDialog() void DialogLabelEditor::InitDialog()
{ {
wxString msg; wxString msg;
bool multine = false; bool multiLine = false;
if( m_CurrentText->m_MultilineAllowed ) if( m_CurrentText->m_MultilineAllowed )
{ {
m_TextLabel = m_textCtrlMultiline; /* Multiline text edit control must be created because changing the text
m_TextLabelSingleline->Show(false); * control style to multiline must be done when the control is created.
multine = true; */
} m_textControlSizer->Detach( m_textLabel );
else m_textLabel->Destroy();
{ m_textLabel = NULL;
m_TextLabel = m_TextLabelSingleline; m_textLabel = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
m_textCtrlMultiline->Show(false); wxDefaultSize, wxTE_MULTILINE | wxTE_PROCESS_ENTER );
m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
m_textLabel->SetMinSize( wxSize( -1, 60 ) );
m_textControlSizer->Insert( 1, m_textLabel, 0, wxLEFT | wxEXPAND, 3 );
multiLine = true;
} }
m_TextLabel->SetValue( m_CurrentText->m_Text ); m_textLabel->SetValue( m_CurrentText->m_Text );
m_TextLabel->SetFocus(); m_textLabel->SetFocus();
switch( m_CurrentText->Type() ) switch( m_CurrentText->Type() )
{ {
@ -76,7 +80,6 @@ void DialogLabelEditor::InitDialog()
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
SetTitle( _( "Hierarchal Label Properties" ) ); SetTitle( _( "Hierarchal Label Properties" ) );
m_TextShape->SetLabel( _("Hlabel Shape") );
break; break;
case TYPE_SCH_LABEL: case TYPE_SCH_LABEL:
@ -85,34 +88,38 @@ void DialogLabelEditor::InitDialog()
default: default:
SetTitle( _( "Text Properties" ) ); SetTitle( _( "Text Properties" ) );
m_TextLabel->Disconnect(wxEVT_COMMAND_TEXT_ENTER , wxCommandEventHandler ( DialogLabelEditor::onEnterKey ), NULL, this); m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler ( DialogLabelEditor::OnEnterKey ),
NULL, this );
break; break;
} }
unsigned MINTEXTWIDTH = 30; // M's are big characters, a few establish a lot of width unsigned MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width
if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH ) if( m_CurrentText->m_Text.Length() < MINTEXTWIDTH )
{ {
wxString textWidth; wxString textWidth;
textWidth.Append( 'M', MINTEXTWIDTH ); textWidth.Append( 'M', MINTEXTWIDTH );
EnsureTextCtrlWidth( m_TextLabel, &textWidth ); EnsureTextCtrlWidth( m_textLabel, &textWidth );
}
else if ( !multiLine )
{
EnsureTextCtrlWidth( m_textLabel );
} }
else if ( ! multine )
EnsureTextCtrlWidth( m_TextLabel );
else else
{ {
// calculate the lenght of the biggest line // calculate the length of the biggest line
// we cannot use the lenght of the entire text that has no meaning // we cannot use the length of the entire text that has no meaning
int max_len = 0; int max_len = 0;
int curr_len = 0; int curr_len = 0;
int imax = m_CurrentText->m_Text.Len(); int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ ) for( int count = 0; count < imax; count++ )
{ {
if( m_CurrentText->m_Text[count] == '\n' || if( m_CurrentText->m_Text[count] == '\n' ||
m_CurrentText->m_Text[count] == '\r' ) // new line m_CurrentText->m_Text[count] == '\r' ) // new line
{ {
curr_len = 0; curr_len = 0;
} }
else else
{ {
curr_len++; curr_len++;
@ -122,7 +129,7 @@ void DialogLabelEditor::InitDialog()
} }
wxString textWidth; wxString textWidth;
textWidth.Append( 'M', max_len ); textWidth.Append( 'M', max_len );
EnsureTextCtrlWidth( m_TextLabel, &textWidth ); EnsureTextCtrlWidth( m_textLabel, &textWidth );
} }
// Set validators // Set validators
@ -137,10 +144,12 @@ void DialogLabelEditor::InitDialog()
m_TextStyle->SetSelection( style ); m_TextStyle->SetSelection( style );
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol(); wxString units = ReturnUnitSymbol( g_UnitMetric, wxT( "(%s)" ) );
m_SizeTitle->SetLabel( msg ); msg = _( "H" ) + units + _( " x W" ) + units;
m_staticSizeUnits->SetLabel( msg );
msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits ); msg = ReturnStringFromValue( g_UnitMetric, m_CurrentText->m_Size.x,
m_Parent->m_InternalUnits );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
if( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL if( m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL
@ -150,23 +159,24 @@ void DialogLabelEditor::InitDialog()
} }
} }
/*! /*!
* wxTE_PROCESS_ENTER event handler for m_TextLabel * wxTE_PROCESS_ENTER event handler for m_textLabel
*/ */
void DialogLabelEditor::onEnterKey( wxCommandEvent& event ) void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent )
{ {
TextPropertiesAccept( event ); TextPropertiesAccept( aEvent );
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/ */
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
{ {
TextPropertiesAccept( event ); TextPropertiesAccept( aEvent );
EndModal( wxID_OK );
} }
@ -174,16 +184,15 @@ void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event ) void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent )
{ {
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
/****************************************************************************/
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event ) void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
{ {
/****************************************************************************/
wxString text; wxString text;
int value; int value;
@ -193,7 +202,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() ); m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() );
text = m_TextLabel->GetValue(); text = m_textLabel->GetValue();
if( !text.IsEmpty() ) if( !text.IsEmpty() )
m_CurrentText->m_Text = text; m_CurrentText->m_Text = text;
else if( (m_CurrentText->m_Flags & IS_NEW) == 0 ) else if( (m_CurrentText->m_Flags & IS_NEW) == 0 )
@ -201,8 +210,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UnitMetric, text, value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits );
m_Parent->m_InternalUnits );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape ) if( m_TextShape )
m_CurrentText->m_Shape = m_TextShape->GetSelection(); m_CurrentText->m_Shape = m_TextShape->GetSelection();
@ -224,7 +232,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_CurrentText->m_Width = 0; m_CurrentText->m_Width = 0;
} }
m_Parent->OnModify( ); m_Parent->OnModify();
/* Make the text size as new default size if it is a new text */ /* Make the text size as new default size if it is a new text */
if( (m_CurrentText->m_Flags & IS_NEW) != 0 ) if( (m_CurrentText->m_Flags & IS_NEW) != 0 )
@ -232,7 +240,5 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() ); m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( 0 ); EndModal( wxID_OK );
} }

View File

@ -13,12 +13,11 @@
class DialogLabelEditor : public DialogLabelEditor_Base class DialogLabelEditor : public DialogLabelEditor_Base
{ {
private: private:
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame* m_Parent;
SCH_TEXT * m_CurrentText; SCH_TEXT* m_CurrentText;
wxTextCtrl* m_TextLabel;
public: public:
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText); DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem );
~DialogLabelEditor(){}; ~DialogLabelEditor(){};
@ -26,10 +25,10 @@ public:
private: private:
void InitDialog( ); void InitDialog( );
void onEnterKey( wxCommandEvent& event ); virtual void OnEnterKey( wxCommandEvent& aEvent );
void OnButtonOKClick( wxCommandEvent& event ); virtual void OnOkClick( wxCommandEvent& aEvent );
void OnButtonCANCEL_Click( wxCommandEvent& event ); virtual void OnCancelClick( wxCommandEvent& aEvent );
void TextPropertiesAccept( wxCommandEvent& event ); void TextPropertiesAccept( wxCommandEvent& aEvent );
}; };

View File

@ -16,78 +16,82 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
m_textControlSizer->SetFlexibleDirection( wxBOTH );
m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 );
m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_textLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") ); m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
bMainSizer->Add( m_TextLabelSingleline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_textControlSizer->Add( m_textLabel, 0, wxEXPAND|wxLEFT, 3 );
m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER ); m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") ); m_SizeTitle->Wrap( -1 );
m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) ); m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
bMainSizer->Add( m_textCtrlMultiline, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSizeUnits->Wrap( -1 );
bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 );
bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
wxBoxSizer* m_OptionsSizer; wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") }; wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") };
int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString ); int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString );
m_TextOrient = new wxRadioBox( this, wxID_ANY, _("Direction"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); m_TextOrient = new wxRadioBox( this, wxID_ANY, _("O&rietation"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS );
m_TextOrient->SetSelection( 0 ); m_TextOrient->SetSelection( 0 );
m_OptionsSizer->Add( m_TextOrient, 1, wxALL, 5 ); m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 );
wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString ); int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString );
m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); m_TextStyle = new wxRadioBox( this, wxID_ANY, _("St&yle"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS );
m_TextStyle->SetSelection( 0 ); m_TextStyle->SetSelection( 0 );
m_OptionsSizer->Add( m_TextStyle, 1, wxALL, 5 ); m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 );
wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidi"), _("TriState"), _("Passive") }; wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") };
int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString ); int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString );
m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); m_TextShape = new wxRadioBox( this, wxID_ANY, _("S&hape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 0 ); m_TextShape->SetSelection( 2 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 ); m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 );
wxBoxSizer* bSizer4; bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); m_sdbSizer1 = new wxStdDialogButtonSizer();
m_SizeTitle->Wrap( -1 ); m_sdbSizer1OK = new wxButton( this, wxID_OK );
bSizer4->Add( m_SizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
bSizer4->Add( 8, 8, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_OptionsSizer->Add( bSizer4, 1, 0, 5 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
m_TextLabelSingleline->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); m_textLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
} }
DialogLabelEditor_Base::~DialogLabelEditor_Base() DialogLabelEditor_Base::~DialogLabelEditor_Base()
{ {
// Disconnect Events // Disconnect Events
m_TextLabelSingleline->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
} }

View File

@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DialogLabelEditor_Base</property> <property name="name">DialogLabelEditor_Base</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">526,290</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Text Editor</property> <property name="title">Text Editor</property>
@ -76,203 +76,98 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">12</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText1</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_VALUE</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_TextLabelSingleline</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass"></property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">onEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxFlexGridSizer" expanded="1">
<property name="bg"></property> <property name="cols">2</property>
<property name="context_help"></property> <property name="flexible_direction">wxBOTH</property>
<property name="enabled">1</property> <property name="growablecols"></property>
<property name="fg"></property> <property name="growablerows"></property>
<property name="font"></property> <property name="hgap">3</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">-1,60</property>
<property name="name">m_textCtrlMultiline</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE|wxTE_PROCESS_ENTER</property>
<property name="subclass"></property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_OptionsSizer</property> <property name="name">m_textControlSizer</property>
<property name="orient">wxHORIZONTAL</property> <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property> <property name="permission">protected</property>
<property name="rows">2</property>
<property name="vgap">3</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxALL</property> <property name="flag">wxRIGHT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Right&quot; &quot;Up&quot; &quot;Left&quot; &quot;Down&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Direction</property> <property name="label">&amp;Text:</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_TextOrient</property> <property name="name">m_staticText1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_VALUE</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_textLabel</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass"></property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
@ -290,43 +185,44 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">OnEnterKey</event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Normal&quot; &quot;Italic&quot; &quot;Bold&quot; &quot;Bold Italic&quot;</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Style</property> <property name="label">&amp;Size:</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_TextStyle</property> <property name="name">m_SizeTitle</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
@ -344,7 +240,6 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
@ -354,122 +249,17 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxALL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Input&quot; &quot;Output&quot; &quot;Bidi&quot; &quot;TriState&quot; &quot;Passive&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Glabel Shape</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextShape</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer4</property> <property name="name">bSizeCtrlSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Size</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_SizeTitle</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="bg"></property> <property name="bg"></property>
@ -523,32 +313,21 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="height">8</property>
<property name="permission">protected</property>
<property name="width">8</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_OK</property> <property name="id">wxID_ANY</property>
<property name="label">OK</property> <property name="label">units</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_buttonOK</property> <property name="name">m_staticSizeUnits</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
@ -558,59 +337,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick">OnButtonOKClick</event> <property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">1</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonCANCEL</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnButtonCANCEL_Click</event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
@ -640,6 +367,205 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_OptionsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Right&quot; &quot;Up&quot; &quot;Left&quot; &quot;Down&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">O&amp;rietation</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextOrient</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Normal&quot; &quot;Italic&quot; &quot;Bold&quot; &quot;Bold Italic&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">St&amp;yle</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextStyle</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL|wxLEFT|wxTOP</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Input&quot; &quot;Output&quot; &quot;Bidirectional&quot; &quot;Tri-State&quot; &quot;Passive&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">S&amp;hape</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextShape</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">2</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -17,9 +17,9 @@
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -38,26 +38,27 @@ class DialogLabelEditor_Base : public wxDialog
wxID_SIZE, wxID_SIZE,
}; };
wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_TextLabelSingleline; wxTextCtrl* m_textLabel;
wxTextCtrl* m_textCtrlMultiline; wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
wxStaticText* m_staticSizeUnits;
wxRadioBox* m_TextOrient; wxRadioBox* m_TextOrient;
wxRadioBox* m_TextStyle; wxRadioBox* m_TextStyle;
wxRadioBox* m_TextShape; wxRadioBox* m_TextShape;
wxStaticText* m_SizeTitle; wxStdDialogButtonSizer* m_sdbSizer1;
wxTextCtrl* m_TextSize; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onEnterKey( wxCommandEvent& event ){ event.Skip(); } virtual void OnEnterKey( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
public: public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 526,290 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DialogLabelEditor_Base();
}; };

View File

@ -1,245 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_find.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 16/02/2006 20:18:11
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11
////@begin includes
////@end includes
#include "dialog_find.h"
////@begin XPM images
////@end XPM images
/*!
* WinEDA_FindFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( WinEDA_FindFrame, wxDialog )
/*!
* WinEDA_FindFrame event table definition
*/
BEGIN_EVENT_TABLE( WinEDA_FindFrame, wxDialog )
////@begin WinEDA_FindFrame event table entries
EVT_BUTTON( FIND_SHEET, WinEDA_FindFrame::OnFindSheetClick )
EVT_BUTTON( FIND_HIERARCHY, WinEDA_FindFrame::OnFindHierarchyClick )
EVT_BUTTON( FIND_NEXT, WinEDA_FindFrame::OnFindNextClick )
EVT_BUTTON( FIND_MARKERS, WinEDA_FindFrame::OnFindMarkersClick )
EVT_BUTTON( FIND_NEXT_MARKER, WinEDA_FindFrame::OnFindNextMarkerClick )
EVT_BUTTON( LOCATE_IN_LIBRARIES, WinEDA_FindFrame::OnLocateInLibrariesClick )
////@end WinEDA_FindFrame event table entries
END_EVENT_TABLE()
/*!
* WinEDA_FindFrame constructors
*/
WinEDA_FindFrame::WinEDA_FindFrame( )
{
}
WinEDA_FindFrame::WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
m_Parent = parent;
Create(parent, id, caption, pos, size, style);
}
/*!
* WinEDA_FindFrame creator
*/
bool WinEDA_FindFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin WinEDA_FindFrame member initialisation
m_NewTextCtrl = NULL;
////@end WinEDA_FindFrame member initialisation
////@begin WinEDA_FindFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end WinEDA_FindFrame creation
m_NewTextCtrl->SetFocus();
/* does not work here, might work if moved elsewhere,
see void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
// deselect the existing text, seems SetFocus() wants to emulate
// Microsoft and select all text, which is not desireable here.
m_NewTextCtrl->SetSelection(0,0);
*/
return true;
}
/*!
* Control creation for WinEDA_FindFrame
*/
void WinEDA_FindFrame::CreateControls()
{
////@begin WinEDA_FindFrame content construction
// Generated by DialogBlocks, 24/04/2009 14:23:21 (unregistered)
WinEDA_FindFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxLEFT|wxRIGHT, 5);
wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Item to find:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_NewTextCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(m_NewTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
wxButton* itemButton8 = new wxButton( itemDialog1, FIND_SHEET, _("Item in &Sheet"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton8, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
wxButton* itemButton9 = new wxButton( itemDialog1, FIND_HIERARCHY, _("Item in &Hierarchy"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton9, 0, wxGROW|wxLEFT|wxRIGHT, 1);
wxButton* itemButton10 = new wxButton( itemDialog1, FIND_NEXT, _("Find &Next Item (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer7->Add(itemButton10, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer6->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxFIXED_MINSIZE, 5);
wxButton* itemButton12 = new wxButton( itemDialog1, FIND_MARKERS, _("Find Markers"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxLEFT|wxRIGHT, 1);
wxButton* itemButton13 = new wxButton( itemDialog1, FIND_NEXT_MARKER, _("Next Marker (F5)"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 1);
wxButton* itemButton14 = new wxButton( itemDialog1, LOCATE_IN_LIBRARIES, _("Find Cmp in &Lib"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 1);
// Set validators
m_NewTextCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, & s_OldStringFound) );
////@end WinEDA_FindFrame content construction
}
/*!
* Should we show tooltips?
*/
bool WinEDA_FindFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap WinEDA_FindFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_FindFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end WinEDA_FindFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon WinEDA_FindFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_FindFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end WinEDA_FindFrame icon retrieval
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void WinEDA_FindFrame::OnFindSheetClick( wxCommandEvent& event )
{
FindSchematicItem(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void WinEDA_FindFrame::OnFindHierarchyClick( wxCommandEvent& event )
{
FindSchematicItem(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3
*/
void WinEDA_FindFrame::OnLocateInLibrariesClick( wxCommandEvent& event )
{
LocatePartInLibs(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON5
*/
void WinEDA_FindFrame::OnFindNextMarkerClick( wxCommandEvent& event )
{
FindMarker(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS
*/
void WinEDA_FindFrame::OnFindMarkersClick( wxCommandEvent& event )
{
FindMarker(event);
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT
*/
void WinEDA_FindFrame::OnFindNextClick( wxCommandEvent& event )
{
FindSchematicItem(event);
}

View File

@ -1,126 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_find.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 16/02/2006 20:18:11
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 16/02/2006 20:18:11
#ifndef _DIALOG_FIND_H_
#define _DIALOG_FIND_H_
/*!
* Includes
*/
////@begin includes
#include "wx/valtext.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL1 10008
#define FIND_SHEET 10001
#define FIND_HIERARCHY 10002
#define FIND_NEXT 10005
#define FIND_MARKERS 10003
#define FIND_NEXT_MARKER 10006
#define LOCATE_IN_LIBRARIES 10004
#define SYMBOL_WINEDA_FINDFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_FINDFRAME_TITLE _("EESchema Locate")
#define SYMBOL_WINEDA_FINDFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_FINDFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_FINDFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_FindFrame class declaration
*/
class WinEDA_FindFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_FindFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_FindFrame( );
WinEDA_FindFrame( WinEDA_SchematicFrame* parent, wxWindowID id = SYMBOL_WINEDA_FINDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FINDFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FINDFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FINDFRAME_SIZE, long style = SYMBOL_WINEDA_FINDFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_FINDFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_FINDFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_FINDFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_FINDFRAME_SIZE, long style = SYMBOL_WINEDA_FINDFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_FindFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_SHEET
void OnFindSheetClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_HIERARCHY
void OnFindHierarchyClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT
void OnFindNextClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_MARKERS
void OnFindMarkersClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for FIND_NEXT_MARKER
void OnFindNextMarkerClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for LOCATE_IN_LIBRARIES
void OnLocateInLibrariesClick( wxCommandEvent& event );
////@end WinEDA_FindFrame event handler declarations
////@begin WinEDA_FindFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_FindFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void FindSchematicItem(wxCommandEvent& event);
void FindMarker(wxCommandEvent& event);
void LocatePartInLibs(wxCommandEvent& event);
int ExploreAllLibraries(const wxString & wildmask, wxString & FindList);
////@begin WinEDA_FindFrame member variables
wxTextCtrl* m_NewTextCtrl;
////@end WinEDA_FindFrame member variables
WinEDA_SchematicFrame * m_Parent;
};
#endif
// _DIALOG_FIND_H_

File diff suppressed because it is too large Load Diff

1017
eeschema/dialog_sch_find.fbp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,171 @@
#include "dialog_schematic_find.h"
DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER )
DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB )
DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
const wxPoint& aPosition, const wxSize& aSize, int aStyle ) :
DIALOG_SCH_FIND_BASE( aParent, wxID_ANY, _( "Find" ), aPosition, aSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | aStyle )
{
SetData( aData );
wxASSERT_MSG( m_findReplaceData, wxT( "can't create find dialog without data" ) );
if( aStyle & wxFR_REPLACEDIALOG )
{
m_staticReplace->Show( true );
m_comboReplace->Show( true );
}
int flags = m_findReplaceData->GetFlags();
m_radioForward->SetValue( flags & wxFR_DOWN );
m_radioBackward->SetValue( ( flags & wxFR_DOWN ) == 0 );
m_checkMatchCase->SetValue( flags & wxFR_MATCHCASE );
m_checkWholeWord->SetValue( flags & wxFR_WHOLEWORD );
/* Whole work and wild card searches are mutually exclusive. */
if( !( flags & wxFR_WHOLEWORD ) )
m_checkWildcardMatch->SetValue( flags & FR_MATCH_WILDCARD );
m_checkAllFields->SetValue( flags & FR_SEARCH_ALL_FIELDS );
m_checkWrap->SetValue( flags & FR_SEARCH_WRAP );
m_checkCurrentSheetOnly->SetValue( flags & FR_CURRENT_SHEET_ONLY );
m_comboFind->SetFocus();
SetPosition( aPosition );
SetSize( aSize );
}
void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
{
SendEvent( wxEVT_COMMAND_FIND_CLOSE );
}
void DIALOG_SCH_FIND::OnUpdateFindUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( !m_comboFind->GetValue().empty() );
}
void DIALOG_SCH_FIND::OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( !m_checkWildcardMatch->GetValue() );
}
void DIALOG_SCH_FIND::OnUpdateWildcardUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( !m_checkWholeWord->GetValue() );
}
void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent )
{
int index = m_comboFind->FindString( m_comboFind->GetValue(), true );
if( index == wxNOT_FOUND )
{
m_comboFind->Insert( m_comboFind->GetValue(), 0 );
}
else if( index != 0 )
{
/* Move the search string to the top of the list if it isn't already there. */
wxString tmp = m_comboFind->GetValue();
m_comboFind->Delete( index );
m_comboFind->Insert( tmp, 0 );
m_comboFind->SetSelection( 0 );
}
SendEvent( wxEVT_COMMAND_FIND );
}
void DIALOG_SCH_FIND::OnCancel( wxCommandEvent& aEvent )
{
SendEvent( wxEVT_COMMAND_FIND_CLOSE );
Show( false );
}
void DIALOG_SCH_FIND::SendEvent( const wxEventType& aEventType )
{
wxFindDialogEvent event( aEventType, GetId() );
event.SetEventObject( this );
event.SetFindString( m_comboFind->GetValue() );
if ( HasFlag( wxFR_REPLACEDIALOG ) )
{
event.SetReplaceString( m_comboReplace->GetValue() );
}
int flags = 0;
if( m_radioForward->GetValue() )
flags |= wxFR_DOWN;
if( m_checkMatchCase->GetValue() )
flags |= wxFR_MATCHCASE;
if( m_checkWholeWord->GetValue() )
flags |= wxFR_WHOLEWORD;
if( m_checkWildcardMatch->GetValue() )
flags |= FR_MATCH_WILDCARD;
if( m_checkAllFields->GetValue() )
flags |= FR_SEARCH_ALL_FIELDS;
if( m_checkWrap->GetValue() )
flags |= FR_SEARCH_WRAP;
if( m_checkCurrentSheetOnly->GetValue() )
flags |= FR_CURRENT_SHEET_ONLY;
m_findReplaceData->SetFindString( event.GetFindString() );
if( HasFlag( wxFR_REPLACEDIALOG )
&& ( event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE
|| event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL ) )
{
m_findReplaceData->SetReplaceString( event.GetReplaceString() );
}
event.SetFlags( flags );
m_findReplaceData->SetFlags( event.GetFlags() );
if( !GetEventHandler()->ProcessEvent( event ) )
{
GetParent()->GetEventHandler()->ProcessEvent( event );
}
}
wxArrayString DIALOG_SCH_FIND::GetFindEntries() const
{
return m_comboFind->GetStrings();
}
void DIALOG_SCH_FIND::SetFindEntries( const wxArrayString& aEntries )
{
m_comboFind->Append( aEntries );
if( !m_comboFind->IsEmpty() )
m_comboFind->SetSelection( 0 );
}
void DIALOG_SCH_FIND::SetReplaceEntries( const wxArrayString& aEntries )
{
m_comboReplace->Append( aEntries );
if( !m_comboReplace->IsEmpty() )
m_comboReplace->SetSelection( 0 );
}

View File

@ -0,0 +1,88 @@
#ifndef __dialog_schematic_find__
#define __dialog_schematic_find__
/**
* @file
*
* Subclass of DIALOG_SCH_FIND_BASE, which is generated by wxFormBuilder.
*
* This dialog is used to define the search criteria used to search for items
* in the current schematic. What is searched depends on the schematic item
* type. Check the Matches() method for each item derived from SCH_ITEM() to
* find out how matching is performed against that item.
*/
#include "dialog_schematic_find_base.h"
#include <wx/fdrepdlg.h> // Use the wxFindReplaceDialog events, data, and enums.
/* Define schematic specific find and replace dialog flags based on the enum entries
* in wxFindReplaceFlags. These flags are intended to be used as bit masks in the
* wxFindReplaceData::m_Flags member variable. The varialble is defined as a wxUint32.
*/
enum SchematicFindReplaceFlags
{
/* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */
/* Search the current sheet only. */
FR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1,
/* Search all fields in component, not just the value and reference fields. */
FR_SEARCH_ALL_FIELDS = wxFR_MATCHCASE << 2,
/* Perform search using simple wild card matching (* & ?). */
FR_MATCH_WILDCARD = wxFR_MATCHCASE << 3,
/* Wrap around the beginning or end of search list. */
FR_SEARCH_WRAP = wxFR_MATCHCASE << 4
};
/** Implementing DIALOG_SCH_FIND_BASE */
class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE
{
protected:
// Handlers for DIALOG_SCH_FIND_BASE events.
void OnClose( wxCloseEvent& aEvent );
void OnUpdateFindUI( wxUpdateUIEvent& aEvent );
void OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent );
void OnUpdateWildcardUI( wxUpdateUIEvent& aEvent );
void OnFind( wxCommandEvent& aEvent );
void OnCancel( wxCommandEvent& aEvent );
void SendEvent( const wxEventType& aEventType );
wxFindReplaceData *m_findReplaceData;
DECLARE_NO_COPY_CLASS( DIALOG_SCH_FIND )
public:
DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
const wxFindReplaceData *GetData() const { return m_findReplaceData; }
void SetData(wxFindReplaceData *aData) { m_findReplaceData = aData; }
void SetFindEntries( const wxArrayString& aEntries );
wxArrayString GetFindEntries() const;
void SetReplaceEntries( const wxArrayString& aEntries );
wxArrayString GetReplaceEntries() const { return m_comboReplace->GetStrings(); }
};
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER, wxID_HIGHEST + 5000 )
DECLARE_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB, wxID_HIGHEST + 5001 )
END_DECLARE_EVENT_TYPES()
#define EVT_FIND_DRC_MARKER( id, fn ) \
wx__DECLARE_EVT1( EVT_COMMAND_FIND_DRC_MARKER, id, wxFindDialogEventHandler( fn ) )
#define EVT_FIND_COMPONENT_IN_LIB( id, fn ) \
wx__DECLARE_EVT1( EVT_COMMAND_FIND_COMPONENT_IN_LIB, id, wxFindDialogEventHandler( fn ) )
#endif // __dialog_schematic_find__

View File

@ -0,0 +1,147 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_schematic_find_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* leftSizer;
leftSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* leftGridSizer;
leftGridSizer = new wxFlexGridSizer( 3, 2, 3, 3 );
leftGridSizer->SetFlexibleDirection( wxBOTH );
leftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
leftGridSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 6 );
m_comboFind = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN );
m_comboFind->SetMinSize( wxSize( 125,-1 ) );
leftGridSizer->Add( m_comboFind, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_staticReplace = new wxStaticText( this, wxID_ANY, _("Replace &with:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticReplace->Wrap( -1 );
m_staticReplace->Hide();
leftGridSizer->Add( m_staticReplace, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_comboReplace = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_comboReplace->Hide();
leftGridSizer->Add( m_comboReplace, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 );
m_staticDirection = new wxStaticText( this, wxID_ANY, _("Direction:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticDirection->Wrap( -1 );
m_staticDirection->Hide();
leftGridSizer->Add( m_staticDirection, 0, 0, 5 );
wxBoxSizer* directionSizer;
directionSizer = new wxBoxSizer( wxVERTICAL );
m_radioForward = new wxRadioButton( this, wxID_ANY, _("F&orward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioForward->Hide();
directionSizer->Add( m_radioForward, 0, wxALL, 3 );
m_radioBackward = new wxRadioButton( this, wxID_ANY, _("&Backward"), wxDefaultPosition, wxDefaultSize, 0 );
m_radioBackward->Hide();
directionSizer->Add( m_radioBackward, 0, wxALL, 3 );
leftGridSizer->Add( directionSizer, 1, wxEXPAND, 5 );
leftSizer->Add( leftGridSizer, 1, wxALL|wxEXPAND, 6 );
m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Match &whole word"), wxDefaultPosition, wxDefaultSize, 0 );
leftSizer->Add( m_checkWholeWord, 0, wxALL, 6 );
m_checkMatchCase = new wxCheckBox( this, wxID_ANY, _("&Match case"), wxDefaultPosition, wxDefaultSize, 0 );
leftSizer->Add( m_checkMatchCase, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Search &using simple wildcard matching"), wxDefaultPosition, wxDefaultSize, 0 );
leftSizer->Add( m_checkWildcardMatch, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_checkWrap = new wxCheckBox( this, wxID_ANY, _("Wrap around &end of search list"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkWrap->SetValue(true);
leftSizer->Add( m_checkWrap, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search all component &fields"), wxDefaultPosition, wxDefaultSize, 0 );
leftSizer->Add( m_checkAllFields, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current sheet on&ly"), wxDefaultPosition, wxDefaultSize, 0 );
leftSizer->Add( m_checkCurrentSheetOnly, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
mainSizer->Add( leftSizer, 1, wxALL|wxEXPAND, 6 );
wxBoxSizer* rightSizer;
rightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonFind = new wxButton( this, wxID_FIND, _("&Find"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonFind->SetDefault();
rightSizer->Add( m_buttonFind, 0, wxALL, 6 );
m_buttonReplace = new wxButton( this, wxID_ANY, _("&Replace"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonReplace->Hide();
rightSizer->Add( m_buttonReplace, 0, wxALL, 5 );
m_buttonReplaceAll = new wxButton( this, wxID_ANY, _("Replace &All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonReplaceAll->Hide();
rightSizer->Add( m_buttonReplaceAll, 0, wxALL, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 );
mainSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) );
m_comboFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_comboReplace->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_checkWholeWord->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this );
m_checkWildcardMatch->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this );
m_buttonFind->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}
DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) );
m_comboFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_comboReplace->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_checkWholeWord->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this );
m_checkWildcardMatch->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this );
m_buttonFind->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}

View File

@ -0,0 +1,71 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_schematic_find_base__
#define __dialog_schematic_find_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/combobox.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_FIND_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_FIND_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText1;
wxComboBox* m_comboFind;
wxStaticText* m_staticReplace;
wxComboBox* m_comboReplace;
wxStaticText* m_staticDirection;
wxRadioButton* m_radioForward;
wxRadioButton* m_radioBackward;
wxCheckBox* m_checkWholeWord;
wxCheckBox* m_checkMatchCase;
wxCheckBox* m_checkWildcardMatch;
wxCheckBox* m_checkWrap;
wxCheckBox* m_checkAllFields;
wxCheckBox* m_checkCurrentSheetOnly;
wxButton* m_buttonFind;
wxButton* m_buttonReplace;
wxButton* m_buttonReplaceAll;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ){ event.Skip(); }
virtual void OnUpdateDrcUI( wxUpdateUIEvent& event ){ event.Skip(); }
virtual void OnUpdateWholeWordUI( wxUpdateUIEvent& event ){ event.Skip(); }
virtual void OnUpdateWildcardUI( wxUpdateUIEvent& event ){ event.Skip(); }
virtual void OnFind( wxCommandEvent& event ){ event.Skip(); }
virtual void OnUpdateFindUI( wxUpdateUIEvent& event ){ event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_FIND_BASE();
};
#endif //__dialog_schematic_find_base__

View File

@ -22,14 +22,14 @@ static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );
static wxPoint ItemInitialPosition; static wxPoint ItemInitialPosition;
static int OldOrient; static int OldOrient;
static wxSize OldSize; static wxSize OldSize;
static int s_DefaultShapeGLabel = (int) NET_INPUT; static int lastGlobalLabelShape = (int) NET_INPUT;
static int s_DefaultOrientGLabel = 0; static int lastTextOrientation = 0;
static bool lastTextBold = false;
static bool lastTextItalic = false;
/*****************************************************************************/
void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
{ {
/*****************************************************************************/
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
@ -72,10 +72,8 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
} }
/*****************************************************************************/
void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
{ {
/*****************************************************************************/
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur, TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
GetScreen(), TEXTITEM | LABELITEM ); GetScreen(), TEXTITEM | LABELITEM );
@ -113,11 +111,9 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
} }
/*************************************************************************/
SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/*************************************************************************/
/* Routine to create new text struct (GraphicText, label or Glabel). /* Routine to create new text struct (GraphicText, label or Glabel).
*/ */
SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
{ {
SCH_TEXT* NewText = NULL; SCH_TEXT* NewText = NULL;
@ -135,14 +131,12 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur ); NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = lastGlobalLabelShape;
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur ); NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = lastGlobalLabelShape;
NewText->SetSchematicTextOrientation( s_DefaultOrientGLabel );
break; break;
default: default:
@ -151,6 +145,9 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
return NULL; return NULL;
} }
NewText->m_Bold = lastTextBold;
NewText->m_Italic = lastTextItalic;
NewText->SetSchematicTextOrientation( lastTextOrientation );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
NewText->m_Flags = IS_NEW | IS_MOVED; NewText->m_Flags = IS_NEW | IS_MOVED;
@ -163,10 +160,13 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
return NULL; return NULL;
} }
lastTextBold = NewText->m_Bold;
lastTextItalic = NewText->m_Italic;
lastTextOrientation = NewText->GetSchematicTextOrientation();
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL ) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL )
{ {
s_DefaultShapeGLabel = NewText->m_Shape; lastGlobalLabelShape = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->GetSchematicTextOrientation();
} }
RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE );
@ -208,11 +208,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/*************************************************************/ /* Abort function for the command move text */
static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
/*************************************************************/
/* Abort function for the command move text */
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
@ -260,17 +258,14 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*****************************************************************************/
void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
wxDC* DC, int newtype )
{
/*****************************************************************************/
/* Routine to change a text type to an other one (GraphicText, label or /* Routine to change a text type to an other one (GraphicText, label or
* Glabel). * Glabel).
* A new test, label or hierarchical or global label is created from the old * A new test, label or hierarchical or global label is created from the old
* text. * text.
* the old text is deleted * the old text is deleted
*/ */
void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
{
if( Text == NULL ) if( Text == NULL )
return; return;

View File

@ -33,10 +33,6 @@ SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo * before it is modified (used for undo
* managing to restore old values ) */ * managing to restore old values ) */
bool g_LastSearchIsMarker; /* True if last seach is a marker serach
* False for a schematic item search
* Used for hotkey next search */
/* Block operation (copy, paste) */ /* Block operation (copy, paste) */
BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste
// (Created by Block Save) // (Created by Block Save)

View File

@ -18,9 +18,13 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "dialog_eeschema_options.h" #include "dialog_eeschema_options.h"
#include <wx/fdrepdlg.h>
#define HOTKEY_FILENAME wxT( "eeschema" ) #define HOTKEY_FILENAME wxT( "eeschema" )
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
{ {
@ -352,6 +356,15 @@ static const wxString PrintDialogPositionXEntry( wxT( "PrintDialogPositionX" ) )
static const wxString PrintDialogPositionYEntry( wxT( "PrintDialogPositionY" ) ); static const wxString PrintDialogPositionYEntry( wxT( "PrintDialogPositionY" ) );
static const wxString PrintDialogWidthEntry( wxT( "PrintDialogWidth" ) ); static const wxString PrintDialogWidthEntry( wxT( "PrintDialogWidth" ) );
static const wxString PrintDialogHeightEntry( wxT( "PrintDialogHeight" ) ); static const wxString PrintDialogHeightEntry( wxT( "PrintDialogHeight" ) );
static const wxString FindDialogPositionXEntry( wxT( "FindDialogPositionX" ) );
static const wxString FindDialogPositionYEntry( wxT( "FindDialogPositionY" ) );
static const wxString FindDialogWidthEntry( wxT( "FindDialogWidth" ) );
static const wxString FindDialogHeightEntry( wxT( "FindDialogHeight" ) );
static const wxString FindReplaceFlagsEntry( wxT( "LastFindReplaceFlags" ) );
static const wxString FindStringEntry( wxT( "LastFindString" ) );
static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) );
static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) );
static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) );
/* /*
@ -474,6 +487,8 @@ void WinEDA_SchematicFrame::LoadSettings()
(long) 6 ); (long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false ); cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
/* Load print preview window session settings. */
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp; m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
@ -483,6 +498,7 @@ void WinEDA_SchematicFrame::LoadSettings()
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 ); cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp ); m_previewSize.SetHeight( (int) tmp );
/* Load print dialog session settings. */
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp; m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
@ -491,6 +507,40 @@ void WinEDA_SchematicFrame::LoadSettings()
m_printDialogSize.SetWidth( (int) tmp ); m_printDialogSize.SetWidth( (int) tmp );
cfg->Read( PrintDialogHeightEntry, &tmp, -1 ); cfg->Read( PrintDialogHeightEntry, &tmp, -1 );
m_printDialogSize.SetHeight( (int) tmp ); m_printDialogSize.SetHeight( (int) tmp );
/* Load find dialog session setting. */
cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
m_findDialogPosition.x = (int) tmp;
cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
m_findDialogPosition.y = (int) tmp;
cfg->Read( FindDialogWidthEntry, &tmp, -1 );
m_findDialogSize.SetWidth( (int) tmp );
cfg->Read( FindDialogHeightEntry, &tmp, -1 );
m_findDialogSize.SetHeight( (int) tmp );
wxASSERT_MSG( m_findReplaceData,
wxT( "Find dialog data settings object not created. Bad programmer!" ) );
cfg->Read( FindReplaceFlagsEntry, &tmp, (long) wxFR_DOWN );
m_findReplaceData->SetFlags( (wxUint32) tmp );
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) );
/* Load the find and replace string history list. */
for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
{
wxString tmpHistory;
wxString entry;
entry.Printf( FindStringHistoryEntry, i );
tmpHistory = cfg->Read( entry, wxEmptyString );
if( !tmpHistory.IsEmpty() )
m_findStringHistoryList.Add( tmpHistory );
entry.Printf( ReplaceStringHistoryEntry, i );
tmpHistory = cfg->Read( entry, wxEmptyString );
if( !tmpHistory.IsEmpty() )
m_replaceStringHistoryList.Add( tmpHistory );
}
} }
@ -511,13 +561,43 @@ void WinEDA_SchematicFrame::SaveSettings()
cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins ); cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
/* Save print preview window session settings. */
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x ); cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y ); cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() ); cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() ); cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
/* Save print dialog session settings. */
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x ); cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y ); cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() ); cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() ); cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() );
/* Save find dialog session setting. */
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
cfg->Write( FindDialogHeightEntry, m_findDialogSize.GetHeight() );
wxASSERT_MSG( m_findReplaceData,
wxT( "Find dialog data settings object not created. Bad programmer!" ) );
cfg->Write( FindReplaceFlagsEntry, (long) m_findReplaceData->GetFlags() );
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() );
/* Save the find and replace string history list. */
size_t i;
wxString tmpHistory;
wxString entry;
for ( i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
{
entry.Printf( FindStringHistoryEntry, i );
cfg->Write( entry, m_findStringHistoryList[ i ] );
}
for ( i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
{
entry.Printf( ReplaceStringHistoryEntry, i );
cfg->Write( entry, m_replaceStringHistoryList[ i ] );
}
} }

View File

@ -97,7 +97,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
wxSetWorkingDirectory( wxPathOnly( FullFileName ) ); wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
screen->m_FileName = FullFileName; screen->m_FileName = FullFileName;
g_RootSheet->SetFileName( FullFileName ); g_RootSheet->SetFileName( FullFileName );
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
ClearMsgPanel(); ClearMsgPanel();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) ); memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );

View File

@ -24,50 +24,59 @@
#include "kicad_device_context.h" #include "kicad_device_context.h"
#include <wx/fdrepdlg.h> // Use the wxFindReplaceDialog events, data, and enums.
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "dialog_schematic_find.h"
/* Define schematic specific find and replace dialog flags based on the enum entries
* in wxFindReplaceFlags. These flags are intended to be used as bit masks in the void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event )
* wxFindReplaceData::m_Flags member variable. The varialble is defined as a wxUint32.
*/
enum SchematicFindReplaceFlags
{ {
/* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */ static SCH_MARKER* lastMarker = NULL;
/* Search the current sheet only. */ wxString msg;
schFR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, SCH_SHEET_LIST schematic;
SCH_SHEET_PATH* sheetFoundIn = NULL;
bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
/* Search for design rule check markers. */ if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
schFR_DRC_MARKERS = wxFR_MATCHCASE << 2, {
sheetFoundIn = m_CurrentSheet;
/* Search for component in all loaded libraries. */ lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( TYPE_SCH_MARKER,
schFR_SEARCH_LIBS_FOR_COMPONENT = wxFR_MATCHCASE << 3 lastMarker, wrap );
}; }
/* Variables Locales */
static int s_ItemsCount, s_MarkerCount;
static wxString s_OldStringFound;
#include "dialog_find.cpp"
/* Search markers in whole hierarchy.
* Mouse cursor is put on the marker
* search the first marker, or next marker
*/
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
{
int id = event.GetId();
if( id != FIND_NEXT_MARKER )
m_Parent->FindMarker( 0 );
else else
m_Parent->FindMarker( 1 ); {
lastMarker = (SCH_MARKER*) schematic.FindNextItem( TYPE_SCH_MARKER, &sheetFoundIn,
lastMarker, wrap );
}
Close(); if( lastMarker != NULL )
{
if( sheetFoundIn != GetSheet() )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
}
sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos;
Recadre_Trace( TRUE );
wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.x, m_InternalUnits );
double y = To_User_Unit( g_UnitMetric, (double) lastMarker->m_Pos.y, m_InternalUnits );
msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
GetChars( path ), x, GetChars( units ), y, GetChars( units) );
SetStatusText( msg );
}
else
{
SetStatusText( _( "No more markers were found." ) );
}
} }
@ -86,11 +95,11 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
* >= 4 => unused (same as 0) * >= 4 => unused (same as 0)
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component_reference,
const wxString& component_reference, bool Find_in_hierarchy, bool Find_in_hierarchy,
int SearchType, int SearchType,
const wxString& text_to_find, const wxString& text_to_find,
bool mouseWarp ) bool mouseWarp )
{ {
SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL; SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL;
SCH_ITEM* DrawList = NULL; SCH_ITEM* DrawList = NULL;
@ -268,513 +277,59 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
msg += _( " not found" ); msg += _( " not found" );
} }
Affiche_Message( msg ); SetStatusText( msg );
return DrawList; return DrawList;
} }
/* Search markers in whole the hierarchy.
* Mouse cursor is put on the marker
* SearchType = 0: search the first marker, else search next marker
*/
SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
{
SCH_SHEET_PATH* sheet, * FirstSheet = NULL;
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
SCH_MARKER* Marker = NULL;
int StartCount;
bool NotFound;
wxPoint firstpos, pos;
wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint curpos, old_cursor_position;
bool DoCenterAndRedraw = FALSE;
wxString msg, WildText;
g_LastSearchIsMarker = TRUE;
/* Set s_MarkerCount to 0 if we are look for the first marker */
if( SearchType == 0 )
s_MarkerCount = 0;
SCH_SHEET_LIST SheetList;
NotFound = TRUE; StartCount = 0;
/* Search for s_MarkerCount markers */
for( sheet = SheetList.GetFirst(); sheet != NULL;
sheet = SheetList.GetNext() )
{
DrawList = (SCH_ITEM*) sheet->LastDrawList();
while( DrawList && NotFound )
{
if( DrawList->Type() == TYPE_SCH_MARKER )
{
Marker = (SCH_MARKER*) DrawList;
NotFound = FALSE;
pos = Marker->m_Pos;
if( FirstSheet == NULL ) /* First item found */
{
FirstSheet = sheet; firstpos = pos;
FirstStruct = DrawList;
}
StartCount++;
if( s_MarkerCount >= StartCount )
{
NotFound = TRUE; /* Search for other markers */
}
else /* We have found s_MarkerCount
* markers -> Ok */
{
Struct = DrawList; s_MarkerCount++; break;
}
}
DrawList = DrawList->Next();
}
if( NotFound == FALSE )
break;
}
if( NotFound && FirstSheet ) /* markers are found, but we have
* reach the last marker */
{
// After the last marker, the first marker is used */
NotFound = FALSE; sheet = FirstSheet;
Struct = FirstStruct;
pos = firstpos; s_MarkerCount = 1;
}
if( NotFound == FALSE )
{
if( sheet != GetSheet() )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE;
}
old_cursor_position = sheet->LastScreen()->m_Curseur;
sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x,
&m_CurrentSheet->LastScreen()->m_StartVisu.y );
curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
// reposition the window if the chosen marker is off screen.
#define MARGIN 30
if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN )
|| ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) )
{
DoCenterAndRedraw = true;;
}
#undef MARGIN
if( DoCenterAndRedraw )
Recadre_Trace( TRUE );
else
{
INSTALL_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc );
}
wxString path = sheet->Path();
msg.Printf( _( "Marker %d found in %s" ),
s_MarkerCount, path.GetData() );
Affiche_Message( msg );
}
else
{
Affiche_Message( wxEmptyString );
msg = _( "Marker Not Found" );
DisplayError( this, msg, 10 );
}
return Marker;
}
/* Find a string in schematic.
* Call to WinEDA_SchematicFrame::FindSchematicItem()
*/
void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
{
int id = event.GetId();
if( id == FIND_SHEET )
m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 0 );
else if( id == FIND_HIERARCHY )
m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 1 );
else if( id == FIND_NEXT )
m_Parent->FindSchematicItem( wxEmptyString, 2 );
Close();
}
/** /**
* Function FindSchematicItem * Finds an item in the schematic matching the search string.
* finds a string in the schematic. *
* @param pattern The text to search for, either in value, reference or * @param event - Find dialog event containing the find parameters.
* elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern, void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event )
int SearchType,
bool mouseWarp )
{ {
SCH_SHEET_PATH* Sheet, * FirstSheet = NULL; static SCH_ITEM* lastItem = NULL;
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
int StartCount;
bool NotFound;
wxPoint firstpos, pos, old_cursor_position;
static int Find_in_hierarchy;
wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint curpos;
bool DoCenterAndRedraw = FALSE;
wxString msg, WildText;
g_LastSearchIsMarker = FALSE; SCH_SHEET_LIST schematic;
wxString msg;
SCH_SHEET_PATH* sheetFoundIn = NULL;
wxFindReplaceData searchCriteria;
if( SearchType == 0 ) searchCriteria.SetFlags( event.GetFlags() );
searchCriteria.SetFindString( event.GetFindString() );
searchCriteria.SetReplaceString( event.GetReplaceString() );
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
{ {
s_OldStringFound = pattern; sheetFoundIn = m_CurrentSheet;
Find_in_hierarchy = FALSE; lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem );
}
else
{
lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem );
} }
if( SearchType == 1 ) if( lastItem != NULL )
{ {
s_OldStringFound = pattern; if( sheetFoundIn != GetSheet() )
Find_in_hierarchy = TRUE;
}
if( SearchType != 2 )
s_ItemsCount = 0;
WildText = s_OldStringFound;
NotFound = TRUE;
StartCount = 0;
SCH_SHEET_LIST SheetList;
Sheet = SheetList.GetFirst();
if( !Find_in_hierarchy )
Sheet = m_CurrentSheet;
for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
{
DrawList = (SCH_ITEM*) Sheet->LastDrawList();
while( DrawList )
{ {
switch( DrawList->Type() ) sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
{ *m_CurrentSheet = *sheetFoundIn;
case TYPE_SCH_COMPONENT:
SCH_COMPONENT * pSch;
pSch = (SCH_COMPONENT*) DrawList;
if( WildCompareString( WildText, pSch->GetRef( Sheet ), FALSE ) )
{
NotFound = FALSE;
pos = pSch->GetField( REFERENCE )->m_Pos;
break;
}
if( WildCompareString( WildText,
pSch->GetField( VALUE )->m_Text,
false ) )
{
NotFound = FALSE;
pos = pSch->GetField( VALUE )->m_Pos;
}
break;
case TYPE_SCH_LABEL:
case TYPE_SCH_GLOBALLABEL:
case TYPE_SCH_HIERLABEL:
case TYPE_SCH_TEXT:
SCH_TEXT * pDraw;
pDraw = (SCH_TEXT*) DrawList;
if( WildCompareString( WildText, pDraw->m_Text, FALSE ) )
{
NotFound = FALSE;
pos = pDraw->m_Pos;
}
break;
default:
break;
}
if( NotFound == FALSE ) /* Item found ! */
{
if( FirstSheet == NULL ) /* First Item found */
{
FirstSheet = Sheet;
firstpos = pos;
FirstStruct = DrawList;
}
StartCount++;
if( s_ItemsCount >= StartCount )
{
NotFound = TRUE; /* Continue search of the next element */
}
else
{
Struct = DrawList;
s_ItemsCount++;
break;
}
}
if( NotFound == FALSE )
break;
DrawList = DrawList->Next();
}
if( NotFound == FALSE )
break;
if( Find_in_hierarchy == FALSE )
break;
}
if( NotFound && FirstSheet )
{
NotFound = FALSE;
Sheet = FirstSheet;
Struct = FirstStruct;
pos = firstpos;
s_ItemsCount = 1;
}
if( NotFound == FALSE )
{
if( Sheet != GetSheet() )
{
Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *Sheet;
ActiveScreen = m_CurrentSheet->LastScreen(); ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE;
} }
/* the struct is a TYPE_SCH_COMPONENT type, sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre();
* coordinates must be computed according to its orientation matrix Recadre_Trace( true );
*/
if( Struct->Type() == TYPE_SCH_COMPONENT )
{
SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct;
pos -= pSch->m_Pos; msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
pos = TransformCoordinate( pSch->m_Transform, pos ); SetStatusText( msg );
pos += pSch->m_Pos;
}
old_cursor_position = Sheet->LastScreen()->m_Curseur;
Sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart(
&( GetScreen()->m_StartVisu.x ),
&( GetScreen()->m_StartVisu.y ) );
curpos -= m_CurrentSheet->LastScreen()->m_StartVisu;
/* There may be need to reframe the drawing */
#define MARGIN 30
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
{
DoCenterAndRedraw = true;
}
if( DoCenterAndRedraw )
Recadre_Trace( mouseWarp );
else
{
INSTALL_DC( dc, DrawPanel );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
if( mouseWarp )
DrawPanel->MouseTo( curpos );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOn( &dc );
}
msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName;
Affiche_Message( msg );
} }
else else
{ {
Affiche_Message( wxEmptyString ); msg.Printf( _( "No item found matching %s." ), GetChars( event.GetFindString() ) );
SetStatusText( msg );
if( !mouseWarp )
{
// if called from RemoteCommand() don't popup the dialog which
// needs to be dismissed, user is in PCBNEW, and doesn't want to
// bother with dismissing the dialog in EESCHEMA.
msg = WildText + _( " Not Found" );
DisplayError( this, msg, 10 );
}
} }
return DrawList;
}
/*
* Search for a given component.
*
* The search is made in loaded libraries, and if not found in all libraries
* found in lib paths.
*/
void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
{
wxArrayString nameList;
wxString Text, FindList;
bool FoundInLib = false;
Text = m_NewTextCtrl->GetValue();
if( Text.IsEmpty() )
{
Close();
return;
}
s_OldStringFound = Text;
if( CMP_LIBRARY::GetLibraryCount() == 0 )
{
DisplayError( this, _( "No component libraries are loaded." ) );
Close();
return;
}
int nbitemsFound = 0;
BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{
nameList.Clear();
lib.SearchEntryNames( nameList, Text );
if( nameList.IsEmpty() )
continue;
nbitemsFound += nameList.GetCount();
if( !lib.IsCache() )
FoundInLib = true;
for( size_t i = 0; i < nameList.GetCount(); i++ )
{
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " ) + nameList[i] + _( " in library " )
+ lib.GetName();
}
}
if( !FoundInLib )
{
if( nbitemsFound )
FindList = wxT( "\n" ) + Text + _( " found only in cache" );
else
FindList = Text + _( " not found" );
FindList += _( "\nExplore All Libraries?" );
if( IsOK( this, FindList ) )
{
FindList.Empty();
ExploreAllLibraries( Text, FindList );
if( FindList.IsEmpty() )
DisplayInfoMessage( this, _( "Nothing found" ) );
else
DisplayInfoMessage( this, FindList );
}
}
else
{
DisplayInfoMessage( this, FindList );
}
Close();
}
int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask,
wxString& FindList )
{
wxString FullFileName;
FILE* file;
int nbitems = 0, LineNum = 0;
char Line[2048], * name;
wxString path;
for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ )
{
path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP;
FullFileName = wxFindFirstFile( path + wxT( "*." ) +
CompLibFileExtension );
while( !FullFileName.IsEmpty() )
{
file = wxFopen( FullFileName, wxT( "rt" ) );
if( file == NULL )
continue;
while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
{
if( strnicmp( Line, "DEF", 3 ) == 0 )
{
/* Read one DEF part from library:
* DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" );
wxString st_name = CONV_FROM_UTF8( name );
if( WildCompareString( wildmask, st_name, FALSE ) )
{
nbitems++;
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
<< _( " in lib " ) << FullFileName;
}
}
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{
/* Read one ALIAS part from library:
* ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
{
wxString st_name = CONV_FROM_UTF8( name );
if( WildCompareString( wildmask, st_name, FALSE ) )
{
nbitems++;
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
<< _( " in lib " ) << FullFileName;
}
}
}
}
fclose( file );
FullFileName = wxFindNextFile();
}
}
return nbitems;
} }

View File

@ -104,11 +104,6 @@ extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo * before it is modified (used for undo
* managing to restore old values ) */ * managing to restore old values ) */
extern bool g_LastSearchIsMarker; /* True if last search is a marker
* search. False for a schematic
* item search. Used for hotkey
* next search. */
/* Block operation (copy, paste) */ /* Block operation (copy, paste) */
extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created
* by Block Save) */ * by Block Save) */

View File

@ -13,6 +13,8 @@
#include "libeditframe.h" #include "libeditframe.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "dialog_schematic_find.h"
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
@ -137,8 +139,10 @@ static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F'
+ GR_KB_CTRL ); + GR_KB_CTRL );
static Ki_HotkeyInfo HkNextSearch( wxT( "Next Search" ), HK_NEXT_SEARCH, static Ki_HotkeyInfo HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM,
WXK_F5 ); WXK_F5 );
static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find next DRC marker" ), HK_FIND_NEXT_DRC_MARKER,
WXK_F5 + GR_KB_SHIFT );
// Special keys for library editor: // Special keys for library editor:
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST,
@ -167,7 +171,8 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
{ {
&HkFindItem, &HkFindItem,
&HkNextSearch, &HkFindNextItem,
&HkFindNextDrcMarker,
&HkDelete, &HkDelete,
&HkInsert, &HkInsert,
&HkMove2Drag, &HkMove2Drag,
@ -345,13 +350,25 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
} }
break; break;
case HK_NEXT_SEARCH: case HK_FIND_NEXT_ITEM:
if( !ItemInEdit ) if( !ItemInEdit )
{ {
if( g_LastSearchIsMarker ) wxFindDialogEvent event( wxEVT_COMMAND_FIND, GetId() );
WinEDA_SchematicFrame::FindMarker( 1 ); event.SetEventObject( this );
else event.SetFlags( m_findReplaceData->GetFlags() );
FindSchematicItem( wxEmptyString, 2 ); event.SetFindString( m_findReplaceData->GetFindString() );
GetEventHandler()->ProcessEvent( event );
}
break;
case HK_FIND_NEXT_DRC_MARKER:
if( !ItemInEdit )
{
wxFindDialogEvent event( EVT_COMMAND_FIND_DRC_MARKER, GetId() );
event.SetEventObject( this );
event.SetFlags( m_findReplaceData->GetFlags() );
event.SetFindString( m_findReplaceData->GetFindString() );
GetEventHandler()->ProcessEvent( event );
} }
break; break;

View File

@ -10,7 +10,8 @@
// see also enum common_hotkey_id_commnand in hotkeys_basic.h // see also enum common_hotkey_id_commnand in hotkeys_basic.h
// for shared hotkeys id // for shared hotkeys id
enum hotkey_id_commnand { enum hotkey_id_commnand {
HK_NEXT_SEARCH = HK_COMMON_END, HK_FIND_NEXT_ITEM = HK_COMMON_END,
HK_FIND_NEXT_DRC_MARKER,
HK_FIND_ITEM, HK_FIND_ITEM,
HK_DELETE, HK_DELETE,
HK_REPEAT_LAST, HK_REPEAT_LAST,

View File

@ -146,5 +146,5 @@ if you want to include it as part of this project." ) );
} // Error } // Error
else else
msg = _( "Error creating " ) + fn.GetFullName(); msg = _( "Error creating " ) + fn.GetFullName();
Affiche_Message( msg ); SetStatusText( msg );
} }

View File

@ -626,5 +626,5 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
msg.Printf( _( "Component %s saved in library %s" ), msg.Printf( _( "Component %s saved in library %s" ),
GetChars( Component->GetName() ), GetChars( Component->GetName() ),
GetChars( m_library->GetName() ) ); GetChars( m_library->GetName() ) );
Affiche_Message( msg ); SetStatusText( msg );
} }

View File

@ -23,13 +23,14 @@
#include "annotate_dialog.h" #include "annotate_dialog.h"
#include "dialog_build_BOM.h" #include "dialog_build_BOM.h"
#include "dialog_erc.h" #include "dialog_erc.h"
#include "dialog_find.h"
#include "netlist_control.h" #include "netlist_control.h"
#include "dialog_erc.h" #include "dialog_erc.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "dialog_schematic_find.h"
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
@ -137,6 +138,12 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_INCH,
WinEDA_SchematicFrame::OnUpdateUnits ) WinEDA_SchematicFrame::OnUpdateUnits )
/* Search dialog events. */
EVT_FIND_CLOSE( wxID_ANY, WinEDA_SchematicFrame::OnFindDialogClose )
EVT_FIND_DRC_MARKER( wxID_ANY, WinEDA_SchematicFrame::OnFindDrcMarker )
EVT_FIND( wxID_ANY, WinEDA_SchematicFrame::OnFindSchematicItem )
END_EVENT_TABLE() END_EVENT_TABLE()
@ -164,6 +171,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_printMonochrome = true; m_printMonochrome = true;
m_showSheetReference = true; m_showSheetReference = true;
m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Schematic_Hokeys_Descr;
m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
CreateScreens(); CreateScreens();
@ -240,8 +249,8 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{ {
SAFE_DELETE( g_RootSheet ); SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); //a SCH_SHEET_PATH, on the heap. SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap.
m_CurrentSheet = NULL; SAFE_DELETE( m_findReplaceData );
} }
@ -604,10 +613,38 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
{ {
wxASSERT_MSG( m_findReplaceData != NULL,
wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
this->DrawPanel->m_IgnoreMouseEvents = TRUE; this->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
dlg->ShowModal(); if( m_dlgFindReplace )
dlg->Destroy(); {
delete m_dlgFindReplace;
m_dlgFindReplace = NULL;
}
m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, m_findDialogPosition,
m_findDialogSize );
m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
m_dlgFindReplace->SetMinSize( m_dlgFindReplace->GetBestSize() );
m_dlgFindReplace->Show( true );
}
void WinEDA_SchematicFrame::OnFindDialogClose( wxFindDialogEvent& event )
{
if( m_dlgFindReplace )
{
m_findDialogPosition = m_dlgFindReplace->GetPosition();
m_findDialogSize = m_dlgFindReplace->GetSize();
m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
m_dlgFindReplace->Destroy();
m_dlgFindReplace = NULL;
}
this->DrawPanel->m_IgnoreMouseEvents = FALSE; this->DrawPanel->m_IgnoreMouseEvents = FALSE;
} }

View File

@ -938,7 +938,7 @@ static void ComputeArcRadiusAngles( LIB_ARC* arc )
wxPoint centerStartVector = TwoPointVector( arc->m_Pos, arc->m_ArcStart ); wxPoint centerStartVector = TwoPointVector( arc->m_Pos, arc->m_ArcStart );
wxPoint centerEndVector = TwoPointVector( arc->m_Pos, arc->m_ArcEnd ); wxPoint centerEndVector = TwoPointVector( arc->m_Pos, arc->m_ArcEnd );
arc->m_Radius = EuclideanNorm( centerStartVector ); arc->m_Radius = wxRound( EuclideanNorm( centerStartVector ) );
arc->m_t1 = (int) ( atan2( (double) centerStartVector.y, arc->m_t1 = (int) ( atan2( (double) centerStartVector.y,
(double) centerStartVector.x ) * 1800 / M_PI ); (double) centerStartVector.x ) * 1800 / M_PI );

View File

@ -157,7 +157,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
} }
msg.Printf( _( "Saving symbol in [%s]" ), GetChars( fn.GetPath() ) ); msg.Printf( _( "Saving symbol in [%s]" ), GetChars( fn.GetPath() ) );
Affiche_Message( msg ); SetStatusText( msg );
wxString line; wxString line;

View File

@ -300,18 +300,28 @@ int GetCommandOptions( const int argc, const char** argv,
*/ */
const wxString& valeur_param( int valeur, wxString& buf_texte ); const wxString& valeur_param( int valeur, wxString& buf_texte );
wxString ReturnUnitSymbol( int Units = g_UnitMetric ); /**
* Returns the units symbol.
*
* @param aUnits - Units type, default is current units setting.
* @param aFormatString - A formatting string to embed the units symbol into. Note:
* the format string must contain the %s format specifier.
* @return The formatted units symbol.
*/
wxString ReturnUnitSymbol( int aUnits = g_UnitMetric,
const wxString& aFormatString = _( " (%s):" ) );
/** /**
* Get a human readable units string. * Get a human readable units string.
* *
* The strings returned are full text name and not abbreviations or symbolic * The strings returned are full text name and not abbreviations or symbolic
* representations of units. Set ReturnUnitSymbol() for that. * representations of the units. Use ReturnUnitSymbol() for that.
* *
* @param units - The units text to return. * @param aUnits - The units text to return.
* @return The human readable units string. * @return The human readable units string.
*/ */
wxString GetUnitsLabel( int units ); wxString GetUnitsLabel( int aUnits );
wxString GetAbbreviatedUnitsLabel( int aUnits = g_UnitMetric );
int ReturnValueFromString( int Units, const wxString& TextValue, int ReturnValueFromString( int Units, const wxString& TextValue,
int Internal_Unit ); int Internal_Unit );

View File

@ -7,6 +7,7 @@
class WinEDA_SchematicFrame; class WinEDA_SchematicFrame;
class wxFindReplaceData;
/** /**
@ -33,6 +34,7 @@ public:
} }
SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; } SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; }
SCH_ITEM* Back() { return (SCH_ITEM*) Pback; }
/** /**
* Function GetLayer * Function GetLayer
@ -86,6 +88,30 @@ public:
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
virtual bool Save( FILE* aFile ) const = 0; virtual bool Save( FILE* aFile ) const = 0;
/**
* Compare schematic item against search string.
*
* The base class returns false since many of the objects derived from
* SCH_ITEM do not have any text to search.
*
* @todo - This should probably be pushed down to EDA_BaseStruct so that
* searches can be done on all of the Kicad applications that use
* objects derived from EDA_BaseStruct.
*
* @param aSearchData - The search criteria.
* @return True if this schematic text item matches the search criteria.
*/
virtual bool Matches( wxFindReplaceData& aSearchData ) { return false; }
/**
* Compare schematic item against search string.
*
* @param aText - String test.
* @param aSearchData - The criteria to search against.
* @return True if this item matches the search criteria.
*/
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData );
}; };
#endif /* SCH_ITEM_STRUCT_H */ #endif /* SCH_ITEM_STRUCT_H */

View File

@ -32,6 +32,10 @@ class SCH_COMPONENT;
class SCH_FIELD; class SCH_FIELD;
class LIB_PIN; class LIB_PIN;
class SCH_JUNCTION; class SCH_JUNCTION;
class DIALOG_SCH_FIND;
class wxFindDialogEvent;
class wxFindReplaceData;
/* enum used in RotationMiroir() */ /* enum used in RotationMiroir() */
enum fl_rot_cmp enum fl_rot_cmp
@ -73,12 +77,18 @@ private:
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings; PARAM_CFG_ARRAY m_configSettings;
wxPageSetupDialogData m_pageSetupData; wxPageSetupDialogData m_pageSetupData;
wxFindReplaceData* m_findReplaceData;
wxPoint m_previewPosition; wxPoint m_previewPosition;
wxSize m_previewSize; wxSize m_previewSize;
wxPoint m_printDialogPosition; wxPoint m_printDialogPosition;
wxSize m_printDialogSize; wxSize m_printDialogSize;
bool m_printMonochrome; ///< Print monochrome instead of grey scale. bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_showSheetReference; bool m_showSheetReference;
DIALOG_SCH_FIND* m_dlgFindReplace;
wxPoint m_findDialogPosition;
wxSize m_findDialogSize;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
public: public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_SchematicFrame( wxWindow* father,
@ -268,22 +278,6 @@ public:
// General search: // General search:
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or
* elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
SCH_ITEM* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
SCH_ITEM* FindMarker( int SearchType );
private: private:
void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ); void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
@ -292,6 +286,10 @@ private:
void OnCreateNetlist( wxCommandEvent& event ); void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event ); void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event ); void OnFindItems( wxCommandEvent& event );
void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event );
void OnFindCompnentInLib( wxFindDialogEvent& event );
void OnFindSchematicItem( wxFindDialogEvent& event );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event ); void OnLoadStuffFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event ); void OnNewProject( wxCommandEvent& event );