~ubuntu-branches/debian/squeeze/codelite/squeeze

« back to all changes in this revision

Viewing changes to LiteEditor/frame.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-06-14 15:30:55 UTC
  • mfrom: (1.1.8 upstream) (0.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100614153055-dfmu128mp9862wpo
* New upstream bugfix release.
* Update debian/copyright
* Change my email address.
* Refresh patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
#include "options_dlg2.h"
117
117
#include <wx/msgdlg.h>
118
118
#include "tabgroupdlg.h"
 
119
#include "tabgroupmanager.h"
 
120
#include "tabgroupspane.h"
119
121
#include "cl_defs.h"
120
122
 
121
123
// from auto-generated file svninfo.cpp:
770
772
#else
771
773
        // set the path to codelite_indexer
772
774
        wxFileName exePath( wxStandardPaths::Get().GetExecutablePath() );
773
 
        tagsManager->SetCodeLiteIndexerPath(exePath.GetPath());
 
775
        tagsManager->SetCodeLiteIndexerPath(wxStandardPaths::Get().GetPluginsDir());
774
776
        ManagerST::Get()->SetCodeLiteLauncherPath(exePath.GetPath());
775
777
#endif
776
778
        tagsManager->StartCtagsProcess();
836
838
        sessConfFile << ManagerST::Get()->GetStarupDirectory() << wxT("/config/sessions.xml");
837
839
        SessionManager::Get().Load(sessConfFile);
838
840
 
 
841
        // Now the session's loaded, it's safe to fill the tabgroups tab
 
842
        GetWorkspacePane()->GetTabgroupsTab()->DisplayTabgroups();
 
843
 
839
844
        //try to locate the build tools
840
845
 
841
846
        long fix(1);
1264
1269
        return true;
1265
1270
}
1266
1271
 
 
1272
static bool IsTabgrouppaneEvent(wxEvent &event)
 
1273
{
 
1274
        // Handle common edit events
 
1275
        // If we don't do this here, the tabgrouppane tree
 
1276
        // never sees these events
 
1277
 
 
1278
        wxWindow *focusWin = wxWindow::FindFocus();
 
1279
        if ( focusWin ) {
 
1280
                switch (event.GetId()) {
 
1281
                case wxID_CUT:
 
1282
                case wxID_DELETE:
 
1283
                case wxID_COPY:
 
1284
                case wxID_PASTE: {
 
1285
                        wxTreeCtrl* tree = dynamic_cast<wxTreeCtrl*>(focusWin);
 
1286
                        if ( tree && tree->GetName() == wxT("tabgrouptree") && event.GetEventType() != wxEVT_UPDATE_UI ) {
 
1287
                                // If it's the right type/id, send it to the tree
 
1288
                                tree->GetEventHandler()->ProcessEvent(event);
 
1289
                                return true;    // to signify it's been dealt with
 
1290
                        }
 
1291
                        break;
 
1292
                }
 
1293
                default:
 
1294
                        break;
 
1295
                }
 
1296
        }
 
1297
        return false;
 
1298
}
 
1299
 
1267
1300
void Frame::DispatchCommandEvent(wxCommandEvent &event)
1268
1301
{
 
1302
        if ( IsTabgrouppaneEvent(event) ) {
 
1303
                // *Don't* skip the event here, or we'll get infinite recursion
 
1304
                return;
 
1305
        }
 
1306
 
1269
1307
        if ( !IsEditorEvent(event) ) {
1270
1308
                event.Skip();
1271
1309
                return;
1341
1379
        SearchThreadST::Get()->StopSearch();
1342
1380
 
1343
1381
        SaveLayoutAndSession();
 
1382
 
 
1383
        // In case we got some data in the clipboard, flush it so it will be available
 
1384
        // after our process exits
 
1385
        wxTheClipboard->Flush();
1344
1386
        event.Skip();
1345
1387
}
1346
1388
 
1530
1572
        EditorConfigST::Get()->GetRecentItems( previousgroups, wxT("RecentTabgroups") );
1531
1573
 
1532
1574
        SaveTabGroupDlg dlg(this, previousgroups);
1533
 
        wxString path = ManagerST::Get()->IsWorkspaceOpen() ? WorkspaceST::Get()->GetWorkspaceFileName().GetPath() : wxGetHomeDir();
1534
 
        dlg.SetComboPath(path);
1535
1575
 
1536
1576
        std::vector<LEditor*> editors;
1537
1577
        wxArrayString filepaths;
1556
1596
                        }
1557
1597
                }
1558
1598
 
1559
 
                path = dlg.GetComboPath();
1560
 
                if (path.IsEmpty() || !wxFileName::DirExists(path)) {
1561
 
                        if ( wxMessageBox(_("Please enter a valid directory in which to save the tab group"), wxT("CodeLite"), wxICON_ERROR|wxOK|wxCANCEL, this) != wxOK ) {
1562
 
                                return;
1563
 
                        } else {
1564
 
                                continue;
1565
 
                        }
1566
 
                }
 
1599
                wxString path = TabGroupsManager::Get()->GetTabgroupDirectory();
1567
1600
 
1568
1601
                if (path.Right(1) != wxFileName::GetPathSeparator()) {
1569
1602
                        path << wxFileName::GetPathSeparator();
1581
1614
                        session.SetTabgroupName(path + sessionName);
1582
1615
                        GetMainBook()->SaveSession(session, intArr);
1583
1616
                        SessionManager::Get().Save(session.GetTabgroupName(), session, wxString(wxT(".tabgroup")), tabgroupTag);
 
1617
                        // Add the new tabgroup to the tabgroup manager and pane
 
1618
                        GetWorkspacePane()->GetTabgroupsTab()->AddNewTabgroupToTree(filepath);
1584
1619
 
1585
1620
                        // Remove any previous instance of this group from the history, then prepend it and save
1586
1621
                        int index = previousgroups.Index(filepath);
2575
2610
 
2576
2611
void Frame::OnDebugRestart(wxCommandEvent &e)
2577
2612
{
2578
 
        if (DebuggerMgr::Get().GetActiveDebugger() && DebuggerMgr::Get().GetActiveDebugger()->IsRunning()) {
2579
 
                OnDebugStop(e);
 
2613
        IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
 
2614
        if(dbgr && dbgr->IsRunning() && ManagerST::Get()->DbgCanInteract()) {
 
2615
                dbgr->Restart();
2580
2616
        }
2581
 
        OnDebug(e);
2582
2617
}
2583
2618
 
2584
2619
void Frame::OnDebugRestartUI(wxUpdateUIEvent &e)
2585
2620
{
2586
2621
        CHECK_SHUTDOWN();
2587
2622
        IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
2588
 
        e.Enable(dbgr && dbgr->IsRunning());
 
2623
        e.Enable(dbgr && dbgr->IsRunning() && ManagerST::Get()->DbgCanInteract());
2589
2624
}
2590
2625
 
2591
2626
void Frame::OnDebugStop(wxCommandEvent &e)