Commit 1bbc009d authored by stambaughw's avatar stambaughw

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.
parent 8931b1fc
......@@ -45,11 +45,6 @@ C2) Write a tool to generate DSNLEXER keyword tables (and enums) as *.cpp and
CMake.
Wayne:
C1) Fix mouse wheel scrolling (ctrl + Mouse wheel) and (Shift + mouse wheel)
to move more than a single scroll increment.
CvPCB
-----
* Preview of the already assigned footprint.
......@@ -61,8 +56,18 @@ EESchema
* Drag and drop between two EESchema windows.
Wayne:
E1) Relpace find dialog with wxFormBuilder version using a modeless dialog
and event driven design similar to wxFindReplaceDialog implementation.
E2) Finish adding replace capability to new Find dialog.
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
......@@ -118,27 +123,3 @@ L8) LAYER_WIDGET::GetBestSize() needs platform independence.
L9) On board load, ReFill() is called, this should also update the Render
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.
......@@ -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;
switch( Units )
switch( aUnits )
{
case INCHES:
label = _( " (\"):" );
tmp = _( "\"" );
break;
case MILLIMETRE:
label = _( " (mm):" );
tmp = _( "mm" );
break;
default:
tmp = _( "??" );
break;
}
if( formatString.IsEmpty() )
return tmp;
label.Printf( formatString, GetChars( tmp ) );
return label;
}
wxString GetUnitsLabel( int units )
wxString GetUnitsLabel( int aUnits )
{
wxString label;
switch( units )
switch( aUnits )
{
case INCHES:
label = _( "inches" );
......@@ -260,6 +267,7 @@ wxString GetUnitsLabel( int units )
case CENTIMETRE:
label = _( "centimeters" );
break;
default:
label = _( "Unknown" );
break;
......@@ -268,6 +276,34 @@ wxString GetUnitsLabel( int units )
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.
* Used in dialog boxes for entering values depending on selected units
......
......@@ -15,6 +15,9 @@
#include "general.h"
#include "protos.h"
#include "../eeschema/dialog_schematic_find.h"
/* Constructor and destructor for SCH_ITEM */
/* They are not inline because this creates problems with gcc at linking time
* in debug mode
......@@ -60,3 +63,26 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
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;
}
......@@ -247,10 +247,10 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
else
{
if( g_UnitMetric == 0 ) // inches
msg.Printf( wxT( "%.1f mils\t(%.3f mm)" ),
msg.Printf( wxT( "%.1f mils, (%.3f mm)" ),
gridValueInch * 1000, gridValue_mm );
else
msg.Printf( wxT( "%.3f mm\t(%.1f mils)" ),
msg.Printf( wxT( "%.3f mm, (%.1f mils)" ),
gridValue_mm, gridValueInch * 1000 );
}
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
......
......@@ -56,7 +56,6 @@ set(EESCHEMA_SRCS
dialog_eeschema_options.cpp
dialog_erc.cpp
dialog_erc_base.cpp
# dialog_find.cpp
dialog_lib_edit_draw_item.cpp
dialog_lib_edit_draw_item_base.cpp
dialog_lib_edit_pin.cpp
......@@ -67,6 +66,8 @@ set(EESCHEMA_SRCS
dialog_print_using_printer.cpp
dialog_sch_sheet_props.cpp
dialog_sch_sheet_props_base.cpp
dialog_schematic_find.cpp
dialog_schematic_find_base.cpp
dialog_SVG_print.cpp
dialog_SVG_print_base.cpp
edit_component_in_lib.cpp
......
......@@ -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)
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
{
......
......@@ -28,9 +28,10 @@ public:
// m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename
public: SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
public:
SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~SCH_SHEET_PIN() { }
......@@ -107,6 +108,14 @@ public: SCH_SHEET_PIN( SCH_SHEET* parent,
NEGATE( m_Pos.x );
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 );
/**
* 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)
// comment inherited by Doxygen from Base_Struct
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
......@@ -13,6 +12,9 @@
#include "common.h"
#include "program.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)
* @return true if success else false
*/
bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue(
const wxString& aPath,
bool aFound )
bool SCH_SHEET_PATH::BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound )
{
if( aFound )
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
* store (push) aSheet 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 )
{
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 )
{
......@@ -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 )
{
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
* @return the item (sheet) in aIndex position in m_List or NULL if less than
* index items
......@@ -372,3 +519,137 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
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;
}
......@@ -50,6 +50,9 @@
*/
class SCH_MARKER;
/****************************************/
/* class to handle and access to a sheet */
/* a 'path' so to speak.. */
......@@ -72,9 +75,11 @@ public:
#define DSLSZ 32 // Max number of levels for a sheet path
SCH_SHEET * m_sheets[DSLSZ];
public: SCH_SHEET_PATH();
public:
SCH_SHEET_PATH();
~SCH_SHEET_PATH() { };
void Clear()
void Clear()
{
m_numSheets = 0;
}
......@@ -110,6 +115,14 @@ public: SCH_SHEET_PATH();
*/
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
* store (push) aSheet in list
* @param aSheet = pointer to the SCH_SHEET to store in list
......@@ -161,6 +174,39 @@ public: SCH_SHEET_PATH();
*/
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 );
......@@ -228,6 +274,21 @@ public:
*/
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
* @return the item (sheet) in aIndex position in m_List or NULL if less
* than index items
......@@ -235,6 +296,45 @@ public:
*/
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:
/** Function BuildSheetList
......
......@@ -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)
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
{
......
......@@ -252,19 +252,23 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
continue;
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 ) )
{
if( cparent )
msg = cparent->GetName();
else
msg = _( "unknown" );
wxString msg1;
wxString parentName;
if( cparent )
parentName = cparent->GetName();
else
parentName = _("not found");
msg1.Printf( _("alias <%s> already exists and has root name<%s>"),
GetChars( alias->GetName() ),
GetChars( parentName ) );
msg << msg1 << wxT("\n");
msg1.Printf( _( "alias <%s> already exists and has root name<%s>" ),
GetChars( alias->GetName() ),
GetChars( parentName ) );
msg << msg1 << wxT( "\n" );
conflict_count++;
}
......@@ -278,10 +282,10 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
wxString msg1;
title.Printf( _( "Conflict in library <%s>"), GetChars( fileName.GetName()));
msg1.Printf( _("and appears in alias list of current component <%s>." ),
GetChars( newCmp->GetName() ) );
msg << wxT("\n\n") << msg1;
msg << wxT("\n\n") << _("All old aliases will be removed. Continue ?");
int diag = wxMessageBox(msg, title, wxYES | wxICON_QUESTION);
GetChars( newCmp->GetName() ) );
msg << wxT( "\n\n" ) << msg1;
msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" );
int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION );
if( diag != wxYES )
return NULL;
}
......@@ -299,7 +303,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
}
else
{
LIB_COMPONENT* cparent = alias->GetComponent();
LIB_COMPONENT* cparent = alias->GetComponent();
if( cparent == NULL || // Lib error, should not occurs
( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) )
......
......@@ -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
* returns the orthogonal, bounding box of this object for display purposes.
......
......@@ -99,6 +99,14 @@ public:
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)
void Show( int nestLevel, std::ostream& os );
#endif
......
......@@ -418,3 +418,9 @@ void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
frame->OnModify( );
frame->SetCurrentField( NULL );
}
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData )
{
return SCH_ITEM::Matches( m_Text, aSearchData );
}
......@@ -114,6 +114,14 @@ public:
* this function is only needed by the virtual pure function of the
* 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 );
};
......
......@@ -12,6 +12,7 @@
#include "macros.h"
#include "protos.h"
#include "class_library.h"
#include "dialog_schematic_find.h"
#include <wx/tokenzr.h>
......@@ -1150,3 +1151,23 @@ void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
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;
}
......@@ -349,6 +349,14 @@ public:
*/
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)
/**
......
......@@ -181,6 +181,12 @@ wxPoint SCH_TEXT::GetSchematicTextOffset()
}
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData )
{
return SCH_ITEM::Matches( m_Text, aSearchData );
}
/** function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself
* position
......
......@@ -145,6 +145,14 @@ public:
*/
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)
void Show( int nestLevel, std::ostream& os );
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.cpp
// Author: jean-pierre Charras
// Modified by:
......@@ -19,31 +18,32 @@
#include "dialog_edit_label.h"
/*************************************************************************/
void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct )
{
/*************************************************************************/
/* 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;
DialogLabelEditor dialog( this, TextStruct );
dialog.ShowModal();
DialogLabelEditor dialog( this, aTextItem );
dialog.ShowModal();
}
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) :
DialogLabelEditor_Base( parent )
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* aParent, SCH_TEXT* aTextItem ) :
DialogLabelEditor_Base( aParent )
{
m_Parent = parent;
m_CurrentText = CurrentText;
m_Parent = aParent;
m_CurrentText = aTextItem;
InitDialog();
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
Layout();
Fit();
SetMinSize( GetBestSize() );
Centre();
}
......@@ -51,22 +51,26 @@ DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* C
void DialogLabelEditor::InitDialog()
{
wxString msg;
bool multine = false;
bool multiLine = false;
if( m_CurrentText->m_MultilineAllowed )
{
m_TextLabel = m_textCtrlMultiline;
m_TextLabelSingleline->Show(false);
multine = true;
}
else
{
m_TextLabel = m_TextLabelSingleline;
m_textCtrlMultiline->Show(false);
/* Multiline text edit control must be created because changing the text
* control style to multiline must be done when the control is created.
*/
m_textControlSizer->Detach( m_textLabel );
m_textLabel->Destroy();
m_textLabel = NULL;
m_textLabel = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
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->SetFocus();
m_textLabel->SetValue( m_CurrentText->m_Text );
m_textLabel->SetFocus();
switch( m_CurrentText->Type() )
{
......@@ -76,7 +80,6 @@ void DialogLabelEditor::InitDialog()
case TYPE_SCH_HIERLABEL:
SetTitle( _( "Hierarchal Label Properties" ) );
m_TextShape->SetLabel( _("Hlabel Shape") );
break;
case TYPE_SCH_LABEL:
......@@ -85,34 +88,38 @@ void DialogLabelEditor::InitDialog()
default:
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;
}
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 )
{
wxString textWidth;
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
{
// calculate the lenght of the biggest line
// we cannot use the lenght of the entire text that has no meaning
// calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning
int max_len = 0;
int curr_len = 0;
int imax = m_CurrentText->m_Text.Len();
for( int count = 0; count < imax; count++ )
{
if( m_CurrentText->m_Text[count] == '\n' ||
m_CurrentText->m_Text[count] == '\r' ) // new line
{
curr_len = 0;
}
m_CurrentText->m_Text[count] == '\r' ) // new line
{
curr_len = 0;
}
else
{
curr_len++;
......@@ -122,7 +129,7 @@ void DialogLabelEditor::InitDialog()
}
wxString textWidth;
textWidth.Append( 'M', max_len );
EnsureTextCtrlWidth( m_TextLabel, &textWidth );
EnsureTextCtrlWidth( m_textLabel, &textWidth );
}
// Set validators
......@@ -137,10 +144,12 @@ void DialogLabelEditor::InitDialog()
m_TextStyle->SetSelection( style );
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol();
m_SizeTitle->SetLabel( msg );
wxString units = ReturnUnitSymbol( g_UnitMetric, wxT( "(%s)" ) );
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 );
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
*/
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
{
TextPropertiesAccept( event );
EndModal( wxID_OK );
TextPropertiesAccept( aEvent );
}
......@@ -174,16 +184,15 @@ void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent )
{
m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( wxID_CANCEL );
}
/****************************************************************************/
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
{
/****************************************************************************/
wxString text;
int value;
......@@ -193,7 +202,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PostDirtyRect( m_CurrentText->GetBoundingBox() );
text = m_TextLabel->GetValue();
text = m_textLabel->GetValue();
if( !text.IsEmpty() )
m_CurrentText->m_Text = text;
else if( (m_CurrentText->m_Flags & IS_NEW) == 0 )
......@@ -201,8 +210,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UnitMetric, text,
m_Parent->m_InternalUnits );
value = ReturnValueFromString( g_UnitMetric, text, m_Parent->m_InternalUnits );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape )
m_CurrentText->m_Shape = m_TextShape->GetSelection();
......@@ -224,7 +232,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& event )
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 */
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->MouseToCursorSchema();
EndModal( 0 );
EndModal( wxID_OK );
}
......@@ -13,12 +13,11 @@
class DialogLabelEditor : public DialogLabelEditor_Base
{
private:
WinEDA_SchematicFrame * m_Parent;
SCH_TEXT * m_CurrentText;
wxTextCtrl* m_TextLabel;
WinEDA_SchematicFrame* m_Parent;
SCH_TEXT* m_CurrentText;
public:
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem );
~DialogLabelEditor(){};
......@@ -26,10 +25,10 @@ public:
private:
void InitDialog( );
void onEnterKey( wxCommandEvent& event );
void OnButtonOKClick( wxCommandEvent& event );
void OnButtonCANCEL_Click( wxCommandEvent& event );
void TextPropertiesAccept( wxCommandEvent& event );
virtual void OnEnterKey( wxCommandEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
void TextPropertiesAccept( wxCommandEvent& aEvent );
};
......
......@@ -16,78 +16,82 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
wxBoxSizer* bMainSizer;
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 );
bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 );
m_textLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_textLabel->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_textLabel, 0, wxEXPAND|wxLEFT, 3 );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 );
m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
bMainSizer->Add( m_TextLabelSingleline, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
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_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") );
m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) );
m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 );
bMainSizer->Add( m_textCtrlMultiline, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") };
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_OptionsSizer->Add( m_TextOrient, 1, wxALL, 5 );
m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 );
wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
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_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 );
m_TextShape = new wxRadioBox( this, wxID_ANY, _("Glabel Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 0 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 );
bSizer4->Add( m_SizeTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
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_TextShape = new wxRadioBox( this, wxID_ANY, _("S&hape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 2 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 );
m_OptionsSizer->Add( bSizer4, 1, 0, 5 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_TextLabelSingleline->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_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
m_textLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
}
DialogLabelEditor_Base::~DialogLabelEditor_Base()
{
// Disconnect Events
m_TextLabelSingleline->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_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this );
}
This diff is collapsed.
......@@ -17,9 +17,9 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -38,26 +38,27 @@ class DialogLabelEditor_Base : public wxDialog
wxID_SIZE,
};
wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_staticText1;
wxTextCtrl* m_TextLabelSingleline;
wxTextCtrl* m_textCtrlMultiline;
wxTextCtrl* m_textLabel;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
wxStaticText* m_staticSizeUnits;
wxRadioBox* m_TextOrient;
wxRadioBox* m_TextStyle;
wxRadioBox* m_TextShape;
wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize;
wxButton* m_buttonOK;
wxButton* m_buttonCANCEL;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void onEnterKey( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); }
virtual void OnEnterKey( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
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();
};
......
/////////////////////////////////////////////////////////////////////////////
// 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);
}
/////////////////////////////////////////////////////////////////////////////
// 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_
This diff is collapsed.
This diff is collapsed.
#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 );
}
#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__
///////////////////////////////////////////////////////////////////////////
// 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 );
}
///////////////////////////////////////////////////////////////////////////
// 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__
This diff is collapsed.
......@@ -33,10 +33,6 @@ SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo
* 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_SELECTOR g_BlockSaveDataList; // List of items to paste
// (Created by Block Save)
......
This diff is collapsed.
......@@ -97,7 +97,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
screen->m_FileName = FullFileName;
g_RootSheet->SetFileName( FullFileName );
Affiche_Message( wxEmptyString );
SetStatusText( wxEmptyString );
ClearMsgPanel();
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
......
This diff is collapsed.
......@@ -104,11 +104,6 @@ extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo
* 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) */
extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created
* by Block Save) */
......
This diff is collapsed.
This diff is collapsed.
......@@ -146,5 +146,5 @@ if you want to include it as part of this project." ) );
} // Error
else
msg = _( "Error creating " ) + fn.GetFullName();
Affiche_Message( msg );
SetStatusText( msg );
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment