Patch #3509 2013-10-11 18:49

davidallen

005694 : Auto synch ProjectManager and open tab
Download
3509-005694_Auto_sy.patch (4.1 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2013-10-17 07:20
Assigned to
tpetrov
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp   (revision 9363)
+++ src/sdk/editormanager.cpp   (working copy)
@@ -1195,6 +1195,20 @@
     CodeBlocksEvent evt2(cbEVT_EDITOR_ACTIVATED, -1, 0, eb);
     Manager::Get()->GetPluginManager()->NotifyPlugins(evt2);
 
+   ConfigManager* cfgEditor = Manager::Get()->GetConfigManager(_T("editor"));
+    if (cfgEditor->ReadBool(_T("/sync_editor_with_project_manager"), false))
+   {
+       cbEditor* ed = GetBuiltinActiveEditor();
+       if (ed)
+       {
+           ProjectFile* pf = ed->GetProjectFile();
+           if (pf)
+           {
+               Manager::Get()->GetProjectManager()->GetUI().ShowFileInTree(*pf);
+           }
+       }
+   }
+
     if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/tabs_stacked_based_switching")))
     {
         wxWindow*        wnd;
Index: src/src/editorconfigurationdlg.cpp
===================================================================
--- src/src/editorconfigurationdlg.cpp  (revision 9363)
+++ src/src/editorconfigurationdlg.cpp  (working copy)
@@ -138,6 +138,7 @@
     XRCCTRL(*this, "chkCamelCase",                wxCheckBox)->SetValue(cfg->ReadBool(_T("/camel_case"),                 false));
     XRCCTRL(*this, "chkResetZoom",                wxCheckBox)->SetValue(cfg->ReadBool(_T("/reset_zoom"),                 false));
     XRCCTRL(*this, "chkZoomAll",                  wxCheckBox)->SetValue(cfg->ReadBool(_T("/zoom_all"),                   false));
+    XRCCTRL(*this, "chkSyncEditorWithProjectManager", wxCheckBox)->SetValue(cfg->ReadBool(_T("/sync_editor_with_project_manager"), false));
     XRCCTRL(*this, "spnTabSize",                  wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/tab_size"),                    4));
     XRCCTRL(*this, "cmbViewWS",                   wxChoice)->SetSelection(cfg->ReadInt(_T("/view_whitespace"),           0));
     XRCCTRL(*this, "rbTabText",                   wxRadioBox)->SetSelection(cfg->ReadBool(_T("/tab_text_relative"),      true)? 1 : 0);
@@ -981,6 +982,7 @@
         }
         cfg->Write(_T("/reset_zoom"),                          resetZoom);
         cfg->Write(_T("/zoom_all"),                            zoomAll);
+        cfg->Write(_T("/sync_editor_with_project_manager"),    XRCCTRL(*this, "chkSyncEditorWithProjectManager", wxCheckBox)->GetValue());
 
         cfg->Write(_T("/tab_size"),                            XRCCTRL(*this, "spnTabSize",                           wxSpinCtrl)->GetValue());
         cfg->Write(_T("/view_whitespace"),                     XRCCTRL(*this, "cmbViewWS",                            wxChoice)->GetSelection());
Index: src/src/resources/editor_configuration.xrc
===================================================================
--- src/src/resources/editor_configuration.xrc  (revision 9363)
+++ src/src/resources/editor_configuration.xrc  (working copy)
@@ -357,6 +357,12 @@
                                                                        <object class="wxCheckBox" name="chkZoomAll">
                                                                            <label>Zooming resizes all editors</label>
                                                                        </object>
+                                                                       <flag>wxALIGN_LEFT|wxALIGN_TOP</flag>
+                                                                   </object>
+                                                                   <object class="sizeritem">
+                                                                       <object class="wxCheckBox" name="chkSyncEditorWithProjectManager">
+                                                                           <label>S&amp;ynchronise Editor with Project Manager</label>
+                                                                       </object>
                                                                        <flag>wxALL|wxALIGN_LEFT|wxALIGN_TOP</flag>
                                                                    </object>
                                                                </object>
davidallen 2013-10-11 18:50

See Feature request 005694 for details.

Let me know of any issues and I'll try and sort them out.

Thanks,

David

tpetrov 2013-10-14 19:36

At first glance: convert tabs to 4 spaces and upload new patch.

davidallen 2013-10-15 18:16

Sorry for the tabs.

I'd read about them in the development standards, and personally I also prefer spaces to tabs as well. I'll avoid them in future patches.

Many Thanks

David

tpetrov 2013-10-17 07:20

In svn with some modifications...