Author Topic: Per project opened files  (Read 8316 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Per project opened files
« on: December 22, 2013, 02:03:50 pm »
Hello,

Is there a way I don't know to have different files opened according to the active project in a workspace ?

For example, say I have a workspace with two projects called App1 and App2. I would like to have app1.cpp opened when App1 is active and app2.cpp + app2.h when App2 is active.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Per project opened files
« Reply #1 on: December 22, 2013, 02:50:01 pm »
Once I was in need of the same thing but with different targets instead of projects but it wasn't possible at the time and needed implementation.

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Feature request : Per project and target opened files
« Reply #2 on: December 22, 2013, 03:13:07 pm »
Ouch ! So, it sounds like we (knowing I'm not a C::B dev too) have a feature request here.

Please, killer C::B Team, could you implement such a thing : keep reference of opened files per project and target through two checkboxes in general settings ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Per project opened files
« Reply #3 on: December 22, 2013, 03:54:52 pm »
That would be nice and very useful really.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11820
    • Travis build status
Re: Per project opened files
« Reply #4 on: December 22, 2013, 04:52:45 pm »
Unfortunately this is not possible and someone should implement it. The easiest way would be to make a plugin.
It would have been good if it would be possible to implement this feature with a script, but unfortunately there is no way to connect functions to events in squirrel.
At least there is no info in the documentation in the wiki about events.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Per project opened files
« Reply #5 on: December 22, 2013, 08:35:52 pm »
Cannot the names of active files be saved in some list (maybe the project file?) and then reloaded back when the target/project is switched?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11820
    • Travis build status
Re: Per project opened files
« Reply #6 on: December 22, 2013, 08:57:24 pm »
It is doable, but someone has to do it :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Regular
  • ***
  • Posts: 389
Re: Per project opened files
« Reply #7 on: December 23, 2013, 11:02:24 am »
In general this is a good idea, but if implemented it MUST be optional. I often read files from other projects when programming.

The main problem I have detected is that the number of opened files tends to increase rapidly as you work in Code::Blocks, and at some point you simply have to close all and start over. Perhaps it would be useful with a feature like "Close files from non-active projects". Likewise, one might consider a "close *.cpp files" or "close *.h files", or even "close abc*.cpp" etc. I think you get the idea: A plugin could be created that allowed easy closing of open workspace files based on user-defined rules. The rules could be defined more or less in a similar manner as when you create mail filters in Thunderbird. Call the plugin "TidyWorkspace" or something like that.

The idea is hereby donated  ;D

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: Per project opened files
« Reply #8 on: December 23, 2013, 11:09:35 am »
It is doable, but someone has to do it :)

Nice ! So, could you please add it in the TODO list, Obfuscated ? ::)

And awaiting this (nothing urgent), could you tell us where this list is saved (registry, project file, workspace, appdata) ; then, we could manage a  temporary fix outside of the C::B logic...

@cacb : your idea is quite advanced, but maybe a second stage (since as Obfuscated said : "someone has to do it"), an extended one after a first "basic" plugin to just manage files sets binded with project and target.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11820
    • Travis build status
Re: Per project opened files
« Reply #9 on: December 23, 2013, 11:20:43 am »
Nice ! So, could you please add it in the TODO list, Obfuscated ? ::)
No, because the TODO list is my personal TODO list and contains things that I need or want to implement. This feature is not one of them, because I don't see a use case for it in my daily use of C::B.
But you can always add a feature request at the project page on berlios.de.

Quote
And awaiting this (nothing urgent), could you tell us where this list is saved (registry, project file, workspace, appdata) ; then, we could manage a  temporary fix outside of the C::B logic...
Are you asking about the open file list?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: Per project opened files
« Reply #10 on: December 23, 2013, 12:55:42 pm »
OK, it's submitted to the tracking system at http://developer.berlios.de/feature/index.php?func=detailfeature&feature_id=5716&group_id=5358

Yes, I talk about the location where the open files list is saved.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Per project opened files
« Reply #11 on: December 23, 2013, 01:05:30 pm »
OK, it's submitted to the tracking system at http://developer.berlios.de/feature/index.php?func=detailfeature&feature_id=5716&group_id=5358

Yes, I talk about the location where the open files list is saved.
It's the *.layout-file belonging to the project.

By the way, you should take into account, that opening and closing a large amount of files might take a long time.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Per project opened files
« Reply #12 on: December 23, 2013, 04:11:16 pm »
When I first felt the need for such a feature was when I was working on a project with multiple hardware nodes with each having a separate mcu of their own. So I created different targets for each and consequently there were different 'main.c's dedicated to each and when I switched a target, I also had to locate the correct 'main.c' to edit apart from other files and it was quite error prone. So cb is a multiple target and/or multiple project ide and what's the intended way to cope with this problem (of maybe just mine)? Is there a better way to distinguish between the different files of different projects that I'm missing?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Per project opened files
« Reply #13 on: December 23, 2013, 04:50:24 pm »
The most trvial thing to implement, as a plugin, would be a right click option in the project manager to close files that don't belong to the project.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6546
    • My Best Post
Re: Per project opened files
« Reply #14 on: December 23, 2013, 04:52:52 pm »
When I first felt the need for such a feature was when I was working on a project with multiple hardware nodes with each having a separate mcu of their own. So I created different targets for each and consequently there were different 'main.c's dedicated to each and when I switched a target, I also had to locate the correct 'main.c' to edit apart from other files and it was quite error prone. So cb is a multiple target and/or multiple project ide and what's the intended way to cope with this problem (of maybe just mine)? Is there a better way to distinguish between the different files of different projects that I'm missing?


Might try virtual folders the same name as the targets to help.

Tim S.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org