Commit 7e7a7937 authored by CHARRAS's avatar CHARRAS

some changes about zones: enhanced dialog, and files reorganisation

parent fdb2905b
/* XPM */
#ifndef XPMMAIN
extern const char *fill_zone_xpm[];
#else
const char *fill_zone_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 15 1",
"# c #FCFEFC",
"@ c #ACBEFC",
"O c #444A5C",
"$ c #645AEC",
"X c #040204",
"o c #ECEAEC",
". c #F4F2F4",
" c None",
"+ c #C4C6CC",
"& c #6476C4",
"* c #A4A2AC",
"= c #848A9C",
"; c #646674",
"% c #8496F4",
"- c #7C7E8C",
/* pixels */
" . XX . .. .",
" oX X o o ",
" X OXX o ",
"oo oXO+X X@@ooo ",
" O+.X#.X$%@oo",
" o O+.#X..+X$%@o",
"o O+.##..+*=X$%@",
"&O+.##..+*=-;$%@",
"O+.##..+*=-;X$%@",
" X+#. +*=-;X&$%@",
" X+.+*=-;X &$%@",
" X=*=-;X &$%@",
" X;-;X &$%&",
" X;X &$% ",
" X $% ",
" $% "
};
#endif
...@@ -4,6 +4,11 @@ Started 2007-June-11 ...@@ -4,6 +4,11 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Dec-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
some changes about zones: enhanced dialog, and files reorganisation.
2007-Dec-14 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Dec-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -155,13 +155,16 @@ void FootprintListBox::SetSelection( unsigned index, bool State ) ...@@ -155,13 +155,16 @@ void FootprintListBox::SetSelection( unsigned index, bool State )
if( (int) index >= GetCount() ) if( (int) index >= GetCount() )
index = GetCount() - 1; index = GetCount() - 1;
if ( (index >= 0) && (GetCount() > 0) )
{
#ifndef __WXMAC__ #ifndef __WXMAC__
Select( index, State ); Select( index, State );
#endif #endif
EnsureVisible( index ); EnsureVisible( index );
#ifdef __WXMAC__ #ifdef __WXMAC__
Refresh(); Refresh();
#endif #endif
}
} }
...@@ -256,13 +259,16 @@ void ListBoxCmp::SetSelection( unsigned index, bool State ) ...@@ -256,13 +259,16 @@ void ListBoxCmp::SetSelection( unsigned index, bool State )
if( (int) index >= GetCount() ) if( (int) index >= GetCount() )
index = GetCount() - 1; index = GetCount() - 1;
if ( (index >= 0) && (GetCount() > 0) )
{
#ifndef __WXMAC__ #ifndef __WXMAC__
Select( index, State ); Select( index, State );
#endif #endif
EnsureVisible( index ); EnsureVisible( index );
#ifdef __WXMAC__ #ifdef __WXMAC__
Refresh(); Refresh();
#endif #endif
}
} }
......
This diff is collapsed.
...@@ -183,6 +183,7 @@ ...@@ -183,6 +183,7 @@
#include "../bitmaps/transistor.xpm" #include "../bitmaps/transistor.xpm"
#include "../bitmaps/kicad_icon_small.xpm" #include "../bitmaps/kicad_icon_small.xpm"
#include "../bitmaps/general_ratsnet.xpm" #include "../bitmaps/general_ratsnet.xpm"
#include "../bitmaps/fill_zone.xpm"
// Largeur du toolbar vertical // Largeur du toolbar vertical
#define VTOOLBAR_WIDTH 26 #define VTOOLBAR_WIDTH 26
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE #ifdef EDA_BASE
(wxT("(2007-12-08)")) (wxT("(2007-12-17)"))
#endif #endif
; ;
......
...@@ -383,7 +383,7 @@ void TreePrjItemData::Activate(WinEDA_PrjFrame* prjframe) ...@@ -383,7 +383,7 @@ void TreePrjItemData::Activate(WinEDA_PrjFrame* prjframe)
} }
if(count == 0) if(count == 0)
{ {
prjframe->AddFile(wxString( wxT("no kicad files found in this directory") ), id); prjframe->AddFile(wxString(_("no kicad files found in this directory")), id);
} }
/* Sort filenames by alphabetic order */ /* Sort filenames by alphabetic order */
m_Parent->SortChildren( id ); m_Parent->SortChildren( id );
......
...@@ -121,9 +121,6 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) ...@@ -121,9 +121,6 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
D(printf("CursorGoto end x=%d, y=%d\n",
m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );)
} }
......
...@@ -650,8 +650,86 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const ...@@ -650,8 +650,86 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const
} }
/* Two sort functions used in BOARD::ReturnSortedNetnamesList */
// Sort nets by name
int s_SortByNames(const void * ptr1, const void * ptr2)
{
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
return item1->m_Netname.CmpNoCase(item2->m_Netname);
}
// Sort nets by decreasing pad count
int s_SortByNodes(const void * ptr1, const void * ptr2)
{
EQUIPOT* item1 = * (EQUIPOT**) ptr1;
EQUIPOT* item2 = * (EQUIPOT**) ptr2;
if ( (item1->m_NbNodes - item2->m_NbNodes) != 0 )
return - (item1->m_NbNodes - item2->m_NbNodes);
return item1->m_Netname.CmpNoCase(item2->m_Netname);
}
/**
* Function ReturnSortedNetnamesList
* searches for a net with the given netcode.
* @param aNames An array string to fill with net names.
* @param aSort_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count.
* @return int - net names count.
*/
int BOARD::ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type)
{
int NetCount = 0;
int ii;
EQUIPOT* net;
/* count items to list and sort */
for( net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
NetCount++;
}
if ( NetCount == 0 ) return 0;
/* Build the list */
EQUIPOT* * net_ptr_list = (EQUIPOT* *) MyMalloc( NetCount * sizeof(* net_ptr_list) );
for( ii = 0, net = m_Equipots; net; net=net->Next() )
{
if ( net->m_Netname.IsEmpty() ) continue;
net_ptr_list[ii] = net;
ii++;
}
/* sort the list */
switch ( aSort_Type )
{
case NO_SORT : break;
case ALPHA_SORT :
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNames);
break;
case PAD_CNT_SORT:
qsort (net_ptr_list, NetCount, sizeof(EQUIPOT*), s_SortByNodes);
break;
}
/* fill the given list */
for( ii = 0; ii < NetCount; ii++ )
{
net = net_ptr_list[ii];
aNames.Add(net->m_Netname);
}
MyFree(net_ptr_list);
return NetCount;
}
/************************************/
bool BOARD::Save( FILE* aFile ) const bool BOARD::Save( FILE* aFile ) const
/************************************/
{ {
bool rc = false; bool rc = false;
BOARD_ITEM* item; BOARD_ITEM* item;
......
...@@ -48,8 +48,7 @@ public: ...@@ -48,8 +48,7 @@ public:
CHEVELU* m_Ratsnest; // Rastnest list CHEVELU* m_Ratsnest; // Rastnest list
CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint
EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments EDGE_ZONE* m_CurrentLimitZone; /* zone contour currently in progress */
* de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD(); ~BOARD();
...@@ -175,6 +174,20 @@ public: ...@@ -175,6 +174,20 @@ public:
*/ */
EQUIPOT* FindNet( int aNetcode ) const; EQUIPOT* FindNet( int aNetcode ) const;
/**
* Function ReturnSortedNetnamesList
* searches for a net with the given netcode.
* @param aNames An array string to fill with net names.
* @param aSort_Type : NO_SORT = no sort, ALPHA_SORT = sort by alphabetic order, PAD_CNT_SORT = sort by active pads count.
* @return int - net names count.
*/
enum netname_sort_type {
NO_SORT,
ALPHA_SORT,
PAD_CNT_SORT
};
int ReturnSortedNetnamesList( wxArrayString & aNames, const int aSort_Type);
/** /**
* Function Save * Function Save
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_zones_by_polygon.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 25/01/2006 11:35:19
// RCS-ID:
// Copyright: GNU License
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 25/01/2006 11:35:19
#ifndef DIALOG_ZONES_H_
#define DIALOG_ZONES_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "dialog_zones_by_polygon.h"
#endif
/*!
* Includes
*/
////@begin includes
#include "wx/valgen.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_RADIOBOX3 10003
#define ID_TEXTCTRL1 10007
#define ID_RADIOBOX4 10008
#define ID_RADIOBOX5 10009
#define ID_BUTTON 10010
#define ID_NET_SORTING_OPTION 10005
#define ID_NETNAME_SELECTION 10001
#define wxID_LAYER_SELECTION 10004
#define ID_LAYER_CHOICE 10002
#define SYMBOL_WINEDA_ZONEFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_ZONEFRAME_TITLE _("Fill Zones Options")
#define SYMBOL_WINEDA_ZONEFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_ZONEFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_ZONEFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
/*!
* WinEDA_ZoneFrame class declaration
*/
class WinEDA_ZoneFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_ZoneFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_ZoneFrame( );
WinEDA_ZoneFrame( WinEDA_PcbFrame* parent, wxWindowID id = SYMBOL_WINEDA_ZONEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_ZONEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_ZONEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_ZONEFRAME_SIZE, long style = SYMBOL_WINEDA_ZONEFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_ZONEFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_ZONEFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_ZONEFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_ZONEFRAME_SIZE, long style = SYMBOL_WINEDA_ZONEFRAME_STYLE );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_ZoneFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
void ExecFillZone( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_NET_SORTING_OPTION
void OnNetSortingOptionSelected( wxCommandEvent& event );
////@end WinEDA_ZoneFrame event handler declarations
////@begin WinEDA_ZoneFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_ZoneFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin WinEDA_ZoneFrame member variables
wxRadioBox* m_GridCtrl;
wxStaticText* m_ClearanceValueTitle;
wxTextCtrl* m_ZoneClearanceCtrl;
wxRadioBox* m_FillOpt;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_NetSortingOption;
wxListBox* m_ListNetNameSelection;
wxListBox* m_LayerSelectionCtrl;
////@end WinEDA_ZoneFrame member variables
WinEDA_PcbFrame * m_Parent;
int m_LayerId[LAYER_COUNT]; // Handle the real layer number from layer name position in m_LayerSelectionCtrl
};
#endif // DIALOG_ZONES_H_
This diff is collapsed.
This diff is collapsed.
EXTRALIBS = ../common/common.a EXTRALIBS = ../common/common.a
EXTRACPPFLAGS += -DPCBNEW -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../share -I../pcbnew -I../3d-viewer EXTRACPPFLAGS += -DPCBNEW -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../share\
-I../pcbnew -I../3d-viewer -I../polygon
#COMMON = pcbnew.h struct.h class_pad.h class_module.h class_text_mod.h \ #COMMON = pcbnew.h struct.h class_pad.h class_module.h class_text_mod.h \
# class_edge_mod.h class_equipot.h # class_edge_mod.h class_equipot.h
LIBVIEWER3D = ../3d-viewer/3d-viewer.a LIBVIEWER3D = ../3d-viewer/3d-viewer.a
ZONE_FILES = zones_by_polygon.o
#ZONE_FILES = zones.o
OBJECTS= $(TARGET).o classpcb.o\ OBJECTS= $(TARGET).o classpcb.o\
$(ZONE_FILES)\
filling_zone_algorithm.o\
lay2plot.o\ lay2plot.o\
modedit_undo_redo.o\ modedit_undo_redo.o\
block_module_editor.o\ block_module_editor.o\
...@@ -86,7 +92,7 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -86,7 +92,7 @@ OBJECTS= $(TARGET).o classpcb.o\
autorout.o solve.o\ autorout.o solve.o\
work.o queue.o \ work.o queue.o \
board.o dist.o graphpcb.o \ board.o dist.o graphpcb.o \
zones.o undelete.o \ undelete.o \
copy_track.o\ copy_track.o\
move_or_drag_track.o\ move_or_drag_track.o\
ioascii.o \ ioascii.o \
...@@ -109,6 +115,10 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -109,6 +115,10 @@ OBJECTS= $(TARGET).o classpcb.o\
hotkeys.o \ hotkeys.o \
collectors.o collectors.o
PolyLine.o: ../polygon/PolyLine.cpp ../polygon/PolyLine.h $(COMMON)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../polygon/$*.cpp
setpage.o: ../share/setpage.cpp setpage.o: ../share/setpage.cpp
$(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp $(CXX) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
...@@ -277,6 +287,9 @@ graphpcb.o: graphpcb.cpp cell.h autorout.h $(COMMON) ...@@ -277,6 +287,9 @@ graphpcb.o: graphpcb.cpp cell.h autorout.h $(COMMON)
zones.o: zones.cpp cell.h $(COMMON) zones.o: zones.cpp cell.h $(COMMON)
zones_by_polygon.o: zones_by_polygon.cpp dialog_zones_by_polygon.cpp dialog_zones_by_polygon.h $(COMMON)
undelete.o: undelete.cpp $(COMMON) undelete.o: undelete.cpp $(COMMON)
move_or_drag_track.o: move_or_drag_track.cpp $(COMMON) move_or_drag_track.o: move_or_drag_track.cpp $(COMMON)
......
...@@ -355,7 +355,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -355,7 +355,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
{ {
bool add_separator = FALSE; bool add_separator = FALSE;
aPopMenu->Append( ID_POPUP_PCB_FILL_ZONE, _( "Fill zone" ) ); ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill zone" ), fill_zone_xpm );
if( item if( item
&& ( (item->Type() == TYPEPAD) && ( (item->Type() == TYPEPAD)
......
...@@ -43,10 +43,6 @@ bool WinEDA_App::OnInit() ...@@ -43,10 +43,6 @@ bool WinEDA_App::OnInit()
return false; return false;
} }
/* Add image handlers for screen hardcopy */
wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxJPEGHandler );
ScreenPcb = new PCB_SCREEN( PCB_FRAME ); ScreenPcb = new PCB_SCREEN( PCB_FRAME );
GetSettings(); GetSettings();
......
This diff is collapsed.
...@@ -49,18 +49,17 @@ ...@@ -49,18 +49,17 @@
////@begin control identifiers ////@begin control identifiers
#define ID_DIALOG 10000 #define ID_DIALOG 10000
// #define SYMBOL_WINEDA_ZONEFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxSTAY_ON_TOP|wxCLOSE_BOX
#define SYMBOL_WINEDA_ZONEFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_ZONEFRAME_TITLE _("Fill Zones Options")
#define SYMBOL_WINEDA_ZONEFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_ZONEFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_ZONEFRAME_POSITION wxDefaultPosition
#define ID_RADIOBOX 10001 #define ID_RADIOBOX 10001
#define ID_TEXTCTRL 10006 #define ID_TEXTCTRL 10006
#define ID_RADIOBOX1 10004 #define ID_RADIOBOX1 10004
#define ID_RADIOBOX2 10005 #define ID_RADIOBOX2 10005
#define ID_FILL_ZONE 10002 #define ID_FILL_ZONE 10002
#define ID_SET_OPTIONS_ZONE 10003 #define ID_SET_OPTIONS_ZONE 10003
#define SYMBOL_WINEDA_ZONEFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_ZONEFRAME_TITLE _("Fill Zones Options")
#define SYMBOL_WINEDA_ZONEFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_ZONEFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_ZONEFRAME_POSITION wxDefaultPosition
////@end control identifiers ////@end control identifiers
/*! /*!
......
This diff is collapsed.
...@@ -25,8 +25,17 @@ ...@@ -25,8 +25,17 @@
#define abs(x) (((x) >=0) ? (x) : (-(x))) #define abs(x) (((x) >=0) ? (x) : (-(x)))
#endif #endif
#ifndef min
#define min(x,y) (((x) <= (y)) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) (((x) >= (y)) ? (x) : (y))
#endif
#define TRACE printf #define TRACE printf
#define ASSERT(x) // todo : change to DEBUG, under wxWidgets #define ASSERT(x) // todo : change to wxASSERT, under wxWidgets
#endif // ifndef DEFS_MACROS_H #endif // ifndef DEFS_MACROS_H
...@@ -7,10 +7,14 @@ COMMON = ...@@ -7,10 +7,14 @@ COMMON =
OBJECTS= \ OBJECTS= \
GenericPolygonClipperLibrary.o \ GenericPolygonClipperLibrary.o \
php_polygon.o\ php_polygon.o\
php_polygon_vertex.o php_polygon_vertex.o\
PolyLine.o\
math_for_graphics.o
GenericPolygonClipperLibrary.o: GenericPolygonClipperLibrary.cpp GenericPolygonClipperLibrary.h GenericPolygonClipperLibrary.o: GenericPolygonClipperLibrary.cpp GenericPolygonClipperLibrary.h
php_polygon.o: php_polygon.cpp php_polygon.h php_polygon_vertex.h defs-macros.h php_polygon.o: php_polygon.cpp php_polygon.h php_polygon_vertex.h defs-macros.h
#polygon1.o: polygon1.cpp polyarea.h vectmatr.h #polygon1.o: polygon1.cpp polyarea.h vectmatr.h
math_for_graphics.o: math_for_graphics.cpp math_for_graphics.h
...@@ -584,10 +584,7 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type ) ...@@ -584,10 +584,7 @@ void WinEDA_DrawFrame::OnZoom( int zoom_type )
* replac au centre de l'ecran * replac au centre de l'ecran
*/ */
{ {
D(printf("OnZoom x=%d, y=%d\n", if( DrawPanel == NULL )
m_CurrentScreen->m_Curseur.x, m_CurrentScreen->m_Curseur.y );)
if( DrawPanel == NULL )
return; return;
bool move_mouse_cursor = FALSE; bool move_mouse_cursor = FALSE;
......
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