View unanswered posts | View active topics



Reply to topic  [ 3 posts ] 
Don't edit read only file 
Author Message
Member

Joined: Fri Sep 30, 2005 7:16 pm
Posts: 2
Reply with quote
Hi,

We use VSS for source control.
When a program is not Vss aware, it is at least important that read only files cannot be edited.
In that way, before we start modifying a file we know that we first have to check it out, and we are sure to work with the latest version before we modify it.

Can you add this, "don't edit read only file" feature to the fabulous FlashFDevelop project.

I found a way to turn around the fact that Project are not really there yet.
I have a different copy of flashdevelop (just a few mb anyway) for each of my project (in a subdir).
I then edit the settings to match the location of a specific project
ASCompletion.ClassPath
FileExplorer.FilePath

I also add an icon to the toolbar that refer to a compile.bat file specific for that project. Call mtasc with the right classpath and option, do some pre an post processing,...
in toolbar.xml
<button label="CompilePE" click="RunComplexProcess" image="26" tag="D:\download\flash\compiler\formPE\Flashbmi\compile.bat;;true" />

and all mtasc error goes to the right place, error pane.


Thanks a lot for your project

Cheers

Miggy


Fri Sep 30, 2005 7:29 pm
Profile
Member

Joined: Fri Sep 30, 2005 7:16 pm
Posts: 2
Reply with quote
Post 
Well it's friday evening so I had some time and try to make the feature myself.
here is what I came with.
When the file is not read only anymore it is automaticaly detected by the call back

Changes are in FlashDevelopp.MainForm around line 300


public void EditorModifyAttemptRO(ScintillaControl editor)
{
String file = (String) editor.Tag;
if (File.Exists(file) && (File.GetAttributes(file) & FileAttributes.ReadOnly ) != FileAttributes.ReadOnly)
{
editor.IsReadOnly = false ;
}
else
MessageBox.Show ("Document is read only");
}

/**
* Creates a new empty document
*/
public DockContent CreateNewDocument(string file, string text, int codepage)
{
try
{
if (File.Exists(file)) notifyOpen = true;
string title = Path.GetFileName(file);
ScintillaControl editor = this.CreateNewSciControl(file, text, codepage);

if ( File.Exists(file) && (File.GetAttributes(file) & FileAttributes.ReadOnly ) == FileAttributes.ReadOnly )
{
editor.IsReadOnly = true ;
editor.ModifyAttemptRO += new ModifyAttemptROHandler (EditorModifyAttemptRO) ;
}

TabbedDocument tabbedDocument = new TabbedDocument(this, editor);
tabbedDocument.Closing += new System.ComponentModel.CancelEventHandler(this.OnDocumentClosing);
tabbedDocument.TabPageContextMenu = this.tabMenu;
return tabbedDocument;
}
catch (Exception ex)
{
ErrorHandler.ShowError("Error while creating a new document.", ex);
return null;
}
}

If you find that interesting fell free to add it to the codebase

Thanks again for that great project

Miggy


Fri Sep 30, 2005 8:51 pm
Profile
Admin

Joined: Tue Aug 30, 2005 6:14 pm
Posts: 3055
Location: Finland
Reply with quote
Post 
I added an confirmation dialog if you are editing a read only file.


Sun Oct 02, 2005 6:36 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.