Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
76467a7f
Commit
76467a7f
authored
Nov 02, 2008
by
jerryjacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beautify code see change_log.txt
parent
a0c413a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
403 additions
and
232 deletions
+403
-232
change_log.txt
change_log.txt
+11
-0
buildmnu.cpp
kicad/buildmnu.cpp
+391
-231
treeprj_frame.cpp
kicad/treeprj_frame.cpp
+1
-1
No files found.
change_log.txt
View file @
76467a7f
...
@@ -6,6 +6,17 @@ Please add newer entries at the top, list the date and your name with
...
@@ -6,6 +6,17 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.
2008-nov-2 CLEANUP Jerry Jacobs <jerkejacobs@gmail.com>
================================================================================
++kicad:
Cleanup comment/codestyle to make things more clear for newbie codeviewer
and developers.
+ buildmnu.cpp
+ commandframe.cpp
+ kicad.cpp
+ treeprj_frame.cpp
2008-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2008-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
++All
++All
...
...
kicad/buildmnu.cpp
View file @
76467a7f
/***********************************************/
/*****************************************************************************/
/* buildmnu.h: construction du menu principal */
/**
/***********************************************/
* @file buildmnu.cpp
* @brief TODO
*/
/*****************************************************************************/
#include "wx/spinctrl.h"
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "wx/spinctrl.h"
#include "kicad.h"
#include "kicad.h"
#include "macros.h"
#include "macros.h"
#define BITMAP wxBitmap
#define BITMAP wxBitmap
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// USE_XPM_BITMAPS
#include "bitmaps.h" // Common bitmaps
#include "bitmaps.h" // Common bitmaps
#include "id.h"
#include "id.h"
/* Fonctions locales */
/* Variables locales */
/*****************************************************************************/
BEGIN_EVENT_TABLE
(
WinEDA_MainFrame
,
WinEDA_BasicFrame
)
/*****************************************************************************/
/* Window events */
EVT_SIZE
(
WinEDA_MainFrame
::
OnSize
)
EVT_CLOSE
(
WinEDA_MainFrame
::
OnCloseWindow
)
/* Sash drag events */
EVT_SASH_DRAGGED
(
ID_LEFT_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_BOTTOM_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_MAIN_COMMAND
,
WinEDA_MainFrame
::
OnSashDrag
)
/* Toolbar events */
EVT_TOOL
(
ID_NEW_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
EVT_TOOL
(
ID_LOAD_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
EVT_TOOL
(
ID_SAVE_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
EVT_TOOL
(
ID_SAVE_AND_ZIP_FILES
,
WinEDA_MainFrame
::
Process_Files
)
/* Menu events */
EVT_MENU
(
ID_SAVE_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_EXIT
,
WinEDA_MainFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_TO_EDITOR
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_MENU
(
ID_BROWSE_AN_SELECT_FILE
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_MENU
(
ID_SELECT_PREFERED_EDITOR
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_DEFAULT_PDF_BROWSER
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_PREFERED_PDF_BROWSER
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_PREFERED_PDF_BROWSER_NAME
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SAVE_AND_ZIP_FILES
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_READ_ZIP_ARCHIVE
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_PROJECT_TREE_REFRESH
,
WinEDA_MainFrame
::
OnRefresh
)
EVT_MENU
(
ID_PREFERENCES_FONT_INFOSCREEN
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_GENERAL_HELP
,
WinEDA_MainFrame
::
GetKicadHelp
)
EVT_MENU
(
ID_KICAD_ABOUT
,
WinEDA_MainFrame
::
GetKicadAbout
)
/* Range menu events */
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
WinEDA_MainFrame
::
SetLanguage
)
EVT_MENU_RANGE
(
ID_LOAD_PROJECT
,
ID_LOAD_FILE_10
,
WinEDA_MainFrame
::
Process_Files
)
/* Button events */
EVT_BUTTON
(
ID_TO_PCB
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_CVPCB
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_EESCHEMA
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_GERBVIEW
,
WinEDA_MainFrame
::
Process_Fct
)
BEGIN_EVENT_TABLE
(
WinEDA_MainFrame
,
WinEDA_BasicFrame
)
#ifdef KICAD_PYTHON
EVT_SIZE
(
WinEDA_MainFrame
::
OnSize
)
EVT_BUTTON
(
ID_RUN_PYTHON
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_CLOSE
(
WinEDA_MainFrame
::
OnCloseWindow
)
#endif
EVT_SASH_DRAGGED
(
ID_LEFT_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_BOTTOM_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_MAIN_COMMAND
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_MENU_RANGE
(
ID_LOAD_PROJECT
,
ID_LOAD_FILE_10
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_SAVE_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
EVT_TOOL
(
ID_NEW_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
/*****************************************************************************/
EVT_TOOL
(
ID_LOAD_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
END_EVENT_TABLE
()
EVT_TOOL
(
ID_SAVE_PROJECT
,
WinEDA_MainFrame
::
Process_Files
)
/*****************************************************************************/
EVT_TOOL
(
ID_SAVE_AND_ZIP_FILES
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_EXIT
,
WinEDA_MainFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_TO_EDITOR
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_MENU
(
ID_BROWSE_AN_SELECT_FILE
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_MENU
(
ID_SELECT_PREFERED_EDITOR
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_DEFAULT_PDF_BROWSER
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_PREFERED_PDF_BROWSER
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SELECT_PREFERED_PDF_BROWSER_NAME
,
WinEDA_MainFrame
::
Process_Preferences
)
EVT_MENU
(
ID_SAVE_AND_ZIP_FILES
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_READ_ZIP_ARCHIVE
,
WinEDA_MainFrame
::
Process_Files
)
EVT_MENU
(
ID_PROJECT_TREE_REFRESH
,
WinEDA_MainFrame
::
OnRefresh
)
EVT_MENU
(
ID_PREFERENCES_FONT_INFOSCREEN
,
WinEDA_MainFrame
::
Process_Preferences
)
/**
* @brief TODO
*/
/*****************************************************************************/
void
WinEDA_MainFrame
::
ReCreateMenuBar
()
/*****************************************************************************/
{
int
ii
,
jj
;
wxMenuBar
*
menuBar
=
GetMenuBar
()
;
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
// Check if menubar is empty
WinEDA_MainFrame
::
SetLanguage
)
if
(
menuBar
==
NULL
)
{
m_MenuBar
=
menuBar
=
new
wxMenuBar
();
m_FilesMenu
=
new
wxMenu
;
EVT_MENU
(
ID_GENERAL_HELP
,
WinEDA_MainFrame
::
GetKicadHelp
)
// Open project
EVT_MENU
(
ID_KICAD_ABOUT
,
WinEDA_MainFrame
::
GetKicadAbout
)
wxMenuItem
*
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_LOAD_PROJECT
,
_
(
"&Open Project"
),
_
(
"Select an existing project"
)
);
item
->
SetBitmap
(
open_project_xpm
);
m_FilesMenu
->
Append
(
item
);
EVT_BUTTON
(
ID_TO_PCB
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_CVPCB
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_EESCHEMA
,
WinEDA_MainFrame
::
Process_Fct
)
EVT_BUTTON
(
ID_TO_GERBVIEW
,
WinEDA_MainFrame
::
Process_Fct
)
#ifdef KICAD_PYTHON
// New project
EVT_BUTTON
(
ID_RUN_PYTHON
,
WinEDA_MainFrame
::
Process_Fct
)
item
=
new
wxMenuItem
(
m_FilesMenu
,
#endif
ID_NEW_PROJECT
,
_
(
"&New Project"
),
_
(
"Create new project"
)
);
item
->
SetBitmap
(
new_project_xpm
);
m_FilesMenu
->
Append
(
item
);
END_EVENT_TABLE
()
// Save project
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_SAVE_PROJECT
,
_
(
"&Save Project"
),
_
(
"Save current project"
)
);
item
->
SetBitmap
(
save_project_xpm
);
m_FilesMenu
->
Append
(
item
);
/*******************************************/
void
WinEDA_MainFrame
::
ReCreateMenuBar
()
/*******************************************/
{
int
ii
,
jj
;
wxMenuBar
*
menuBar
=
GetMenuBar
()
;
if
(
menuBar
==
NULL
)
// Separator
m_FilesMenu
->
AppendSeparator
();
// Archive project
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_SAVE_AND_ZIP_FILES
,
_
(
"&Archive project"
),
_
(
"Archive project files in zip archive"
)
);
item
->
SetBitmap
(
zip_xpm
);
m_FilesMenu
->
Append
(
item
);
// Unarchive project
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_READ_ZIP_ARCHIVE
,
_
(
"&Unarchive project"
),
_
(
"Unarchive project files from zip file"
)
);
item
->
SetBitmap
(
unzip_xpm
);
m_FilesMenu
->
Append
(
item
);
// Separator
m_FilesMenu
->
AppendSeparator
();
// Exit
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_EXIT
,
_
(
"E&xit"
),
_
(
"Quit KiCad"
)
);
item
->
SetBitmap
(
exit_xpm
);
m_FilesMenu
->
Append
(
item
);
// Create last 10 project entries
m_FilesMenu
->
AppendSeparator
();
for
(
ii
=
0
;
ii
<
10
;
ii
++
)
{
{
m_MenuBar
=
menuBar
=
new
wxMenuBar
();
m_MenuBar
=
menuBar
=
new
wxMenuBar
();
m_FilesMenu
=
new
wxMenu
;
if
(
GetLastProject
(
ii
).
IsEmpty
()
)
wxMenuItem
*
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_LOAD_PROJECT
,
break
;
_
(
"&Open Project"
),
_
(
"Select an existing project"
)
);
m_FilesMenu
->
Append
(
ID_LOAD_FILE_1
+
ii
,
GetLastProject
(
ii
)
);
item
->
SetBitmap
(
open_project_xpm
);
m_FilesMenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_NEW_PROJECT
,
_
(
"&New Project"
),
_
(
"Create new project"
)
);
item
->
SetBitmap
(
new_project_xpm
);
m_FilesMenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_SAVE_PROJECT
,
_
(
"&Save Project"
),
_
(
"Save current project"
)
);
item
->
SetBitmap
(
save_project_xpm
);
m_FilesMenu
->
Append
(
item
);
m_FilesMenu
->
AppendSeparator
();
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_SAVE_AND_ZIP_FILES
,
_
(
"&Archive project"
),
_
(
"Archive project files in zip file"
)
);
item
->
SetBitmap
(
zip_xpm
);
m_FilesMenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_READ_ZIP_ARCHIVE
,
_
(
"&Unarchive project"
),
_
(
"Unarchive project files from zip file"
)
);
item
->
SetBitmap
(
unzip_xpm
);
m_FilesMenu
->
Append
(
item
);
m_FilesMenu
->
AppendSeparator
();
item
=
new
wxMenuItem
(
m_FilesMenu
,
ID_EXIT
,
_
(
"E&xit"
),
_
(
"Quit KiCad"
)
);
item
->
SetBitmap
(
exit_xpm
);
m_FilesMenu
->
Append
(
item
);
// Creation des selections des anciens fichiers
m_FilesMenu
->
AppendSeparator
();
for
(
ii
=
0
;
ii
<
10
;
ii
++
)
{
if
(
GetLastProject
(
ii
).
IsEmpty
()
)
break
;
m_FilesMenu
->
Append
(
ID_LOAD_FILE_1
+
ii
,
GetLastProject
(
ii
)
);
}
// Menu Browse
wxMenu
*
browseMenu
=
new
wxMenu
();
item
=
new
wxMenuItem
(
browseMenu
,
ID_TO_EDITOR
,
_
(
"&Editor"
),
_
(
"Text editor"
)
);
item
->
SetBitmap
(
editor_xpm
);
browseMenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
browseMenu
,
ID_BROWSE_AN_SELECT_FILE
,
_
(
"&Browse Files"
),
_
(
"Read or edit files"
)
);
item
->
SetBitmap
(
browse_files_xpm
);
browseMenu
->
Append
(
item
);
browseMenu
->
AppendSeparator
();
item
=
new
wxMenuItem
(
browseMenu
,
ID_SELECT_PREFERED_EDITOR
,
_
(
"&Select Editor"
),
_
(
"Select your prefered editor for file browsing"
)
);
item
->
SetBitmap
(
editor_xpm
);
browseMenu
->
Append
(
item
);
// Preferences menu:
wxMenu
*
PreferencesMenu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
PreferencesMenu
,
ID_PREFERENCES_FONT_INFOSCREEN
,
_
(
"Fonts"
),
_
(
"Font preferences"
));
item
->
SetBitmap
(
fonts_xpm
);
PreferencesMenu
->
Append
(
item
);
// Submenu Pdf Browser selection: system browser or user selected browser (and its name)
wxMenu
*
SubMenuPdfBrowserChoice
=
new
wxMenu
;
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_DEFAULT_PDF_BROWSER
,
_
(
"Default Pdf Viewer"
),
_
(
"Use the default (system) PDF viewer used to browse datasheets"
),
wxITEM_CHECK
);
SETBITMAPS
(
datasheet_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
SubMenuPdfBrowserChoice
->
Check
(
ID_SELECT_DEFAULT_PDF_BROWSER
,
g_EDA_Appl
->
m_PdfBrowserIsDefault
);
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_PREFERED_PDF_BROWSER
,
_
(
"Favourite Pdf Viewer"
),
_
(
"Use your favourite PDF viewer used to browse datasheets"
),
wxITEM_CHECK
);
SETBITMAPS
(
preference_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
SubMenuPdfBrowserChoice
->
AppendSeparator
();
SubMenuPdfBrowserChoice
->
Check
(
ID_SELECT_PREFERED_PDF_BROWSER
,
!
g_EDA_Appl
->
m_PdfBrowserIsDefault
);
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_PREFERED_PDF_BROWSER_NAME
,
_
(
"Select Pdf Viewer"
),
_
(
"Select your favourite PDF viewer used to browse datasheets"
));
item
->
SetBitmap
(
datasheet_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
PreferencesMenu
,
SubMenuPdfBrowserChoice
,
-
1
,
_
(
"Pdf Browser"
),
wxT
(
"Pdf Browser choice: default or user selection"
),
datasheet_xpm
);
PreferencesMenu
->
AppendSeparator
();
m_Parent
->
SetLanguageList
(
PreferencesMenu
);
// Menu Help:
wxMenu
*
helpMenu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
helpMenu
,
ID_GENERAL_HELP
,
_
(
"&Contents"
),
_
(
"Open the kicad manual"
));
item
->
SetBitmap
(
help_xpm
);
helpMenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
helpMenu
,
ID_KICAD_ABOUT
,
_
(
"&About Kicad"
),
_
(
"About kicad project manager"
));
item
->
SetBitmap
(
info_xpm
);
helpMenu
->
Append
(
item
);
menuBar
->
Append
(
m_FilesMenu
,
_
(
"&Projects"
));
menuBar
->
Append
(
browseMenu
,
_
(
"&Browse"
));
menuBar
->
Append
(
PreferencesMenu
,
_
(
"&Preferences"
));
menuBar
->
Append
(
helpMenu
,
_
(
"&Help"
));
// Associate the menu bar with the frame
SetMenuBar
(
menuBar
);
}
}
else
// simple mise a jour de la liste des fichiers anciens
/*************************************************************************/
wxMenu
*
browseMenu
=
new
wxMenu
();
/*************************************************************************/
// Editor
item
=
new
wxMenuItem
(
browseMenu
,
// Entry in menu
ID_TO_EDITOR
,
// Entry ID
_
(
"&Editor"
),
// Entry text
_
(
"Text editor"
)
);
// Status bar text
item
->
SetBitmap
(
editor_xpm
);
// Entry XPM Bitmap
browseMenu
->
Append
(
item
);
// Append wxMenuItem to menu
// Browse files
item
=
new
wxMenuItem
(
browseMenu
,
ID_BROWSE_AN_SELECT_FILE
,
_
(
"&Browse Files"
),
_
(
"Read or edit files"
)
);
item
->
SetBitmap
(
browse_files_xpm
);
browseMenu
->
Append
(
item
);
// Separator
browseMenu
->
AppendSeparator
();
// Select editor
item
=
new
wxMenuItem
(
browseMenu
,
ID_SELECT_PREFERED_EDITOR
,
_
(
"&Select Editor"
),
_
(
"Select your prefered editor for file browsing"
)
);
item
->
SetBitmap
(
editor_xpm
);
browseMenu
->
Append
(
item
);
/*************************************************************************/
wxMenu
*
PreferencesMenu
=
new
wxMenu
;
/*************************************************************************/
// Fonts
item
=
new
wxMenuItem
(
PreferencesMenu
,
ID_PREFERENCES_FONT_INFOSCREEN
,
_
(
"Fonts"
),
_
(
"Font preferences"
));
item
->
SetBitmap
(
fonts_xpm
);
PreferencesMenu
->
Append
(
item
);
// Submenu Pdf Browser selection: system browser or user
// selected browser (and its name)
/*************************************************************************/
wxMenu
*
SubMenuPdfBrowserChoice
=
new
wxMenu
;
/*************************************************************************/
// Default PDF viewer
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_DEFAULT_PDF_BROWSER
,
_
(
"Default PDF Viewer"
),
_
(
"Use the default (system) PDF viewer used to browse datasheets"
),
wxITEM_CHECK
);
SETBITMAPS
(
datasheet_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
SubMenuPdfBrowserChoice
->
Check
(
ID_SELECT_DEFAULT_PDF_BROWSER
,
g_EDA_Appl
->
m_PdfBrowserIsDefault
);
// Favourite PDF viewer
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_PREFERED_PDF_BROWSER
,
_
(
"Favourite PDF Viewer"
),
_
(
"Use your favourite PDF viewer used to browse datasheets"
),
wxITEM_CHECK
);
SETBITMAPS
(
preference_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
SubMenuPdfBrowserChoice
->
AppendSeparator
();
SubMenuPdfBrowserChoice
->
Check
(
ID_SELECT_PREFERED_PDF_BROWSER
,
!
g_EDA_Appl
->
m_PdfBrowserIsDefault
);
item
=
new
wxMenuItem
(
SubMenuPdfBrowserChoice
,
ID_SELECT_PREFERED_PDF_BROWSER_NAME
,
_
(
"Select Pdf Viewer"
),
_
(
"Select your favourite PDF viewer used to browse datasheets"
));
item
->
SetBitmap
(
datasheet_xpm
);
SubMenuPdfBrowserChoice
->
Append
(
item
);
ADD_MENUITEM_WITH_HELP_AND_SUBMENU
(
PreferencesMenu
,
SubMenuPdfBrowserChoice
,
-
1
,
_
(
"Pdf Browser"
),
wxT
(
"Pdf Browser choice: default or user selection"
),
datasheet_xpm
);
PreferencesMenu
->
AppendSeparator
();
m_Parent
->
SetLanguageList
(
PreferencesMenu
);
/*************************************************************************/
wxMenu
*
helpMenu
=
new
wxMenu
;
/*************************************************************************/
// Contents
item
=
new
wxMenuItem
(
helpMenu
,
ID_GENERAL_HELP
,
_
(
"&Contents"
),
_
(
"Open the kicad manual"
));
item
->
SetBitmap
(
help_xpm
);
helpMenu
->
Append
(
item
);
// About Kicad
item
=
new
wxMenuItem
(
helpMenu
,
ID_KICAD_ABOUT
,
_
(
"&About Kicad"
),
_
(
"About kicad project manager"
));
item
->
SetBitmap
(
info_xpm
);
helpMenu
->
Append
(
item
);
// Append menus to menuBar
menuBar
->
Append
(
m_FilesMenu
,
_
(
"&Projects"
));
menuBar
->
Append
(
browseMenu
,
_
(
"&Browse"
));
menuBar
->
Append
(
PreferencesMenu
,
_
(
"&Preferences"
));
menuBar
->
Append
(
helpMenu
,
_
(
"&Help"
));
// Associate the menu bar with the frame
SetMenuBar
(
menuBar
);
}
else
// TODO (ENGLISH!) simple mise a jour de la liste des fichiers anciens
{
wxMenuItem
*
item
;
int
max_file
=
m_Parent
->
m_LastProjectMaxCount
;
for
(
ii
=
max_file
-
1
;
ii
>=
0
;
ii
--
)
{
{
wxMenuItem
*
item
;
if
(
m_FilesMenu
->
FindItem
(
ID_LOAD_FILE_1
+
ii
)
)
int
max_file
=
m_Parent
->
m_LastProjectMaxCount
;
{
for
(
ii
=
max_file
-
1
;
ii
>=
0
;
ii
--
)
item
=
m_FilesMenu
->
Remove
(
ID_LOAD_FILE_1
+
ii
);
{
if
(
m_FilesMenu
->
FindItem
(
ID_LOAD_FILE_1
+
ii
)
)
if
(
item
)
{
delete
item
;
item
=
m_FilesMenu
->
Remove
(
ID_LOAD_FILE_1
+
ii
);
}
if
(
item
)
delete
item
;
}
}
}
for
(
jj
=
0
,
ii
=
0
;
ii
<
max_file
;
ii
++
)
for
(
jj
=
0
,
ii
=
0
;
ii
<
max_file
;
ii
++
)
{
{
if
(
GetLastProject
(
ii
).
IsEmpty
()
)
if
(
GetLastProject
(
ii
).
IsEmpty
()
)
break
;
break
;
m_FilesMenu
->
Append
(
ID_LOAD_FILE_1
+
jj
,
GetLastProject
(
ii
)
);
jj
++
;
m_FilesMenu
->
Append
(
ID_LOAD_FILE_1
+
jj
,
GetLastProject
(
ii
)
);
}
jj
++
;
}
}
}
}
}
/***************************************************/
/**
* @brief TODO
*/
/*****************************************************************************/
void
WinEDA_MainFrame
::
RecreateBaseHToolbar
()
void
WinEDA_MainFrame
::
RecreateBaseHToolbar
()
/***************************************************/
/***************************************************
**************************
/
{
{
if
(
m_HToolBar
!=
NULL
)
return
;
// Check if toolbar is not already set
if
(
m_HToolBar
!=
NULL
)
m_HToolBar
=
new
WinEDA_Toolbar
(
TOOLBAR_MAIN
,
this
,
ID_H_TOOLBAR
,
TRUE
);
return
;
SetToolBar
(
m_HToolBar
);
// Allocate memory for m_HToolBar
// Set up toolbar
m_HToolBar
=
new
WinEDA_Toolbar
(
TOOLBAR_MAIN
,
this
,
ID_H_TOOLBAR
,
TRUE
);
m_HToolBar
->
AddTool
(
ID_NEW_PROJECT
,
BITMAP
(
new_project_xpm
),
SetToolBar
(
m_HToolBar
);
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Create new project descriptor"
));
// Set up toolbar
m_HToolBar
->
AddTool
(
ID_NEW_PROJECT
,
// Entry ID
m_HToolBar
->
AddTool
(
ID_LOAD_PROJECT
,
BITMAP
(
open_project_xpm
),
BITMAP
(
new_project_xpm
),
// XPM Bitmap
wxNullBitmap
,
FALSE
,
wxNullBitmap
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
FALSE
,
_
(
"Select an existing project descriptor"
));
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
m_HToolBar
->
AddTool
(
ID_SAVE_PROJECT
,
BITMAP
(
save_project_xpm
),
_
(
"Create new project"
));
// Tooltip
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Save current project descriptor"
));
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
ID_SAVE_AND_ZIP_FILES
,
BITMAP
(
zip_xpm
),
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Archive all project files"
));
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
ID_PROJECT_TREE_REFRESH
,
BITMAP
(
reload_xpm
),
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Refresh project tree"
));
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar
->
Realize
();
}
// Load project
m_HToolBar
->
AddTool
(
ID_LOAD_PROJECT
,
// Entry ID
BITMAP
(
open_project_xpm
),
// XPM Bitmap
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Load existing project"
));
// Tooltip
// Save project
m_HToolBar
->
AddTool
(
ID_SAVE_PROJECT
,
// Entry ID
BITMAP
(
save_project_xpm
),
// XPM Bitmap
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Save current project"
));
// Tooltip
// Separator
m_HToolBar
->
AddSeparator
();
// Save and archive files
m_HToolBar
->
AddTool
(
ID_SAVE_AND_ZIP_FILES
,
// Entry ID
BITMAP
(
zip_xpm
),
// XPM Bitmap
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Archive all project files"
));
// Tooltip
// Separator
m_HToolBar
->
AddSeparator
();
// Refresh project tree
m_HToolBar
->
AddTool
(
ID_PROJECT_TREE_REFRESH
,
// Entry ID
BITMAP
(
reload_xpm
),
// XPM Bitmap
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Refresh project tree"
));
// Tooltip
m_HToolBar
->
Realize
();
// Create m_HToolBar
}
kicad/treeprj_frame.cpp
View file @
76467a7f
...
@@ -65,7 +65,6 @@ WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
...
@@ -65,7 +65,6 @@ WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
{
{
m_Parent
=
parent
;
m_Parent
=
parent
;
m_TreeProject
=
NULL
;
m_TreeProject
=
NULL
;
wxMenu
*
menu
=
m_ContextMenus
[
TREE_PY
];
wxMenuItem
*
item
;
wxMenuItem
*
item
;
m_PopupMenu
=
NULL
;
m_PopupMenu
=
NULL
;
...
@@ -101,6 +100,7 @@ WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
...
@@ -101,6 +100,7 @@ WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
for
(
int
i
=
0
;
i
<
TREE_MAX
;
i
++
)
for
(
int
i
=
0
;
i
<
TREE_MAX
;
i
++
)
m_ContextMenus
.
push_back
(
new
wxMenu
()
);
m_ContextMenus
.
push_back
(
new
wxMenu
()
);
wxMenu
*
menu
=
m_ContextMenus
[
TREE_PY
];
// Python script context menu
// Python script context menu
#ifdef KICAD_PYTHON
#ifdef KICAD_PYTHON
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment