@@ -33,32 +33,12 @@ bool WildCardListMatch(wxString list, wxString name)
3333}
3434
3535
36- int ID_LangMenu_Settings=wxNewId();
37- int ID_LangMenu_Run=wxNewId();
38- int ID_LangMenu_DebugSendCommand=wxNewId();
39- int ID_LangMenu_ShowWatch=wxNewId();
40- int ID_LangMenu_UpdateWatch=wxNewId();
41-
42- int ID_PipedProcess=wxNewId();
43- int ID_TimerPollDebugger=wxNewId();
44-
45- // assign menu IDs to correspond with toolbar buttons
46- int ID_LangMenu_RunPiped = wxNewId();// XRCID("idPyDebuggerMenuDebug");
36+ int ID_INTERP_WINDOW_TOGGLE =wxNewId();
4737
4838// events handling
49- BEGIN_EVENT_TABLE (PythonInterpreter, cbToolPlugin )
39+ BEGIN_EVENT_TABLE (PythonInterpreter, cbPlugin )
5040 // add any events you want to handle here
51- // EVT_MENU(ID_LangMenu_Run,PythonInterpreter::OnRun)
52- // EVT_MENU(ID_LangMenu_RunPiped,PythonInterpreter::OnDebugTarget)
53- // EVT_MENU(XRCID("idPyDebuggerMenuDebug"),PythonInterpreter::OnContinue)
54- // EVT_MENU(XRCID("idPyDebuggerMenuNext"),PythonInterpreter::OnNext)
55- // EVT_MENU(XRCID("idPyDebuggerMenuStep"),PythonInterpreter::OnStep)
56- // EVT_MENU(XRCID("idPyDebuggerMenuStop"),PythonInterpreter::OnStop)
57- // EVT_MENU(ID_LangMenu_DebugSendCommand,PythonInterpreter::OnSendCommand)
58- // EVT_MENU(ID_LangMenu_ShowWatch,PythonInterpreter::OnViewWatch)
59- // EVT_MENU(ID_LangMenu_UpdateWatch,PythonInterpreter::OnUpdateWatch)
60- // EVT_END_PROCESS(ID_PipedProcess, PythonInterpreter::OnTerminatePipedProcess)
61- // EVT_TIMER(ID_TimerPollDebugger, PythonInterpreter::OnTimer)
41+ EVT_MENU (ID_INTERP_WINDOW_TOGGLE ,PythonInterpreter::OnToggleInterpreterWindow)
6242END_EVENT_TABLE()
6343
6444
@@ -103,14 +83,6 @@ void PythonInterpreter::OnAttach()
10383 evt.floatingSize .Set (400 , 300 );
10484 evt.minimumSize .Set (200 , 150 );
10585 Manager::Get ()->ProcessEvent (evt);
106-
107- CodeBlocksDockEvent evt2 (cbEVT_SHOW_DOCK_WINDOW);
108- evt2.pWindow = m_shellmgr;
109- Manager::Get ()->ProcessEvent (evt2);
110- wxArrayString as;
111- m_shellmgr->LaunchProcess (_T (" " ),_T (" Python" ),_ (" Python Interpreter" ),as);
112- m_shellmgr->Enable ();
113-
11486#endif
11587}
11688
@@ -128,6 +100,16 @@ void PythonInterpreter::OnRelease(bool appShutDown)
128100#endif
129101}
130102
103+ void PythonInterpreter::OnToggleInterpreterWindow (wxCommandEvent &event)
104+ {
105+ #ifndef TOOLSPLUSLINK
106+ CodeBlocksDockEvent evt (cbEVT_SHOW_DOCK_WINDOW);
107+ evt.pWindow = m_shellmgr;
108+ Manager::Get ()->ProcessEvent (evt);
109+ #endif
110+ // m_shellmgr->Enable();
111+ }
112+
131113int PythonInterpreter::Execute ()
132114{
133115#ifdef TOOLSPLUSLINK
@@ -167,16 +149,23 @@ void PythonInterpreter::BuildMenu(wxMenuBar* menuBar)
167149 // to add any menu items you want...
168150 // Append any items you need in the menu...
169151 // NOTE: Be careful in here... The application's menubar is at your disposal.
170- // LangMenu=new wxMenu;
171- // CreateMenu();
172- // int pos = menuBar->FindMenu(_T("Plugins"));
173- // if(pos!=wxNOT_FOUND)
174- // menuBar->Insert(pos, LangMenu, _T("P&yDebug"));
175- // else
176- // {
177- // delete LangMenu;
178- // LangMenu=0;
179- // }
152+ #ifndef TOOLSPLUSLINK
153+ Manager::Get ()->GetLogManager ()->Log (_T (" ~~~~~~~~~~~~~~~~Building menu~~~~~~~~~~~~~~~~~" ));
154+ int pos = menuBar->FindMenu (_ (" View" ));
155+ if (pos==wxNOT_FOUND)
156+ {
157+ Manager::Get ()->GetLogManager ()->Log (_T (" View menu not found" ));
158+ return ;
159+ }
160+ wxMenu *m = menuBar->GetMenu (pos);
161+ pos = m->FindItem (_ (" Start Page" ));
162+ if (pos==wxNOT_FOUND)
163+ {
164+ Manager::Get ()->GetLogManager ()->Log (_T (" Start page not found" ));
165+ return ;
166+ }
167+ m->InsertCheckItem (pos+1 ,ID_INTERP_WINDOW_TOGGLE ,_ (" Python interpreters" ),_ (" Show or hide the python interpreter window" ));
168+ #endif
180169}
181170
182171void PythonInterpreter::BuildModuleMenu (const ModuleType type, wxMenu* menu, const FileTreeData* data)
@@ -185,73 +174,11 @@ void PythonInterpreter::BuildModuleMenu(const ModuleType type, wxMenu* menu, con
185174 // Check the parameter \"type\" and see which module it is
186175 // and append any items you need in the menu...
187176 // TIP: for consistency, add a separator as the first item...
188- // if(type==mtProjectManager)
189- // {
190- // if(data)
191- // {
192- // if(data->GetKind()==FileTreeData::ftdkFile)
193- // {
194- // ProjectFile *f=data->GetProjectFile();
195- // if(f)
196- // {
197- // wxString name=f->file.GetFullPath();
198- // wxString ext=f->file.GetExt();
199- // if(IsPythonFile(name))
200- // {
201- // m_RunTarget=name;
202- // m_RunTargetSelected=true;
203- // menu->AppendSeparator();
204- // // menu->Append(ID_LangMenu_Run,_T("Python Run"),_T(""));
205- // menu->Append(ID_LangMenu_RunPiped,_T("Python Debug"),_T(""));
206- // }
207- // }
208- // }
209- // }
210- // }
211- // if(type==mtEditorManager) // also type==mtOpenFilesList - not sure how to find out which file has been right clicked.
212- // {
213- // EditorManager* edMan = Manager::Get()->GetEditorManager();
214- // wxFileName activefile(edMan->GetActiveEditor()->GetFilename());
215- // wxString name=activefile.GetFullPath();
216- // if(IsPythonFile(name))
217- // {
218- // m_RunTarget=name;
219- // m_RunTargetSelected=true;
220- // menu->AppendSeparator();
221- // // menu->Append(ID_LangMenu_Run,_T("Python Run"),_T(""));
222- // menu->Append(ID_LangMenu_RunPiped,_T("Python Debug"),_T(""));
223- //
224- // }
225- // }
226- // if(type==mtUnknown) // also type==mtOpenFilesList - not sure how to find out which file has been right clicked.
227- // {
228- // if(data->GetKind()==FileTreeData::ftdkFile) //right clicked on folder in file explorer
229- // {
230- // wxFileName f(data->GetFolder());
231- // wxString filename=f.GetFullPath();
232- // wxString name=f.GetFullName();
233- // // cbMessageBox(filename+_T(" ")+name);
234- // if(IsPythonFile(name))
235- // {
236- // m_RunTarget=filename;
237- // m_RunTargetSelected=true;
238- // menu->AppendSeparator();
239- // // menu->Append(ID_LangMenu_Run,_T("Python Run"),_T(""));
240- // menu->Append(ID_LangMenu_RunPiped,_T("Python Debug"),_T(""));
241- //
242- // }
243- // }
244- // }
245177}
246178
247179bool PythonInterpreter::BuildToolBar (wxToolBar* toolBar)
248180{
249- // m_pTbar = toolBar;
250- // /* Loads toolbar using new Manager class functions */
251181// if (!IsAttached() || !toolBar)
252182// return false;
253- // wxString my_16x16=Manager::isToolBar16x16(toolBar) ? _T("_16x16") : _T("");
254- // Manager::AddonToolBar(toolBar,wxString(_T("py_debugger_toolbar"))+my_16x16);
255- // toolBar->Realize();
256183 return true ;
257184}
0 commit comments