You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2021 Mikołaj Wielgus <wielgusmikolaj@gmail.com>
  5. * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef __SIM_WORKBOOK__
  25. #define __SIM_WORKBOOK__
  26. #include <dialog_sim_settings.h>
  27. #include <sim/sim_panel_base.h>
  28. #include <sim/sim_plot_panel.h>
  29. class SIM_WORKBOOK : public wxAuiNotebook
  30. {
  31. public:
  32. SIM_WORKBOOK();
  33. SIM_WORKBOOK( wxWindow* aParent, wxWindowID aId=wxID_ANY, const wxPoint&
  34. aPos=wxDefaultPosition, const wxSize& aSize=wxDefaultSize, long
  35. aStyle=wxAUI_NB_DEFAULT_STYLE );
  36. // Methods from wxAuiNotebook
  37. bool AddPage( wxWindow* aPage, const wxString& aCaption, bool aSelect=false, const wxBitmap& aBitmap=wxNullBitmap );
  38. bool AddPage( wxWindow* aPage, const wxString& aText, bool aSelect, int aImageId ) override;
  39. bool DeleteAllPages() override;
  40. bool DeletePage( size_t aPage ) override;
  41. // Custom methods
  42. bool AddTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aTitle, const wxString& aName,
  43. int aPoints, const double* aX, const double* aY, SIM_PLOT_TYPE aType );
  44. bool DeleteTrace( SIM_PLOT_PANEL* aPlotPanel, const wxString& aName );
  45. void SetSimCommand( SIM_PANEL_BASE* aPlotPanel, const wxString& aSimCommand )
  46. {
  47. aPlotPanel->setSimCommand( aSimCommand );
  48. setModified();
  49. }
  50. const wxString& GetSimCommand( const SIM_PANEL_BASE* aPlotPanel )
  51. {
  52. return aPlotPanel->getSimCommand();
  53. }
  54. void ClrModified();
  55. bool IsModified() const { return m_modified; }
  56. private:
  57. void setModified( bool value = true );
  58. ///< Dirty bit, indicates something in the workbook has changed
  59. bool m_modified;
  60. };
  61. wxDECLARE_EVENT( EVT_WORKBOOK_MODIFIED, wxCommandEvent );
  62. wxDECLARE_EVENT( EVT_WORKBOOK_CLR_MODIFIED, wxCommandEvent );
  63. #endif // __SIM_WORKBOOK__