Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: ollydbg on July 29, 2009, 02:06:37 pm

Title: A feature request about CC and BrowseTracker
Post by: ollydbg on July 29, 2009, 02:06:37 pm
Hi, all.

Did you notice this issue:

When I just right click on an variable, then select "Find deceleration of XXX", then after see its type, I would just "jump back" to the original position.

Currently, what we can do is using the browsTracker plugin, I can hold the left mouse button before the jump, then if I want a jump back, I can press ALT+ left arrow button, even if we jump aross two files, we had to press "ALT + up arrow".

This is really annoying. I suggest the browseTracker could automatically record the caret position, so it can easily go backward and forward. (Note, if you have used Visual Assist plug of Visual C++, you're familiar with this behavior)

I just want any comment and objection of this feature request.

Thanks.

Title: Re: A feature request about CC and BrowseTracker
Post by: Pecan on July 29, 2009, 03:49:41 pm
...
 even if we jump aross two files, we had to press "ALT + up arrow".

I don't understand what you're describing here. Could you give an example please.

This is really annoying. I suggest the browseTracker could automatically record the caret position, so it can easily go backward and forward. (Note, if you have used Visual Assist plug of Visual C++, you're familiar with this behavior)
...

I've never used visual Assist, so you'll have to describe the behavior and give an example.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on July 30, 2009, 03:29:26 am
@pecan

Ok, I find the function description here:

http://www.wholetomato.com/products/features/navigate.asp

Which means the "editing position" can automatically saved, so, people can navigate easily.

Quote
There is no way to control what Visual Assist X considers a location worth remembering. Generally speaking, Visual Assist X remembers files and lines visited. Small movements are ignored.

Edit:

People has request that feature. In

http://forums.codeblocks.org/index.php/topic,3082.msg24426.html#msg24426

http://forums.codeblocks.org/index.php/topic,5552.msg42953.html#msg42953

http://forums.codeblocks.org/index.php/topic,8057.0.html

paragraph 3 of this post:
http://forums.codeblocks.org/index.php/topic,3297.msg26000.html#msg26000

http://forums.codeblocks.org/index.php/topic,6093.msg72038.html#msg72038

Title: Re: A feature request about CC and BrowseTracker
Post by: Pecan on July 30, 2009, 02:30:59 pm
On Alt-LeftArrow, BrowseTracker already jumps back to the editor cursor position the user had before activating another editor.

How do you see that as different from the "wholeTomato" descripton in your previous post?

On what user behavior or CB actions would you suggest BrowseTracker set a BrowseMark?

I am still not clear on how these requests are different from what BrowseTracker is now doing.

Maybe the best is for you to give and example, including the steps you would like to see BrowseTracker to follow.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on July 30, 2009, 03:12:20 pm
Ok, I will give a simple example.

For example you have a.cpp and b.cpp opened.

1, Now, you were editing in a.cpp, line 100.
2, you have jump( either jump from context menu->find implementation or you manually scroll down in the editor) to edit another position in a.cpp line 200.
3, After that, you would like to edit another position in b.cpp line 50, so, you were at b.cpp line 50.

Note: in visual assist, all the edit position will be recorded sequentially. So, it automatically keep a position stack like this:

......
a.cpp line 100
a.cpp line 200
b.cpp line 50

So, you can use "ALT + left arrow " to go backward, or "ALT + right arrow" to go forward.


In the current BrowseTracker, only the position you hold the left button mouse for 300ms will be recorded, so, My suggestion is: All the edit position should be automatically recorded.

I hope you can understand this feature request. In fact, this feature not only exists in programming IDEs, you can see this feature in Firefox or any web browser. ( forward and back navigate between a web history). Also, if you have Acrobat reader, they also has same functionality when navigate in a PDF.

Thanks.




Title: Re: A feature request about CC and BrowseTracker
Post by: mariocup on July 30, 2009, 09:46:48 pm
Hi Pecan,

in some projects I have to use eclipse and found some interesting feature that could be integrated perhaps quite easy with existing features.

If you set bookmarks that can be label as favourites and you can use this favourite list to navigate between bookmarks. The same feature would make sense for Browsemarks.

In the filemanager plugin there is already a favourite manager for directories that provides such a functionality.

What do you think about it.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 15, 2009, 02:12:12 pm
Today, I have checkout the source code of "codelite" from sourceforge to see it's navigate back / navigate forward function.

All the related code was in:

pluggin_sdk/BrowsingRecords.

I have found that it try to add every position after a jump. some piece of code like:

Code: [Select]
void ContextCpp::OnGotoFunctionStart(wxCommandEvent& event)
{
int line_number = GetCtrl().LineFromPosition(GetCtrl().GetCurrentPos());
TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(GetCtrl().GetFileName(), line_number);
if (tag) {
// move the caret to the function start
BrowseRecord jumpfrom = GetCtrl().CreateBrowseRecord();
GetCtrl().SetCaretAt(GetCtrl().PositionFromLine(tag->GetLine()-1));
// add an entry to the navigation manager
NavMgr::Get()->AddJump(jumpfrom, GetCtrl().CreateBrowseRecord());
}
}

In fact, the navigate manager in codelite still can't automatically record the editing position. Here comes my question:

I would like to fine a Message or Notification in wxscinllata which will send when a caret position was changed. Any body know such message? Because that the trigger I can do the record.

If we can't find any message for the situation I stated, I think a wxTimer is need, eg, it can qurey a caret position every one seconds, and check is is different than the previous one, so, a new position can be recorded if necessary.

Any comments?
Thanks.
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 03:03:15 pm
@ollydbg
I found that the highlightbrace was done in these codes in cbeditor.cpp.
so I think we can do something here.
Code: [Select]
void cbEditor::OnEditorUpdateUI(wxScintillaEvent& event)
{
    if (Manager::Get()->GetEditorManager()->GetActiveEditor() == this)
    {
        NotifyPlugins(cbEVT_EDITOR_UPDATE_UI);
        HighlightBraces(); // brace highlighting
        m_pData->HighlightOccurrences();
    }
    OnScintillaEvent(event);
}
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 15, 2009, 03:09:22 pm
@ollydbg
I found that the highlightbrace was done in these codes in cbeditor.cpp.
so I think we can do something here.
Code: [Select]
void cbEditor::OnEditorUpdateUI(wxScintillaEvent& event)
{
    if (Manager::Get()->GetEditorManager()->GetActiveEditor() == this)
    {
        NotifyPlugins(cbEVT_EDITOR_UPDATE_UI);
        HighlightBraces(); // brace highlighting
        m_pData->HighlightOccurrences();
    }
    OnScintillaEvent(event);
}

Thanks!!
Did you mean that we can handle "cbEVT_EDITOR_UPDATE_UI"
in the BrowseTracker plugin?
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 03:19:19 pm
I am not sure.but we can have a try,afterall ,highbrace is handled by this message.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 15, 2009, 03:22:54 pm
I am not sure.but we can have a try,afterall ,highbrace is handled by this message.
I don't agree with you.
After reading the sdk_event.h about all the event, I know that the "cbEVT_EDITOR_UPDATE_UI" is an event haven't used by any plugin and contributed plugin. Also, I think this event happened to quickly when every.
Am I right? :D
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 03:38:10 pm
I see these codes NotifyPlugins(cbEVT_EDITOR_UPDATE_UI);,
so I think the plugin maybe get the message.
maybe there is a better way to do this. :D
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 03:44:45 pm
@ollydbg
a idea come out.
maybe can hook the left mouse click message.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 15, 2009, 04:08:12 pm
I'm carefully reading the scintilla document. For Editor_update message, here is the description:

Quote
SCN_UPDATEUI
Either the text or styling of the document has changed or the selection range has changed. Now would be a good time to update any container UI elements that depend on document or view state. This was previously called SCN_CHECKBRACE because a common use is to check whether the caret is next to a brace and set highlights on this brace and its corresponding matching brace. This also replaces SCN_POSCHANGED, which is now deprecated.

Not quite understand its meaning.

@ollydbg
a idea come out.
maybe can hook the left mouse click message.

Mouse click message is hard to hook, if someone just jump to a position, and haven't use mouse click( eg: he can use keybord arrow key to navigate, the position will be lost...)

I personally prefer a wxTimer event in browserTracker plugin, but it seems hard to implement for me.
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 05:00:27 pm
refer to wxTimer implemention in codecompletion.cpp.
but if we use wxTimer ,and set time interval to 1 second,
if user move the caret position several times in a second.
caret position will missed too.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 15, 2009, 05:06:33 pm
if user move the caret position several times in a second.
Thanks for the hint.
I think a normal user can't do that, otherwise we should ignore these positions. :D
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 15, 2009, 05:09:08 pm
sleeping :D
Title: Re: A feature request about CC and BrowseTracker
Post by: Ceniza on August 15, 2009, 09:55:24 pm
I'm carefully reading the scintilla document. For Editor_update message, here is the description:

Quote
SCN_UPDATEUI
Either the text or styling of the document has changed or the selection range has changed. Now would be a good time to update any container UI elements that depend on document or view state. This was previously called SCN_CHECKBRACE because a common use is to check whether the caret is next to a brace and set highlights on this brace and its corresponding matching brace. This also replaces SCN_POSCHANGED, which is now deprecated.

Not quite understand its meaning.

That looks to me like what you are looking for, and it seems to be sent to all plugins listening for that event. What should be considered is that if the user is in one line and he/she presses and keeps pressed left up to the beginning of the document (for example), only two positions should be seen (the initial line and the beginning of the document). Recording all positions in between would not make sense.

I haven't played much with those things, so you better set up a little test for them. Use a logger to output what you are getting and see if that's what you want.
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 16, 2009, 03:17:52 am
Ceniza's comment is right.
it is no sense to record carect position between start and end.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 16, 2009, 06:59:52 am
@blueshake and Ceniza
I think your are right. I just find this message is really useful. In this scillita mail list. There is a usage of this message.

http://aspn.activestate.com/ASPN/Mail/Message/scintilla-interest/1446313

Quote
Pavel Baranov:

>  A common windows practice it to show the caret line and sometimes column
>  positions in the gui status bar window.

   SciTE does this. When you want to find out how to implement a feature
SciTE is a very good source. SciTE uses SCN_UPDATEUI.

   The contributor of SCN_POSCHANGED was performing a large amount of
background processing that depended on the editor context. The intent of
SCN_POSCHANGED was to notify the container when that context changed so that
the background tasks could be aborted. This context was never well specified
and the notification never really meant that the caret position changed.

   I have removed SCN_POSCHANGED from the main documentation and added it to
the deprecated section.

   Neil



Edit
Also, In the Codeblocks's SDK, it is used to update the status bar. see the code below:
src\main.cpp line 1667

Code: [Select]
void MainFrame::OnEditorUpdateUI(CodeBlocksEvent& event)
{
    if(Manager::isappShuttingDown())
    {
        event.Skip();
        return;
    }
    if (Manager::Get()->GetEditorManager() && event.GetEditor() == Manager::Get()->GetEditorManager()->GetActiveEditor())
    {
        DoUpdateStatusBar();
    }
    event.Skip();
}
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 22, 2009, 04:34:58 am
I'm currently considering a good data structure to hold the browse position. It is similar to a "undo" and "redo" data structure.

In codelite source code, I found it use a "std::vector<BrowseRecord> m_jumps" array to keep the positions.

They were implemented in these files:

https://codelite.svn.sourceforge.net/svnroot/codelite/trunk/Plugin/navigationmanager.cpp

https://codelite.svn.sourceforge.net/svnroot/codelite/trunk/Plugin/navigationmanager.h

https://codelite.svn.sourceforge.net/svnroot/codelite/trunk/Plugin/browse_record.h

Any one has a comments on this method? Thanks.
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 22, 2009, 06:24:35 am
i get a quick review on these codes.it is good .
and would you try to implement this function in a new plugin
or modify an old one ?
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 22, 2009, 06:36:52 am
At this time, I have no idea.
One option is I change the browsetracker source code.
The other option is I would create another plugin.

The later options seems a little simpler. What I would to do is

1, handle the SCN_UPDATEUI message in the plugin, and record browse position.
2, handle two key "alt + left arrow" and "alt + right arrow" to navigate backward and forward.

Also, there are some guide lines:
1, once a new project is opened, the std::vector<browserecord> should be cleared.
2, Additional toolbar could be add to implement the backward and forward
3, we can use a DebugLog output to test whether the new plugin add or remove browseRecord correctly.
....

It seems a lot of work to do, nowadays, I'm still busy on my work, so. :?
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 22, 2009, 07:06:00 am
Also, mmkider's TrackBar plugin is a strong reference. It has only one cpp and one header files.

http://forums.codeblocks.org/index.php/topic,9886.msg68973.html#msg68973
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 22, 2009, 07:29:26 am
i think it would be esay to modify browsetracker plugin.
according to guild line,2 has been done by this plugin. and
3 is also done too.
so we just need to hook the plugin ,and do some work here ,i
think it would be easy, and according to address you post ,i
can not found that source codes.can you pass me one?
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 22, 2009, 07:37:19 am
ok,i have found that source codes.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 22, 2009, 07:54:43 am
i think it would be esay to modify browsetracker plugin.
according to guild line,2 has been done by this plugin. and
3 is also done too.
so we just need to hook the plugin ,and do some work here ,i
think it would be easy, and according to address you post ,i
can not found that source codes.can you pass me one?
If you review the source in browsetracker, you will find it is really complecated.
I'd personally prefer start from a simple plugin ,such as TackerBar.( the source code can be download from here:

http://forums.codeblocks.org/index.php/topic,9886.msg73842.html#msg73842
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 22, 2009, 08:25:40 am
ok,i would like to do help if you have any plan
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 25, 2009, 11:16:37 am
HI all:

After the help from blueshake, I think we can implement this feature by modifying the source from mmkider's TrackBar plugin.

I will publish the source and give a description later following this thread. :D

Title: Re: A feature request about CC and BrowseTracker
Post by: mariocup on August 25, 2009, 12:37:58 pm
Hi, all.

Did you notice this issue:

When I just right click on an variable, then select "Find deceleration of XXX", then after see its type, I would just "jump back" to the original position.

Currently, what we can do is using the browsTracker plugin, I can hold the left mouse button before the jump, then if I want a jump back, I can press ALT+ left arrow button, even if we jump aross two files, we had to press "ALT + up arrow".

This is really annoying. I suggest the browseTracker could automatically record the caret position, so it can easily go backward and forward. (Note, if you have used Visual Assist plug of Visual C++, you're familiar with this behavior)

I just want any comment and objection of this feature request.

Thanks.

I want to share some ideas that came to my mind. I agree that a navigation like forward and backward is very useful, but I think a typical scenario is not covered with it.

You start a workflow like open declaration of function foo, then here you open another declaration of functions bar etc. Now after different steps you want to go to foo, since it is perhaps a very important function.

So what I am think about is some kind of labeled Bookmarks which can be managed and sorted in a favorite list. Imagine you are in the editor at function foo and open a context menu add Bookmark Label. Now this label appears a favourite list, e.g. a dockable windows in the message console. With this mechanism frequently used functions or relevant source code line could be accessed very easily.

Perhaps also a sort criterion like (sort by access frequency from favourite list) could be nice. What are you thinking about?

In the Filemanager Plugin there is already a favourite manager for directories and I find it very convenient.
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 25, 2009, 01:11:59 pm
I want to share some ideas that came to my mind. I agree that a navigation like forward and backward is very useful, but I think a typical scenario is not covered with it.

You start a workflow like open declaration of function foo, then here you open another declaration of functions bar etc. Now after different steps you want to go to foo, since it is perhaps a very important function.

So what I am think about is some kind of labeled Bookmarks which can be managed and sorted in a favorite list. Imagine you are in the editor at function foo and open a context menu add Bookmark Label. Now this label appears a favourite list, e.g. a dockable windows in the message console. With this mechanism frequently used functions or relevant source code line could be accessed very easily.

Perhaps also a sort criterion like (sort by access frequency from favourite list) could be nice. What are you thinking about?

In the Filemanager Plugin there is already a favourite manager for directories and I find it very convenient.


Hi, firstly, thanks for the comment!
My question is: Where can I find the "Filemanager plugin"? I opened the Menu->plugins->manage plugins dialog, but I can't find such plugin.

Also, I think I have really finished a draft version of the "Navigate backward/forward" plugin. This is mainly based on the Trackbar plugin.

Here is the steps to use this plugin:

1, copy the source code to the directory "cb_source_root\src\plugins\contrib"
2. open the "TrackBar.cbp" and build it.
3, run update.bat.
4, then run cb from: "cb_source_root\src\output"

Note: since the short-cut for "Navigate back/forward" is "alt+left" and "alt + right", which may conflict the BrowseTracker plugin( This is another great plugin), so, you can change the short-cut key in :

Settings->Editor->keyboard shortcut, see like below(for me, I just delete the two short cut  :D)

(http://i683.photobucket.com/albums/vv194/ollydbg_cb/ChangeShortForBrowseTracker.png)

Here is the source code. Download and have fun. Note: I just add a event handler to the cbEVT_EDITOR_UPDATE_UI message in the code, the code is quite simple and self-explanation. Any comments are welcome!







[attachment deleted by admin]
Title: Re: A feature request about CC and BrowseTracker
Post by: mariocup on August 25, 2009, 01:28:23 pm
Hi ollydbg,

you can download the filemanager from http://developer.berlios.de/projects/cbilplugin/.

The documentation can be found here: http://www.codeblocks.org/docs/main_codeblocks_en.html
Title: Re: A feature request about CC and BrowseTracker
Post by: ollydbg on August 25, 2009, 02:22:28 pm
Hi ollydbg,

you can download the filemanager from http://developer.berlios.de/projects/cbilplugin/.

The documentation can be found here: http://www.codeblocks.org/docs/main_codeblocks_en.html
Ok, I will try and do a test!

By the way, the codeblocks documents is pretty good! My suggestion is: I think one big webpage to hold the manual is not convenient( It takes a long time to load the whole page in my web browser), I think you can divide them into several web pages.
Title: Re: A feature request about CC and BrowseTracker
Post by: mariocup on August 25, 2009, 02:28:26 pm
Hi ollydbg,

this is only a generation option. You are right the loading of the screenshots takes some time. I will try to split the content in subsites.
Title: Re: A feature request about CC and BrowseTracker
Post by: blueshake on August 25, 2009, 03:20:40 pm
hi,mariocup
according to your address.i just found FileManager.cbplugin for download.
and it is out of date(version conflict),so where can i download the sourcecode.
thanks.
Title: Re: A feature request about CC and BrowseTracker
Post by: jens on August 25, 2009, 03:31:03 pm
Checkout (with svn) http://svn.berlios.de/svnroot/repos/cbilplugin/branches/FileManager for filemanager and http://svn.berlios.de/svnroot/repos/cbilplugin/branches/PowerShell for powershell.