Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: teto on August 26, 2014, 03:00:47 pm

Title: [feature request]Display a read-only icon next to filename in the tab
Post by: teto on August 26, 2014, 03:00:47 pm
Hi,

I am not sure if it is "waf" (fork of Scons https://code.google.com/p/waf/wiki/FAQ) specific but it copies all headers from all files in a read-only directory. So often codeblocks will open such a file (on "Find declaration" for instance). So I have two identical headers open and often I find myself typing in a read only file.

This would be nice if in the tab of a read-only file, there were the same read-only icon as in te "Open files" window next to the filename.
This may look as a specific usecase (may also occurs when you work on libc or kernel sources, coeblocks open readonyl header instead of the one of the current project maybe ?) so I would understand if that would get turned down.

Cheers
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: oBFusCATed on August 26, 2014, 09:46:47 pm
It might be a usefull feature, but I'm not sure if it will be possible because of limitations in the api of wxaui notebook.
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: teto on August 27, 2014, 02:16:18 am
This does not need to be an icon, it could be a character (like the "*" prepended when a file has been modified) or the font (bold to show readonly).
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: oBFusCATed on August 27, 2014, 09:45:28 am
The API supports icons, so it will be an icon... will try to do it in the next couple of days...
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: SteelRat on August 27, 2014, 10:06:04 am
Found by google pics:
(http://trac.wxwidgets.org/raw-attachment/ticket/11950/Screen%20shot%202010-04-15%20at%204.45.28%20PM.png)
Is this implemented on Mac OS only?
From documentation:
Code
virtual bool wxAuiNotebook::SetPageImage(size_t n, int imageId)	
Sets the image index for the given page.

image is an index into the image list which was set with SetImageList().

>>> Since 2.9.3
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: Jenna on August 27, 2014, 11:17:59 am
As you can see in the "Logs and others" it's supported on all platforms (at least all we support with C::B).

@oBFusCATed:
I already started to work on it.
The problem is to find a point to implement it, where it works all the time (if changed from inside C::B and from outside C::B).
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: teto on August 27, 2014, 02:28:47 pm
Great news ! Thanks for taking my proposition into consideration.
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: oBFusCATed on August 27, 2014, 09:20:03 pm
The problem is to find a point to implement it, where it works all the time (if changed from inside C::B and from outside C::B).
I'm not so sure we need to make this as robust as you've described.
Can't you use the code for detecting if an opened file has changed to detect if the read-only attribute has been changed, too?
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: Jenna on August 28, 2014, 12:22:07 am
I attach two patches and a png-file for test.
Both need to be applied and the png has to be copied into src/src/resources/images/
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: MortenMacFly on August 29, 2014, 05:06:35 pm
I attach two patches and a png-file for test.
Within your patch: Probably you are missing that an editor case have an read-only state, too -> ed->IsReadOnly(). This should be pout into the computation of the readOnly var...
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: Jenna on August 29, 2014, 06:54:56 pm
I attach two patches and a png-file for test.
Within your patch: Probably you are missing that an editor case have an read-only state, too -> ed->IsReadOnly(). This should be pout into the computation of the readOnly var...
You are right.
Patch attached.

I think we should also add a(n empty) SetReadOnly-function to editorbase-class.
What do you think ?
Title: Re:
Post by: MortenMacFly on August 29, 2014, 08:19:34 pm
Yes, that's a good idea.I've already patched my version of c::B because handling read only visibility is broken in many ways...
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: danselmi on October 07, 2014, 10:05:13 pm
@jens: Any plans to apply in trunk? I'am using it since over a month without problems.
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: MortenMacFly on October 08, 2014, 08:27:14 am
@jens: Any plans to apply in trunk? I'am using it since over a month without problems.
I can confirm it works on Windows.
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: Jenna on October 12, 2014, 12:18:28 pm
I just committed ths and some other changes (mainly save pane-layout stuff) to sf (svn r9940 - 9949) in the hope it does not break anything.
Please test and report any issues (or fix them if you are a dev).

Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: teto on October 15, 2014, 12:01:07 pm
It works perfectly with the latest nightly and I can totally live with that. I just wanted to point out a possible improvement cf enclosed picture, there is one additionnal place where the read only icon could appear (ie, in the tab list).
 
Title: Re: [feature request]Display a read-only icon next to filename in the tab
Post by: oBFusCATed on October 16, 2014, 10:13:08 am
I doubt there is api for putting icons in there.