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 <kicad_build_version.h>
#include <kiway.h>
#include <kiway_express.h>
#include <launch_ext.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/pcb_plugin.h>
#include "kicad_manager_frame.h"
#include "kicad_settings.h"
#include <wx/xml/xml.h>

Go to the source code of this file.

Macros

#define SEP()   wxFileName::GetPathSeparator()
 
#define ENABLE(x)   ACTION_CONDITIONS().Enable( x )
 

Functions

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

Macro Definition Documentation

◆ ENABLE

#define ENABLE (   x)    ACTION_CONDITIONS().Enable( x )

◆ 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.

109 :
110 EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
112 m_leftWin( nullptr ),
113 m_launcher( nullptr ),
114 m_mainToolBar( nullptr )
115{
116 m_active_project = false;
117 m_leftWinWidth = 250; // Default value
118 m_aboutTitle = "KiCad";
119
120 // JPC: A very ugly hack to fix an issue on Linux: if the wxbase315u_xml_gcc_custom.so is
121 // used **only** in PCM, it is not found in some cases at run time.
122 // So just use it in the main module to avoid a not found issue
123 // wxbase315u_xml_gcc_custom shared object when launching Kicad
124 wxXmlDocument dummy;
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#if KICAD_IS_NIGHTLY
136 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly ) );
137 icon_bundle.AddIcon( icon );
138 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly_32 ) );
139 icon_bundle.AddIcon( icon );
140 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_nightly_16 ) );
141 icon_bundle.AddIcon( icon );
142#else
143 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad ) );
144 icon_bundle.AddIcon( icon );
145 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_32 ) );
146 icon_bundle.AddIcon( icon );
147 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad_16 ) );
148 icon_bundle.AddIcon( icon );
149#endif
150
151 SetIcons( icon_bundle );
152
153 // Load the settings
154 LoadSettings( config() );
155
156 // Left window: is the box which display tree project
157 m_leftWin = new PROJECT_TREE_PANE( this );
158
159 setupTools();
160 setupUIConditions();
161
162 m_launcher = new PANEL_KICAD_LAUNCHER( this );
163
164 RecreateBaseHToolbar();
165 ReCreateMenuBar();
166
167 m_auimgr.SetManagedWindow( this );
168 m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
169
170 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
171 .Layer( 2 ) );
172
173 // BestSize() does not always set the actual pane size of m_leftWin to the required value.
174 // It happens when m_leftWin is too large (roughly > 1/3 of the kicad manager frame width.
175 // (Well, BestSize() sets the best size... not the window size)
176 // A trick is to use MinSize() to set the required pane width,
177 // and after give a reasonable MinSize value
178 m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer( 1 )
179 .Caption( _( "Project Files" ) ).PaneBorder( false )
180 .MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
181
182 m_auimgr.AddPane( m_launcher, EDA_PANE().Canvas().Name( "Launcher" ).Center()
183 .Caption( _( "Editors" ) ).PaneBorder( false )
184 .MinSize( m_launcher->GetBestSize() ) );
185
186 m_auimgr.Update();
187
188 // Now the actual m_leftWin size is set, give it a reasonable min width
189 m_auimgr.GetPane( m_leftWin ).MinSize( 250, -1 );
190
191 wxSizer* mainSizer = GetSizer();
192
193 // Only fit the initial window size the first time KiCad is run.
194 if( mainSizer && config()->m_Window.state.size_x == 0 && config()->m_Window.state.size_y == 0 )
195 mainSizer->Fit( this );
196
197 if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
198 SetTitle( wxT( "KiCad" ) );
199 else
200 SetTitle( wxString( "KiCad " ) + GetMajorMinorVersion() );
201
202 // Do not let the messages window have initial focus
203 m_leftWin->SetFocus();
204
205 DragAcceptFiles( true );
206
207 // Ensure the window is on top
208 Raise();
209}
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
@ icon_kicad_16
@ icon_kicad_nightly
@ icon_kicad_32
@ icon_kicad_nightly_32
@ icon_kicad_nightly_16
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
The base frame for deriving all KiCad main window classes.
Specialization of the wxAuiPaneInfo class for KiCad panels.
PROJECT_TREE_PANE Window to display the tree files.
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define KICAD_MANAGER_FRAME_NAME
@ KICAD_MAIN_FRAME_T
Definition: frame_type.h:64
KIWAY Kiway
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:73

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