Commit 163ba398 authored by lifekidyeaa's avatar lifekidyeaa

pcbnew: added ctrl-o,s,f

	added buttons for insert and replace module in the module editor 
with a new bitmap.  restored JP's original functionality for the insert 
button, replace linked to the new code. 
parent bc21c746
......@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-June-21 UPDATE Tim Hanson <tim@hardcarve.com>
================================================================================
+ pcbnew
1. added button to 'update' as well as 'insert' modules into main PCB
from within the module editor. Made them functional, of course.
2. added control-o, control-s & control-f to pcbnew,
though I'm not perfectly happy with the implementation -- wxwidgets puts
the control-characters in alphabetical order!
2007-June-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
......
......@@ -12,7 +12,7 @@
#define COMMON_GLOBL extern
#endif
/* Numero de ports TCP/IP utiliss par KICAD */
/* Numero de ports TCP/IP utilis�s par KICAD */
#define KICAD_PCB_PORT_SERVICE_NUMBER 4242
......@@ -208,7 +208,7 @@ private:
};
/* Gestion des feuilles de trac:
/* Gestion des feuilles de trac�:
*/
class Ki_PageDescr
{
......@@ -257,7 +257,7 @@ extern Ki_PageDescr g_Sheet_user ;
#endif
COMMON_GLOBL int g_LastKey; /* code de la derniere touche actionn */
COMMON_GLOBL int g_LastKey; /* code de la derniere touche actionn�� */
COMMON_GLOBL wxString g_ProductName
#ifdef EDA_BASE
= wxT("KiCad E.D.A. ")
......@@ -500,32 +500,32 @@ wxString DateAndTime(void);
int StrLenNumCmp(const wxChar *str1,const wxChar *str2, int NbMax);
/*
routine (compatible qsort() ) de comparaision pour classement alphabtique
Analogue a strncmp() mais les nombres sont compars selon leur valeur numrique
routine (compatible qsort() ) de comparaision pour classement alphab�tique
Analogue a strncmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
int StrNumICmp(const wxChar *str1,const wxChar *str2);
/* routine (compatible qsort() ) de comparaison pour classement alphabtique,
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compars selon leur valeur numrique
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
int StrLenNumICmp(const wxChar *str1,const wxChar *str2, int NbMax);
/* routine (compatible qsort() ) de comparaison pour classement alphabtique,
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compars selon leur valeur numrique
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
bool WildCompareString(const wxString & pattern, const wxString & string_to_tst,
bool case_sensitive = TRUE);
/* compare 2 noms de composants, selon regles usuelles
( Jokers * , ? , autoriss).
( Jokers * , ? , autoris�s).
la chaine de reference est "pattern"
si case_sensitive == TRUE (default), comparaison exacte
retourne TRUE si match FALSE si differences */
char * to_point(char * Text);
/* convertit les , en . dans une chaine. utilis pour compenser la fct printf
/* convertit les , en . dans une chaine. utilis� pour compenser la fct printf
qui genere les flottants avec une virgule au lieu du point en mode international */
/****************/
......@@ -598,8 +598,8 @@ int KeyWordOk(const wxString & KeyList, const wxString & Database );
cles donnes dans KeyList ( KeyList = suite de mots cles
separes par des espaces
Retourne:
0 si aucun mot cle trouv
1 si mot cle trouv
0 si aucun mot cle trouv
1 si mot cle trouv
*/
bool GetAssociatedDocument(wxFrame * frame, const wxString & LibPath,
const wxString & DocName);
......
......@@ -738,7 +738,8 @@ enum main_id {
ID_MODEDIT_DELETE_ITEM_BUTT,
ID_MODEDIT_PAD_SETTINGS,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
ID_MODEDIT_SAVE_MODULE_IN_BOARD,
ID_MODEDIT_INSERT_MODULE_IN_BOARD,
ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
ID_MODEDIT_EDIT_MODULE_PROPERTIES,
ID_MODEDIT_TRANSFORM_MODULE,
ID_MODEDIT_MODULE_ROTATE,
......
......@@ -63,7 +63,7 @@ class WinEDAChoiceBox;
#define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem
// Utilises mais non definies ici :
// Utilises mais non definies ici :
class LibraryStruct;
class EDA_LibComponentStruct;
class LibEDA_BaseStruct;
......@@ -195,7 +195,7 @@ public:
WinEDA_Toolbar * m_VToolBar; // Vertical (right side) Toolbar
WinEDA_Toolbar * m_AuxVToolBar; // Auxiliary Vertical (right side) Toolbar
WinEDA_Toolbar * m_OptionsToolBar; // Options Toolbar (left side)
WinEDA_Toolbar * m_AuxiliaryToolBar; // Toolbar auxiliaire (utilis dans pcbnew)
WinEDA_Toolbar * m_AuxiliaryToolBar; // Toolbar auxiliaire (utilis dans pcbnew)
WinEDAChoiceBox * m_SelGridBox; // Dialog box to choose the grid size
WinEDAChoiceBox * m_SelZoomBox; // Dialog box to choose the Zoom value
......@@ -212,9 +212,9 @@ public:
int m_UnitType; // Internal Unit type (0 = inch)
bool m_Draw_Axis; // TRUE pour avoir les axes dessines
bool m_Draw_Grid; // TRUE pour avoir la grille dessinee
bool m_Draw_Sheet_Ref; // TRUE pour avoir le cartouche dessin
bool m_Draw_Sheet_Ref; // TRUE pour avoir le cartouche dessin
bool m_Print_Sheet_Ref; // TRUE pour avoir le cartouche imprim
bool m_Print_Sheet_Ref; // TRUE pour avoir le cartouche imprim
bool m_Draw_Auxiliary_Axis; // TRUE pour avoir les axes auxiliaires dessines
wxPoint m_Auxiliary_Axis_Position; /* origine de l'axe auxiliaire (app:
dans la generation les fichiers de positionnement
......@@ -809,7 +809,7 @@ public:
/*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class de la fenetre d'dition des modules pour PCB */
/* Class de la fenetre d'dition des modules pour PCB */
/*********************************************************/
class WinEDA_ModuleEditFrame: public WinEDA_BasePcbFrame
......@@ -890,7 +890,7 @@ public:
/* class WinEDA_SchematicFrame */
/*******************************/
/* enum utilis dans RotationMiroir() */
/* enum utilis dans RotationMiroir() */
enum fl_rot_cmp
{
CMP_NORMAL, // orientation normale (O, pas de miroir)
......@@ -1318,7 +1318,7 @@ public:
/*****************************************************************/
/* Classe pour afficher et editer une coordonne en INCHES ou MM */
/* Classe pour afficher et editer une coordonne en INCHES ou MM */
/*****************************************************************/
class WinEDA_PositionCtrl
{
......@@ -1346,7 +1346,7 @@ public:
};
/*****************************************************************/
/* Classe pour afficher et editer une coordonne en INCHES ou MM */
/* Classe pour afficher et editer une coordonne en INCHES ou MM */
/*****************************************************************/
class WinEDA_SizeCtrl: public WinEDA_PositionCtrl
{
......
/* XPM */
static char * insert_module_board_xpm[] = {
"16 16 49 1",
" c None",
". c #000000",
"+ c #0F0F0E",
"@ c #FFF000",
"# c #FEFEFF",
"$ c #F9AB7F",
"% c #F55A00",
"& c #888883",
"* c #FFFFFF",
"= c #C8C36C",
"- c #8F8926",
"; c #D79B76",
"> c #DE5B0B",
", c #FDFDFE",
"' c #918800",
") c #2E2C10",
"! c #040404",
"~ c #E65400",
"{ c #DE6013",
"] c #BDB8B6",
"^ c #050506",
"/ c #F9F9FF",
"( c #F5F5FF",
"_ c #F1F1FF",
": c #EEEEFF",
"< c #CFCFE2",
"[ c #FCFCFF",
"} c #F8F8FF",
"| c #F1A37F",
"1 c #ED9F7F",
"2 c #DADAF7",
"3 c #060606",
"4 c #DEDEFF",
"5 c #070708",
"6 c #FBFBFF",
"7 c #F7F7FF",
"8 c #F4F4FF",
"9 c #F0F0FF",
"0 c #ECECFF",
"a c #E9E9FF",
"b c #E99B7F",
"c c #DADAFF",
"d c #F3F3FF",
"e c #E8E8FF",
"f c #E4E4FF",
"g c #E1E1FF",
"h c #DDDDFF",
"i c #D9D9FF",
"j c #D5D5FF",
"...........+@+ ",
".#$%$###&++@@@++",
".#%*%%%%+=@@@@@@",
".#$%$##*&+-@@@-+",
".######;>;+@@@+ ",
".#%%%%>>*+@@-@@+",
".#####,;>'@+++@'",
".#$%$##**)+! +)",
".#%*%%%%~{]^ ",
".#$%$/(_:<]^ ",
".##[}(_|%123 ",
".#%%%%%%*%45 ",
".67890a1%bc5 ",
".7d90efghij5 ",
"............ ",
" "};
/* XPM */
static char * repl_module_board_xpm[] = {
static char * update_module_board_xpm[] = {
"16 16 81 1",
" c None",
". c #000000",
......
......@@ -2,7 +2,7 @@
/* Routines generales de gestion des commandes usuelles */
/********************************************************/
/* fichier controle.cpp */
/* fichier controle.cpp */
/*
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
*/
......
......@@ -137,7 +137,7 @@ wxClientDC dc(DrawPanel);
break;
default:
DisplayError(this, wxT("WinEDA_PcbFrame::OnSelectOptionToolbar error"));
DisplayError(this, wxT("WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)"));
break;
}
......
......@@ -79,7 +79,16 @@ sous le courseur souris
DrawPanel->MouseToCursorSchema();
End_Route( (TRACK *) (GetScreen()->m_CurrentItem), DC);
break;
case (int('f') + GR_KB_CTRL) :
case (int('F') + GR_KB_CTRL) :
case 1030:{ // f = letter 6 in the alphabet + 1024 = 1030
wxCommandEvent evt;
evt.SetId(ID_FIND_ITEMS);
Process_Special_Functions(evt);
}
break;
case 'v': // Switch to alternate layer and Place a via if a track is in progress
case 'V':
if ( m_ID_current_state != ID_TRACK_BUTT ) return;
......@@ -97,6 +106,18 @@ sous le courseur souris
GetScreen()->SetRefreshReq();
break;
case 'o':
case 'O':
case (int('o') + GR_KB_CTRL) :
case (int('O') + GR_KB_CTRL) :
case 1039: //o is the 15th letter in the alphabet + 1024 = 1039
if( hotkey & GR_KB_CTRL ){
//try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_LOAD_FILE);
Files_io(evt);
}
break;
case 'r': // Rotation
case 'R':
if ( ItemFree )
......@@ -119,22 +140,32 @@ sous le courseur souris
case 's': // move to other side
case 'S':
if ( ItemFree )
module = Locate_Prefered_Module(m_Pcb,
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER );
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
{
module = (MODULE*)GetScreen()->m_CurrentItem;
// @todo: might need to add a layer check in if() below
if( module->IsLocked() )
module = 0; // do not move it.
}
if ( module )
{
GetScreen()->m_CurrentItem = module;
module->Display_Infos(this);
Change_Side_Module(module, DC);
}
case (int('s') + GR_KB_CTRL) :
case (int('S') + GR_KB_CTRL) :
case 1043: //as before, 19th letter..
if( hotkey & GR_KB_CTRL ){
//try not to duplicate save, load code etc.
wxCommandEvent evt;
evt.SetId(ID_SAVE_BOARD);
Files_io(evt);
}else{
if ( ItemFree )
module = Locate_Prefered_Module(m_Pcb,
CURSEUR_ON_GRILLE | IGNORE_LOCKED | MATCH_LAYER );
else if (GetScreen()->m_CurrentItem->m_StructType == TYPEMODULE)
{
module = (MODULE*)GetScreen()->m_CurrentItem;
// @todo: might need to add a layer check in if() below
if( module->IsLocked() )
module = 0; // do not move it.
}
if ( module )
{
GetScreen()->m_CurrentItem = module;
module->Display_Infos(this);
Change_Side_Module(module, DC);
}
}
break;
case 'L': // toggle module "MODULE_is_LOCKED" status:
......
......@@ -38,7 +38,7 @@ wxMenuBar * menuBar = GetMenuBar();
//////////////////
m_FilesMenu = new wxMenu;
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_MENU_LOAD_FILE,
_("Load Board"),
_("Load Board Ctrl-O"),
_("Delete old Board and Load new Board"));
item->SetBitmap(open_xpm);
m_FilesMenu->Append(item);
......@@ -70,7 +70,7 @@ wxMenuBar * menuBar = GetMenuBar();
// Add save menu
m_FilesMenu->AppendSeparator();
item = new wxMenuItem(m_FilesMenu, ID_MENU_SAVE_BOARD,
_("&Save board"),
_("&Save board Ctrl-S"),
_("Save current board") );
item->SetBitmap(save_xpm);
m_FilesMenu->Append(item);
......
......@@ -149,8 +149,8 @@ wxClientDC dc(DrawPanel);
if ( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
break;
case ID_MODEDIT_SAVE_MODULE_IN_BOARD:{
// seems that this should update modules in the current board,
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:{
// update modules in the current board,
// not just add it to the board with total disregard for the
// netlist...?
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame;
......@@ -234,7 +234,7 @@ wxClientDC dc(DrawPanel);
mainpcb->m_Status_Pcb = 0;
}
break;
/*case ID_MODEDIT_SAVE_MODULE_IN_BOARD:
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
{
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame;
BOARD * mainpcb = pcbframe->m_Pcb;
......@@ -249,6 +249,8 @@ wxClientDC dc(DrawPanel);
// Recherche de l'ancien module correspondant
//(qui a pu changer ou disparaitre a la suite d'�ditions)
//locate the corresponding former unit, which may have a different revision.
// I've taken this out, as it is superceded by 'update' above.
/*
if ( module_in_edit->m_Link )
{
oldmodule = mainpcb->m_Modules;
......@@ -258,7 +260,7 @@ wxClientDC dc(DrawPanel);
break;
}
}
*/
// Placement du module dans la liste des modules du PCB.
newmodule->Pnext = mainpcb->m_Modules;
mainpcb->m_Modules = newmodule;
......@@ -282,7 +284,7 @@ wxClientDC dc(DrawPanel);
pcbframe->GetScreen()->m_CurrentItem = NULL;
mainpcb->m_Status_Pcb = 0;
}
break;*/
break;
case ID_LIBEDIT_IMPORT_PART:
GetScreen()->ClearUndoRedoList();
......
......@@ -44,7 +44,8 @@ BEGIN_EVENT_TABLE(WinEDA_ModuleEditFrame, wxFrame)
EVT_TOOL(ID_MODEDIT_CHECK, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_PAD_SETTINGS, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_LOAD_MODULE_FROM_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_SAVE_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_INSERT_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_UPDATE_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_EDIT_MODULE_PROPERTIES, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_UNDO, WinEDA_ModuleEditFrame::Process_Special_Functions)
EVT_TOOL(ID_MODEDIT_REDO, WinEDA_ModuleEditFrame::Process_Special_Functions)
......@@ -93,7 +94,7 @@ BEGIN_EVENT_TABLE(WinEDA_ModuleEditFrame, wxFrame)
// Menu 3D Frame
EVT_MENU(ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame)
// PopUp Menu Zoom traits dans drawpanel.cpp
// PopUp Menu Zoom traits dans drawpanel.cpp
END_EVENT_TABLE()
......@@ -111,7 +112,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame(wxWindow * father, WinEDA_App *pa
m_FrameName = wxT("ModEditFrame");
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin
m_ZoomMaxValue = 1024;
// Give an icon
SetIcon(wxICON(icon_modedit));
......@@ -208,7 +209,8 @@ bool active, islib = TRUE;
m_HToolBar->EnableTool(ID_LIBEDIT_EXPORT_PART,active);
m_HToolBar->EnableTool(ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,active);
m_HToolBar->EnableTool(ID_MODEDIT_SAVE_LIBMODULE,active && islib);
m_HToolBar->EnableTool(ID_MODEDIT_SAVE_MODULE_IN_BOARD,active);
m_HToolBar->EnableTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD,active);
m_HToolBar->EnableTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD,active);
if ( GetScreen() )
{
m_HToolBar->EnableTool(ID_MODEDIT_UNDO,GetScreen()->m_UndoList && active);
......
......@@ -22,7 +22,8 @@
#include "New_FootPrint.xpm"
#include "module_options.xpm"
#include "Load_Module_Board.xpm"
#include "Repl_Module_Board.xpm"
#include "Insert_Module_Board.xpm"
#include "Update_Module_Board.xpm"
#ifdef __UNIX__
#define LISTBOX_WIDTH 120
......@@ -72,9 +73,13 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar(void)
BITMAP(load_module_board_xpm),
_("Load module from current board"));
m_HToolBar->AddTool(ID_MODEDIT_SAVE_MODULE_IN_BOARD, wxEmptyString,
BITMAP(repl_module_board_xpm),
m_HToolBar->AddTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString,
BITMAP(update_module_board_xpm),
_("Update module in current board"));
m_HToolBar->AddTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString,
BITMAP(insert_module_board_xpm),
_("Insert module into current board"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_LIBEDIT_IMPORT_PART, wxEmptyString,
......
......@@ -246,7 +246,7 @@ int ii;
m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP(zoom_optimal_xpm), _("auto zoom"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_FIND_ITEMS, wxEmptyString, BITMAP(find_xpm), _("Find components and texts"));
m_HToolBar->AddTool(ID_FIND_ITEMS, wxEmptyString, BITMAP(find_xpm), _("Find components and texts (Ctrl-F)"));
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_GET_NETLIST, wxEmptyString, BITMAP(netlist_xpm), _("Read Netlist"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment