KiCad PCB EDA Suite
kicad_manager_frame.cpp File Reference
#include "kicad_id.h"
#include "pgm_kicad.h"
#include "tree_project_frame.h"
#include <bitmaps.h>
#include <build_version.h>
#include <executable_names.h>
#include <filehistory.h>
#include <gestfich.h>
#include <kiplatform/app.h>
#include <kiway.h>
#include <kiway_express.h>
#include <kiway_player.h>
#include <launch_ext.h>
#include <panel_hotkeys_editor.h>
#include <reporter.h>
#include <settings/common_settings.h>
#include <settings/settings_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 "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 60 of file kicad_manager_frame.cpp.

Function Documentation

◆ EVT_MENU_RANGE()

Definition at line 78 of file kicad_manager_frame.cpp.

90  :
91  EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
93  m_leftWin( nullptr ),
94  m_launcher( nullptr ),
95  m_messagesBox( nullptr ),
96  m_mainToolBar( nullptr )
97 {
98  m_active_project = false;
99  m_leftWinWidth = 250; // Default value
100  m_AboutTitle = "KiCad";
101 
102  // Create the status line (bottom of the frame)
103  static const int dims[3] = { -1, -1, 100 };
104 
105  CreateStatusBar( 3 );
106  SetStatusWidths( 3, dims );
107 
108  // Give an icon
109  wxIcon icon;
110  icon.CopyFromBitmap( KiBitmap( icon_kicad_xpm ) );
111  SetIcon( icon );
112 
113  // Load the settings
114  LoadSettings( config() );
115 
116  // Left window: is the box which display tree project
117  m_leftWin = new TREE_PROJECT_FRAME( this );
118 
119  // Add the wxTextCtrl showing all messages from KiCad:
120  m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
121  wxDefaultPosition, wxDefaultSize,
122  wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE );
123 
124  // Create the manager
125  m_toolManager = new TOOL_MANAGER;
126  m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, config(), this );
127  m_actions = new KICAD_MANAGER_ACTIONS();
128 
129  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
130 
131  // Attach the events to the tool dispatcher
132  Bind( wxEVT_TOOL, &TOOL_DISPATCHER::DispatchWxCommand, m_toolDispatcher );
133  Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
134  Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
135 
136  // Register tools
137  m_toolManager->RegisterTool( new COMMON_CONTROL );
138  m_toolManager->RegisterTool( new KICAD_MANAGER_CONTROL );
139  m_toolManager->InitTools();
140 
141  RecreateBaseHToolbar();
142  RecreateLauncher();
143  ReCreateMenuBar();
144 
145  m_auimgr.SetManagedWindow( this );
146 
147  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
148 
149  // BestSize() does not always set the actual pane size of m_leftWin to the required value.
150  // It happens when m_leftWin is too large (roughly > 1/3 of the kicad manager frame width.
151  // (Well, BestSize() sets the best size... not the window size)
152  // A trick is to use MinSize() to set the required pane width,
153  // and after give a reasonable MinSize value
154  m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer(3)
155  .CaptionVisible( false ).PaneBorder( false )
156  .MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
157 
158  m_auimgr.AddPane( m_launcher, EDA_PANE().HToolbar().Name( "Launcher" ).Top().Layer(1) );
159 
160  m_auimgr.AddPane( m_messagesBox, EDA_PANE().Messages().Name( "MsgPanel" ).Center() );
161 
162  m_auimgr.Update();
163 
164  // Now the actual m_leftWin size is set, give it a reasonable min width
165  m_auimgr.GetPane( m_leftWin ).MinSize( 200, -1 );
166 
167  SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
168 
169  // Do not let the messages window have initial focus
170  m_leftWin->SetFocus();
171 
172  // Ensure the window is on top
173  Raise();
174 }
const BITMAP_OPAQUE icon_kicad_xpm[1]
Definition: icon_kicad.cpp:153
KICAD_MANAGER_CONTROL.
TOOL_MANAGER.
Definition: tool_manager.h:51
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
wxString GetBuildVersion()
Get the full KiCad version string.
TREE_PROJECT_FRAME Window to display the tree files.
virtual void DispatchWxEvent(wxEvent &aEvent)
Function DispatchWxEvent() Processes wxEvents (mostly UI events), translates them to TOOL_EVENTs,...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
COMMON_CONTROL.
Specialization of the wxAuiPaneInfo class for KiCad panels.
TOOL_DISPATCHER.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets the work environment (model, view, view controls and the parent window).
virtual void DispatchWxCommand(wxCommandEvent &aEvent)
Function DispatchWxCommand() Processes wxCommands (mostly menu related events) and runs appropriate a...
#define KICAD_MANAGER_FRAME_NAME
The base frame for deriving all KiCad main window classes.
KICAD_MANAGER_ACTIONS.
KIWAY Kiway

References PCAD2KICAD::Center, TOOL_DISPATCHER::DispatchWxCommand(), TOOL_DISPATCHER::DispatchWxEvent(), GetBuildVersion(), icon_kicad_xpm, KiBitmap(), PCAD2KICAD::Left, and TOOL_MANAGER::SetEnvironment().