Author Topic: Autosave enhancement  (Read 30580 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Autosave enhancement
« Reply #15 on: November 17, 2013, 11:37:48 am »
That said, I personally don't deem project saving something that is really urgent for autosave at all. Changes are not that frequent and not that large.
I'm on the opposite opinion here :)
For me autosave is more usefull for saving projects and workspaces then source files.
I think so because there is no visual indicator in C::B to show/warn they are modified and so it is impossible to know if you've saved them or not.
So a crash might mean that you've lost some set up work you have to redo, which is annoying.
(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 Bat

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Autosave enhancement
« Reply #16 on: November 17, 2013, 12:43:46 pm »
Quote
I think so because there is no visual indicator in C::B to show/warn they are modified and so it is impossible to know if you've saved them or not.
So a crash might mean that you've lost some set up work you have to redo, which is annoying.

I'm agree with :
-no "visual indicator" aspect for project & workspace
-work is regularly saved each time we "build" (here no need)
-it will not get back modified file at last second before crash but one or 2 mintue ago (as plugin configuration)

Quote
I saw was a bool variable called "lock" which was set and verified at various places, presumably protecting the process of saving/loading project files and such.

Ok, see it.
It's usage is a "workaround only" for callback of Worskpace opening that is catched by
Code
cbEVT_WORKSPACE_LOADING_COMPLETE
In my mind, this event is aimed at end of Workspace loading and not during Workspace opening so "IsLoadingWorkspace" is false at this time and in plugin, I need to know when opening a file or a project if this is during Workspace loading, Project loading or file loading.
During Workspace loading, there is a summary of all not saved project - with selection possibility. Not a message by project basis.

=>Good option is perharps to create a
Code
cbEVT_WORKSPACE_OPEN
as, after that, I must also create
Code
cbEVT_WORKSPACE_CLOSED
where there is no entry point at all. With this, I can remove all this lock stuff

Are timer totally asynchronous of Manager (other threads) ? (I haven't check) ? Here there is potential problem even with actual autosave, as it's possible to close a project during autosave (and destroy project pointer). And even more with my patch.

Quote
You're adding code and APIs in cbEditor which are only usable by this feature of the autosave plugin.

I'm sorry, I but I have other question ...
Even if only autosave use it, any other plugin can also use it, if they need, no ? (I'm agree that I'm not sure to find another plugin that need to alter file at load time)
cbEditor don't need at all autosave plugin to work, flag is set to false by default and other parameters are all optional

To understand better, if I take another example :
Code
void SetErrorLine(int line);
is code in cbEditor that is only useful to compiler plugin
Code
void SetDebugLine(int line);
only useful to debugger plugin

At side from this, what is the (best) solution ?

My need :
get back a cbEditor at same state (modified flag is important) than during last autosave. This procedure is trigged during workspace loading, project loading or editor loading

First problem : load from a file and save to another (without actually do the save)
-I can externally from cbEditor load a file. But I will have the .save in m_Filename, so bad when user save editor
-I (perharps) can externally duplicate load process. It's ugly and will fail at first cbEditor modification

Second problem :
When my file is loaded, I set "modified" flag to true via SetModified(). I'm on cbEVT_EDITOR_OPEN event and there is plugin called before autosave (don't hurt), and after autosave. 2 or 3 of theses plugins after reset "modified" flag to false. So I can't assure that modified flag will really be set to true.
Here :
-should "modification" be made on all theses plugins ?
-should I create another event cbEVT_EDITOR_AFTER_OPEN ?
-other