Author Topic: [feature request]Display a read-only icon next to filename in the tab  (Read 7307 times)

Offline teto

  • Almost regular
  • **
  • Posts: 127
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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11931
    • Travis build status
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #1 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.
(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 teto

  • Almost regular
  • **
  • Posts: 127
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #2 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).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11931
    • Travis build status
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #3 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...
(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 SteelRat

  • Multiple posting newcomer
  • *
  • Posts: 45
  • Stainless
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #4 on: August 27, 2014, 10:06:04 am »
Found by google pics:

Is this implemented on Mac OS only?
From documentation:
Code: [Select]
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
« Last Edit: August 27, 2014, 10:09:09 am by SteelRat »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #5 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).

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #6 on: August 27, 2014, 02:28:47 pm »
Great news ! Thanks for taking my proposition into consideration.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11931
    • Travis build status
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #7 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?
(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 jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #8 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/

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #9 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #10 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 ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re:
« Reply #11 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 202
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #12 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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #13 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: [feature request]Display a read-only icon next to filename in the tab
« Reply #14 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).