Common widget header housekeeping.

This commit is contained in:
Wayne Stambaugh 2021-06-03 11:41:26 -04:00
parent f40f696c37
commit 7c14e4e967
28 changed files with 120 additions and 92 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2021 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
@ -24,6 +24,8 @@
#include <dialogs/panel_gal_display_options.h>
#include <wx/treebook.h>
PANEL_GAL_DISPLAY_OPTIONS::PANEL_GAL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aFrame,
PAGED_DIALOG* aParent ) :

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2009-2021 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
@ -38,6 +38,8 @@
#include <widgets/grid_color_swatch_helpers.h>
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/grid_text_helpers.h>
#include <wx/treebook.h>
// PCBNEW columns of netclasses grid
enum {

View File

@ -27,6 +27,7 @@
#include <dialogs/panel_setup_severities.h>
#include <wx/radiobut.h>
#include <wx/stattext.h>
#include <wx/treebook.h>
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,

View File

@ -58,6 +58,7 @@
#include <wx/msgdlg.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <wx/treebook.h>
#include <kiplatform/app.h>
#include <kiplatform/ui.h>

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2021 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

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 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
@ -34,6 +34,7 @@
#include <widgets/infobar.h>
#include "dialog_schematic_setup.h"
#include "panel_eeschema_template_fieldnames.h"
#include <wx/treebook.h>
DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2021 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
@ -49,6 +49,7 @@
#include <wildcards_and_files_ext.h>
#include <drawing_sheet/ds_data_model.h>
#include <zoom_defines.h>
#include <wx/treebook.h>
/// Helper for all the old plotting/printing code while it still exists

View File

@ -57,6 +57,7 @@
#include <dialogs/panel_gerbview_display_options.h>
#include <panel_hotkeys_editor.h>
#include <wx/wupdlock.h>
#include <wx/treebook.h>
#include "widgets/gbr_layer_box_selector.h"
#include "widgets/gerbview_layer_widget.h"

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -31,15 +31,11 @@
using KIGFX::COLOR4D;
/* Basic class to build a layer list.
* this is an basic abstract class to build a layer list selector.
* To display this list, you should therefore derive this class
/**
* Base class to build a layer list.
*/
class LAYER_SELECTOR
{
protected:
bool m_layerhotkeys;
public:
LAYER_SELECTOR();
@ -49,22 +45,25 @@ public:
bool SetLayersHotkeys( bool value );
// Fills the layer bitmap aLayerbmp with the layer color
// Fill the layer bitmap aLayerbmp with the layer color
static void DrawColorSwatch( wxBitmap& aLayerbmp, COLOR4D aBackground, COLOR4D aColor );
protected:
// Returns a color index from the layer id
// Return a color index from the layer id
virtual COLOR4D getLayerColor( LAYER_NUM aLayer ) const = 0;
// Returns the name of the layer id
// Return the name of the layer id
virtual wxString getLayerName( LAYER_NUM aLayer ) const = 0;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Return true if the layer id is enabled (i.e. is it should be displayed)
virtual bool isLayerEnabled( LAYER_NUM aLayer ) const = 0;
bool m_layerhotkeys;
};
/* class to display a layer list in a wxBitmapComboBox.
/*
* Display a layer list in a wxBitmapComboBox.
*/
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
{

View File

@ -2,8 +2,8 @@
* 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-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2011-2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 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
@ -48,20 +48,10 @@ class EDA_MSG_PANEL;
/**
* EDA_MSG_ITEM
* is used EDA_MSG_PANEL as the item type for displaying messages.
* #EDA_MSG_PANEL items for displaying messages.
*/
class MSG_PANEL_ITEM
{
int m_X;
int m_UpperY;
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
int m_Padding;
friend class EDA_MSG_PANEL;
public:
MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText,
int aPadding = MSG_PANEL_DEFAULT_PAD ) :
@ -91,6 +81,16 @@ public:
void SetPadding( int aPadding ) { m_Padding = aPadding; }
int GetPadding() const { return m_Padding; }
private:
friend class EDA_MSG_PANEL;
int m_X;
int m_UpperY;
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
int m_Padding;
};
@ -98,31 +98,10 @@ typedef std::vector<MSG_PANEL_ITEM> MSG_PANEL_ITEMS;
/**
* EDA_MSG_PANEL
* is a panel to display various information messages.
* 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,
@ -130,9 +109,9 @@ public:
~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.
* Return 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();
@ -140,8 +119,7 @@ public:
void EraseMsgBox();
/**
* Function SetMessage
* sets a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel.
* Set 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.
@ -151,8 +129,7 @@ public:
void SetMessage( int aXPosition, const wxString& aUpperText, const wxString& aLowerText );
/**
* Function AppendMessage
* appends a message to the message panel.
* Append 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
@ -166,8 +143,7 @@ public:
void AppendMessage( const wxString& aUpperText, const wxString& aLowerText, int aPadding = 6 );
/**
* Function AppendMessage
* appends \a aMessageItem to the message panel.
* Append \a aMessageItem to the message panel.
*
* @param aMessageItem is a reference to an #MSG_PANEL_ITEM containing the message to
* append to the panel.
@ -179,6 +155,25 @@ public:
}
DECLARE_EVENT_TABLE()
protected:
void showItem( wxDC& dc, const MSG_PANEL_ITEM& aItem );
void erase( wxDC* DC );
/**
* Compute 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;
MSG_PANEL_ITEMS m_Items;
int m_last_x; ///< the last used x coordinate
wxSize m_fontSize;
};

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 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
@ -22,28 +22,13 @@
#define PAGED_DIALOG_H
#include <dialog_shim.h>
#include <wx/treebook.h>
class WX_INFOBAR;
class wxTreebook;
class PAGED_DIALOG : public DIALOG_SHIM
{
private:
wxString m_title;
bool m_dirty;
wxString m_errorMessage;
wxWindow* m_errorCtrl; // the control associated with m_errorMessage
int m_errorRow; // the row if m_errorCtrl is a grid
int m_errorCol; // the column if m_errorCtrl is a grid
wxBoxSizer* m_buttonsSizer;
std::vector<bool> m_macHack;
public:
PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset,
const wxString& aAuxiliaryAction = wxEmptyString );
@ -79,6 +64,20 @@ protected:
wxButton* m_resetButton;
wxButton* m_cancelButton;
WX_INFOBAR* m_infoBar;
private:
wxString m_title;
bool m_dirty;
wxString m_errorMessage;
wxWindow* m_errorCtrl; // the control associated with m_errorMessage
int m_errorRow; // the row if m_errorCtrl is a grid
int m_errorCol; // the column if m_errorCtrl is a grid
wxBoxSizer* m_buttonsSizer;
std::vector<bool> m_macHack;
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
*
* This program is free software; you can redistribute it and/or
@ -63,6 +63,7 @@
#include <zoom_defines.h>
#include <wx/filedlg.h>
#include <wx/treebook.h>
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
@ -924,4 +925,4 @@ void PL_EDITOR_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCo
bool PL_EDITOR_FRAME::GetPageNumberOption() const
{
return m_pageSelectBox->GetSelection() == 0;
}
}

View File

@ -27,6 +27,8 @@
#include <board_stackup_manager/stackup_predefined_prms.h>
#include "panel_board_finish.h"
#include <wx/treebook.h>
PANEL_SETUP_BOARD_FINISH::PANEL_SETUP_BOARD_FINISH( PAGED_DIALOG* aParent, BOARD* aBoard ) :
PANEL_SETUP_BOARD_FINISH_BASE( aParent->GetTreebook() )

View File

@ -44,6 +44,7 @@
#include <wx/richmsgdlg.h>
#include <wx/choicdlg.h>
#include <wx/dcclient.h>
#include <wx/treebook.h>
#include <locale_io.h>

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 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
@ -42,6 +42,8 @@
#include "dialog_board_setup.h"
#include "panel_setup_rules.h"
#include <wx/treebook.h>
using std::placeholders::_1;
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -27,6 +27,7 @@
#include <pcb_painter.h>
#include <widgets/paged_dialog.h>
#include <widgets/gal_options_panel.h>
#include <wx/treebook.h>
static const UTIL::CFG_MAP<PCB_DISPLAY_OPTIONS::TRACE_CLEARANCE_DISPLAY_MODE_T> traceClearanceSelectMap =

View File

@ -2,7 +2,7 @@
* 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) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -31,6 +31,8 @@
#include <ratsnest/ratsnest_view_item.h>
#include <widgets/paged_dialog.h>
#include <footprint_edit_frame.h>
#include <wx/treebook.h>
PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( PCB_BASE_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent ) :
PANEL_EDIT_OPTIONS_BASE( aParent->GetTreebook() ), m_frame( aFrame )

View File

@ -31,6 +31,8 @@
#include <grid_layer_box_helpers.h>
#include <bitmaps.h>
#include <wx/treebook.h>
class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase
{
std::vector<TEXT_ITEM_INFO> m_items;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 Andrew Lutsenko, anlutsenko at gmail dot com
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -33,6 +33,9 @@
#include <widgets/paged_dialog.h>
#include <widgets/wx_grid.h>
#include <wx/treebook.h>
#define GRID_CELL_MARGIN 4
PANEL_PCBNEW_ACTION_PLUGINS::PANEL_PCBNEW_ACTION_PLUGINS( PCB_EDIT_FRAME* aFrame,

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 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
@ -34,6 +34,7 @@
#include <pcb_painter.h>
#include <track.h>
#include <plugins/kicad/kicad_plugin.h>
#include <wx/treebook.h>
std::string g_previewBoard =

View File

@ -2,7 +2,7 @@
* 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) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -31,6 +31,9 @@
#include <pcbnew_id.h>
#include <widgets/paged_dialog.h>
#include <wx/treebook.h>
PANEL_PCBNEW_DISPLAY_ORIGIN::PANEL_PCBNEW_DISPLAY_ORIGIN(
PCB_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent )
: PANEL_PCBNEW_DISPLAY_ORIGIN_BASE( aParent->GetTreebook() ),

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Isaac Marino Bavaresco, isaacbavaresco@yahoo.com.br
* Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2009-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2009-2021 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
@ -35,6 +35,7 @@
#include <board_stackup_manager/panel_board_stackup.h>
#include <wx/choicdlg.h>
#include <wx/treebook.h>
// some define to choose how copper layers widgets are shown

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2021 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
@ -26,6 +26,7 @@
#include <board_design_settings.h>
#include <dialogs/dialog_text_entry.h>
#include <panel_setup_mask_and_paste.h>
#include <wx/treebook.h>
PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent,

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 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
@ -33,6 +33,7 @@
#include <tool/tool_manager.h>
#include <panel_setup_rules.h>
#include <wx_html_report_box.h>
#include <wx/treebook.h>
#include <dialogs/html_messagebox.h>
#include <scintilla_tricks.h>
#include <drc/drc_rule_parser.h>

View File

@ -28,6 +28,8 @@
#include <grid_tricks.h>
#include <panel_setup_text_and_graphics.h>
#include <wx/treebook.h>
// Columns of layer classes grid
enum

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2018-2021 KiCad Developers, see change_log.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
@ -27,6 +27,7 @@
#include <board_design_settings.h>
#include <bitmaps.h>
#include <widgets/wx_grid.h>
#include <wx/treebook.h>
#include <grid_tricks.h>
#include <panel_setup_tracks_and_vias.h>

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -78,6 +78,7 @@
#include <widgets/progress_reporter.h>
#include <wildcards_and_files_ext.h>
#include <wx/filedlg.h>
#include <wx/treebook.h>
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@ -43,6 +43,7 @@
#include <project/net_settings.h>
#include <project/project_file.h>
#include <project/project_local_settings.h>
#include <wx/treebook.h>