~ubuntu-branches/ubuntu/karmic/codelite/karmic

« back to all changes in this revision

Viewing changes to LiteEditor/frame.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-08-15 17:42:43 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090815174243-nlb9ikgigbiybz12
Tags: 1.0.2893+dfsg-0ubuntu1
* debian/rules:
  + Tidy up get-orig-source rule
* debian/control:
  + Bump Standards-Version
  + Change Maintainer email address to @ubuntu.com
  + Drop cdbs build-dependency
* debian/copyright:
  + Update to DEP-5 format
* debian/patches/00_add-fPIC.patch:
  + Dropped, fix upstream
* Closes LP: #413992

Show diffs side-by-side

added added

removed removed

Lines of Context:
1207
1207
        SessionEntry session;
1208
1208
        session.SetWorkspaceName(sessionName);
1209
1209
        GetMainBook()->SaveSession(session);
 
1210
        ManagerST::Get()->GetBreakpointsMgr()->SaveSession(session);
1210
1211
        SessionManager::Get().Save(sessionName, session);
1211
1212
        SessionManager::Get().SetLastWorkspaceName(sessionName);
1212
1213
 
2477
2478
void Frame::OnAppActivated(wxActivateEvent &e)
2478
2479
{
2479
2480
        if (m_theFrame && e.GetActive()) {
 
2481
                m_theFrame->ReloadExternallyModifiedProjectFiles();
2480
2482
                m_theFrame->GetMainBook()->ReloadExternallyModified();
2481
2483
        }
2482
2484
        e.Skip();
3249
3251
        SetStatusMessage(msg, col);
3250
3252
}
3251
3253
 
3252
 
void Frame::OnReloadExternallModified(wxCommandEvent& e)
 
3254
void Frame::OnReloadExternallModified(wxCommandEvent& e)
3253
3255
{
3254
3256
        wxUnusedVar(e);
3255
 
        GetMainBook()->ReloadExternallyModified();
3256
 
}
 
3257
        ReloadExternallyModifiedProjectFiles();
 
3258
        GetMainBook()->ReloadExternallyModified();
 
3259
}
 
3260
 
 
3261
void Frame::ReloadExternallyModifiedProjectFiles()
 
3262
{
 
3263
        Workspace *workspace = WorkspaceST::Get();
 
3264
        bool workspace_modified = false, project_modified = false;
 
3265
 
 
3266
        // check if the workspace needs reloading and ask the user for confirmation
 
3267
        // if it does
 
3268
        if (workspace->GetWorkspaceLastModifiedTime() < workspace->GetFileLastModifiedTime())
 
3269
        {
 
3270
                // always update last modification time: if the user chooses to reload it
 
3271
                // will not matter, and it avoids the program prompting the user repeatedly
 
3272
                // if he chooses not to reload the workspace
 
3273
                workspace->SetWorkspaceLastModifiedTime(workspace->GetFileLastModifiedTime());
 
3274
                workspace_modified = true;
 
3275
        }
 
3276
 
 
3277
        // check if any of the projects in the workspace needs reloading
 
3278
        wxArrayString projects;
 
3279
        workspace->GetProjectList(projects);
 
3280
 
 
3281
        for (size_t i = 0; i < projects.GetCount(); ++i)
 
3282
        {
 
3283
                wxString errStr;
 
3284
                ProjectPtr proj = workspace->FindProjectByName(projects[i], errStr);
 
3285
 
 
3286
                if (proj->GetProjectLastModifiedTime() < proj->GetFileLastModifiedTime())
 
3287
                {
 
3288
                        // always update last modification time: if the user chooses to reload it
 
3289
                        // will not matter, and it avoids the program prompting the user repeatedly
 
3290
                        // if he chooses not to reload some of the projects
 
3291
                        proj->SetProjectLastModifiedTime(proj->GetFileLastModifiedTime());
 
3292
                        project_modified = true;
 
3293
                }
 
3294
        }
 
3295
 
 
3296
        if (!project_modified && !workspace_modified)
 
3297
                return;
 
3298
 
 
3299
        if(wxMessageBox(_("Workspace or project settings have been modified, would you like to reload the workspace and all contained projects?"), wxT("CodeLite"), wxICON_QUESTION|wxYES_NO) == wxYES) {
 
3300
                ManagerST::Get()->ReloadWorkspace();
 
3301
                return;
 
3302
        }
 
3303
}