KiCad PCB EDA Suite
kicad_manager_frame.cpp File Reference
#include "kicad_id.h"
#include "pgm_kicad.h"
#include "project_tree_pane.h"
#include <advanced_config.h>
#include <bitmaps.h>
#include <build_version.h>
#include <dialogs/panel_kicad_launcher.h>
#include <eda_base_frame.h>
#include <filehistory.h>
#include <kiplatform/app.h>
#include <kiway.h>
#include <kiway_express.h>
#include <launch_ext.h>
#include <panel_hotkeys_editor.h>
#include <reporter.h>
#include <project/project_local_settings.h>
#include <sch_file_versions.h>
#include <settings/settings_manager.h>
#include <tool/action_manager.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tools/kicad_manager_actions.h>
#include <tools/kicad_manager_control.h>
#include <wildcards_and_files_ext.h>
#include <widgets/app_progress_dialog.h>
#include <wx/ffile.h>
#include <wx/filedlg.h>
#include <wx/dcclient.h>
#include <atomic>
#include <../pcbnew/plugins/kicad/kicad_plugin.h>
#include "kicad_manager_frame.h"
#include "kicad_settings.h"

Go to the source code of this file.

Macros

#define SEP()   wxFileName::GetPathSeparator()
 

Functions

 EVT_MENU_RANGE (ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::language_change) KICAD_MANAGER_FRAME
 

Macro Definition Documentation

◆ SEP

#define SEP ( )    wxFileName::GetPathSeparator()

Definition at line 71 of file kicad_manager_frame.cpp.

Function Documentation

◆ EVT_MENU_RANGE()

Definition at line 90 of file kicad_manager_frame.cpp.

107  :
108  EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
110  m_leftWin( nullptr ),
111  m_launcher( nullptr ),
112  m_mainToolBar( nullptr )
113 {
114  m_active_project = false;
115  m_leftWinWidth = 250; // Default value
116  m_aboutTitle = "KiCad";
117 
118 #ifdef PCM
119  // JPC: A very ugly hack to fix an issue on Linux: if the wxbase315u_xml_gcc_custom.so is
120  // used **only** in PCM, it is not found in some cases at run time.
121  // So just use it in the main module to avoid a not found issue
122  // wxbase315u_xml_gcc_custom shared object when launching Kicad
123  wxXmlDocument dummy;
124 #endif
125 
126  // Create the status line (bottom of the frame). Left half is for project name; right half
127  // is for Reporter (currently used by archiver/unarchiver).
128  CreateStatusBar( 2 );
129  GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
130 
131  // Give an icon
132  wxIcon icon;
133  wxIconBundle icon_bundle;
134 
135  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad ) );
136  icon_bundle.AddIcon( icon );
137  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_32 ) );
138  icon_bundle.AddIcon( icon );
139  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_16 ) );
140  icon_bundle.AddIcon( icon );
141 
142  SetIcons( icon_bundle );
143 
144  // Load the settings
145  LoadSettings( config() );
146 
147  // Left window: is the box which display tree project
148  m_leftWin = new PROJECT_TREE_PANE( this );
149 
150  setupTools();
151  setupUIConditions();
152 
153  m_launcher = new PANEL_KICAD_LAUNCHER( this );
154 
155  RecreateBaseHToolbar();
156  ReCreateMenuBar();
157 
158  m_auimgr.SetManagedWindow( this );
159  m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
160 
161  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
162  .Layer( 2 ) );
163 
164  // BestSize() does not always set the actual pane size of m_leftWin to the required value.
165  // It happens when m_leftWin is too large (roughly > 1/3 of the kicad manager frame width.
166  // (Well, BestSize() sets the best size... not the window size)
167  // A trick is to use MinSize() to set the required pane width,
168  // and after give a reasonable MinSize value
169  m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer( 1 )
170  .Caption( _( "Project Files" ) ).PaneBorder( true )
171  .MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
172 
173  m_auimgr.AddPane( m_launcher, EDA_PANE().Canvas().Name( "Launcher" ).Center()
174  .Caption( _( "Editors" ) ).PaneBorder( false )
175  .MinSize( m_launcher->GetBestSize() ) );
176 
177  m_auimgr.Update();
178 
179  // Now the actual m_leftWin size is set, give it a reasonable min width
180  m_auimgr.GetPane( m_leftWin ).MinSize( 250, -1 );
181 
182  wxSizer* mainSizer = GetSizer();
183 
184  // Only fit the initial window size the first time KiCad is run.
185  if( mainSizer && config()->m_Window.state.size_x == 0 && config()->m_Window.state.size_y == 0 )
186  mainSizer->Fit( this );
187 
188  if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
189  SetTitle( wxT( "KiCad" ) );
190  else
191  SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
192 
193  // Do not let the messages window have initial focus
194  m_leftWin->SetFocus();
195 
196  // Ensure the window is on top
197  Raise();
198 }
PROJECT_TREE_PANE Window to display the tree files.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
wxString GetBuildVersion()
Get the full KiCad version string.
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
#define KICAD_MANAGER_FRAME_NAME
The base frame for deriving all KiCad main window classes.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
KIWAY Kiway

References _, PCAD2KICAD::Center, config, dummy(), GetBuildVersion(), ADVANCED_CFG::GetCfg(), KIUI::GetStatusFont(), icon_kicad, icon_kicad_16, icon_kicad_32, KiBitmap(), and PCAD2KICAD::Left.