Browse Source
Base object decoupling improvements.
Base object decoupling improvements.
* Improve MSG_PANEL_ITEM to handle message panel information. * Create containers for passing message panel items between objects and the message panel. * Rename EDA_ITEM::DisplayInfo to EDA_ITEM::GetMsgPanelInfo. * Remove all direct manipulation of EDA_DRAW_FRAME from all objects derived from EDA_ITEM.pull/1/head
110 changed files with 897 additions and 657 deletions
-
5common/basicframe.cpp
-
27common/drawframe.cpp
-
71common/msgpanel.cpp
-
1cvpcb/class_DisplayFootprintsFrame.cpp
-
13cvpcb/setvisu.cpp
-
21eeschema/controle.cpp
-
2eeschema/dialogs/dialog_lib_edit_text.cpp
-
6eeschema/edit_component_in_schematic.cpp
-
8eeschema/getpart.cpp
-
9eeschema/lib_arc.cpp
-
2eeschema/lib_arc.h
-
9eeschema/lib_bezier.cpp
-
2eeschema/lib_bezier.h
-
11eeschema/lib_circle.cpp
-
2eeschema/lib_circle.h
-
10eeschema/lib_draw_item.cpp
-
7eeschema/lib_draw_item.h
-
15eeschema/lib_field.cpp
-
2eeschema/lib_field.h
-
23eeschema/lib_pin.cpp
-
3eeschema/lib_pin.h
-
9eeschema/lib_polyline.cpp
-
2eeschema/lib_polyline.h
-
7eeschema/lib_rectangle.cpp
-
2eeschema/lib_rectangle.h
-
7eeschema/lib_text.cpp
-
3eeschema/lib_text.h
-
9eeschema/libedit_onleftclick.cpp
-
9eeschema/libedit_onrightclick.cpp
-
9eeschema/libeditframe.cpp
-
14eeschema/pinedit.cpp
-
24eeschema/sch_component.cpp
-
15eeschema/sch_component.h
-
11eeschema/sch_marker.cpp
-
3eeschema/sch_marker.h
-
10eeschema/sch_sheet.cpp
-
2eeschema/sch_sheet.h
-
89eeschema/sch_text.cpp
-
2eeschema/sch_text.h
-
1eeschema/schframe.cpp
-
5eeschema/symbdraw.cpp
-
1eeschema/viewlib_frame.cpp
-
18gerbview/class_gerber_draw_item.cpp
-
11gerbview/class_gerber_draw_item.h
-
11gerbview/gerbview_frame.cpp
-
7gerbview/locate.cpp
-
17include/base_struct.h
-
2include/class_drawpanel.h
-
184include/msgpanel.h
-
104include/wxstruct.h
-
6pcbnew/attribut.cpp
-
3pcbnew/autorouter/automove.cpp
-
5pcbnew/autorouter/autoplac.cpp
-
1pcbnew/autorouter/autorout.cpp
-
12pcbnew/basepcbframe.cpp
-
26pcbnew/class_board.cpp
-
10pcbnew/class_board.h
-
4pcbnew/class_dimension.cpp
-
3pcbnew/class_dimension.h
-
46pcbnew/class_drawsegment.cpp
-
3pcbnew/class_drawsegment.h
-
25pcbnew/class_edge_mod.cpp
-
4pcbnew/class_edge_mod.h
-
11pcbnew/class_marker_pcb.cpp
-
5pcbnew/class_marker_pcb.h
-
57pcbnew/class_module.cpp
-
3pcbnew/class_module.h
-
12pcbnew/class_netinfo.h
-
40pcbnew/class_netinfo_item.cpp
-
50pcbnew/class_pad.cpp
-
4pcbnew/class_pad.h
-
34pcbnew/class_pcb_text.cpp
-
3pcbnew/class_pcb_text.h
-
39pcbnew/class_text_mod.cpp
-
4pcbnew/class_text_mod.h
-
123pcbnew/class_track.cpp
-
12pcbnew/class_track.h
-
35pcbnew/class_zone.cpp
-
5pcbnew/class_zone.h
-
6pcbnew/deltrack.cpp
-
2pcbnew/dialogs/dialog_graphic_item_properties.cpp
-
2pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp
-
2pcbnew/dialogs/dialog_pad_properties.cpp
-
2pcbnew/dimension.cpp
-
6pcbnew/drc.cpp
-
14pcbnew/edit.cpp
-
6pcbnew/edit_pcb_text.cpp
-
2pcbnew/editedge.cpp
-
9pcbnew/editrack-part2.cpp
-
6pcbnew/editrack.cpp
-
7pcbnew/edtxtmod.cpp
-
3pcbnew/files.cpp
-
5pcbnew/footprint_wizard.cpp
-
1pcbnew/footprint_wizard_frame.cpp
-
4pcbnew/globaleditpad.cpp
-
2pcbnew/hotkeys_board_editor.cpp
-
7pcbnew/librairi.cpp
-
2pcbnew/modedit.cpp
-
1pcbnew/moduleframe.cpp
-
8pcbnew/modules.cpp
@ -0,0 +1,184 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com |
|||
* Copyright (C) 2011-2012 Wayne Stambaugh <stambaughw@verizon.net> |
|||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/** |
|||
* @file msgpanel.h |
|||
* @brief Message panel definition file. |
|||
*/ |
|||
|
|||
#ifndef _MSGPANEL_H_ |
|||
#define _MSGPANEL_H_ |
|||
|
|||
|
|||
#include <colors.h> |
|||
|
|||
#include <wx/window.h> |
|||
|
|||
#include <vector> |
|||
|
|||
|
|||
#define MSG_PANEL_DEFAULT_PAD 6 ///< The default number of spaces between each text string. |
|||
|
|||
|
|||
class EDA_MSG_PANEL; |
|||
|
|||
|
|||
/** |
|||
* Class EDA_MSG_ITEM |
|||
* is used EDA_MSG_PANEL as the item type for displaying messages. |
|||
*/ |
|||
class MSG_PANEL_ITEM |
|||
{ |
|||
int m_X; |
|||
int m_UpperY; |
|||
int m_LowerY; |
|||
wxString m_UpperText; |
|||
wxString m_LowerText; |
|||
EDA_COLOR_T m_Color; |
|||
int m_Pad; |
|||
|
|||
friend class EDA_MSG_PANEL; |
|||
|
|||
public: |
|||
MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText, EDA_COLOR_T aColor, |
|||
int aPad = MSG_PANEL_DEFAULT_PAD ) : |
|||
m_UpperText( aUpperText ), |
|||
m_LowerText( aLowerText ), |
|||
m_Color( aColor ), |
|||
m_Pad( aPad ) |
|||
{ |
|||
} |
|||
|
|||
MSG_PANEL_ITEM() |
|||
{ |
|||
} |
|||
|
|||
void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; } |
|||
const wxString& GetUpperText() const { return m_UpperText; } |
|||
|
|||
void SetLowerText( const wxString& aLowerText ) { m_LowerText = aLowerText; } |
|||
const wxString& GetLowerText() const { return m_LowerText; } |
|||
|
|||
void SetColor( EDA_COLOR_T aColor ) { m_Color = aColor; } |
|||
EDA_COLOR_T GetColor() const { return m_Color; } |
|||
|
|||
void SetPadding( int aPad ) { m_Pad = aPad; } |
|||
int GetPadding() const { return m_Pad; } |
|||
}; |
|||
|
|||
|
|||
typedef std::vector<MSG_PANEL_ITEM> MSG_PANEL_ITEMS; |
|||
typedef MSG_PANEL_ITEMS::iterator MSG_PANEL_ITEMS_ITER; |
|||
typedef MSG_PANEL_ITEMS::const_iterator MSG_PANEL_ITEMS_CITER; |
|||
|
|||
|
|||
/** |
|||
* class EDA_MSG_PANEL |
|||
* is a panel to display various information messages. |
|||
*/ |
|||
class EDA_MSG_PANEL : public wxPanel |
|||
{ |
|||
protected: |
|||
MSG_PANEL_ITEMS m_Items; |
|||
int m_last_x; ///< the last used x coordinate |
|||
wxSize m_fontSize; |
|||
|
|||
void showItem( wxDC& dc, const MSG_PANEL_ITEM& aItem ); |
|||
|
|||
void erase( wxDC* DC ); |
|||
|
|||
/** |
|||
* Function getFontSize |
|||
* computes the height and width of a 'W' in the system font. |
|||
*/ |
|||
static wxSize computeFontSize(); |
|||
|
|||
/** |
|||
* Calculate the width and height of a text string using the system UI font. |
|||
*/ |
|||
wxSize computeTextSize( const wxString& text ) const; |
|||
|
|||
public: |
|||
EDA_MSG_PANEL( wxWindow* aParent, int aId, const wxPoint& aPosition, const wxSize& aSize ); |
|||
~EDA_MSG_PANEL(); |
|||
|
|||
/** |
|||
* Function GetRequiredHeight |
|||
* returns the required height (in pixels) of a EDA_MSG_PANEL. This takes |
|||
* into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT. |
|||
*/ |
|||
static int GetRequiredHeight(); |
|||
|
|||
void OnPaint( wxPaintEvent& aEvent ); |
|||
void EraseMsgBox(); |
|||
|
|||
/** |
|||
* Function SetMessage |
|||
* sets a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel. |
|||
* |
|||
* @param aXPosition The horizontal position to display the message or less than zero |
|||
* to set the message using the last message position. |
|||
* @param aUpperText The text to be displayed in top line. |
|||
* @param aLowerText The text to be displayed in bottom line. |
|||
* @param aColor Color of the text to display. |
|||
*/ |
|||
void SetMessage( int aXPosition, const wxString& aUpperText, |
|||
const wxString& aLowerText, EDA_COLOR_T aColor ); |
|||
|
|||
/** |
|||
* Function AppendMessage |
|||
* appends a message to the message panel. |
|||
* |
|||
* This method automatically adjusts for the width of the text string. |
|||
* Making consecutive calls to AppendMessage will append each message |
|||
* to the right of the last message. This message is not compatible |
|||
* with Affiche_1_Parametre. |
|||
* |
|||
* @param aUpperText The message upper text. |
|||
* @param aLowerText The message lower text. |
|||
* @param aColor A color ID from the KiCad color list (see colors.h). |
|||
* @param aPad Number of spaces to pad between messages (default = 4). |
|||
*/ |
|||
void AppendMessage( const wxString& aUpperText, const wxString& aLowerText, |
|||
EDA_COLOR_T aColor, int aPad = 6 ); |
|||
|
|||
/** |
|||
* Function AppendMessage |
|||
* appends \a aMessageItem to the message panel. |
|||
* |
|||
* @param aMessageItem is a reference to an #MSG_PANEL_ITEM containing the message to |
|||
* append to the panel. |
|||
*/ |
|||
void AppendMessage( const MSG_PANEL_ITEM& aMessageItem ) |
|||
{ |
|||
AppendMessage( aMessageItem.GetUpperText(), aMessageItem.GetLowerText(), |
|||
aMessageItem.GetColor(), aMessageItem.GetPadding() ); |
|||
} |
|||
|
|||
DECLARE_EVENT_TABLE() |
|||
}; |
|||
|
|||
|
|||
#endif // _MSGPANEL_H_ |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue