Author Topic: A feature request about CC and BrowseTracker  (Read 27777 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
A feature request about CC and BrowseTracker
« 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.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: A feature request about CC and BrowseTracker
« Reply #1 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.
« Last Edit: July 29, 2009, 03:51:18 pm by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #2 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

« Last Edit: July 30, 2009, 03:59:00 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: A feature request about CC and BrowseTracker
« Reply #3 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.
« Last Edit: July 30, 2009, 02:35:14 pm by Pecan »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #4 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.




If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

mariocup

  • Guest
Re: A feature request about CC and BrowseTracker
« Reply #5 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #6 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
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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #7 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
void cbEditor::OnEditorUpdateUI(wxScintillaEvent& event)
{
    if (Manager::Get()->GetEditorManager()->GetActiveEditor() == this)
    {
        NotifyPlugins(cbEVT_EDITOR_UPDATE_UI);
        HighlightBraces(); // brace highlighting
        m_pData->HighlightOccurrences();
    }
    OnScintillaEvent(event);
}
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #8 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
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?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #9 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.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #10 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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #11 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
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #12 on: August 15, 2009, 03:44:45 pm »
@ollydbg
a idea come out.
maybe can hook the left mouse click message.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #13 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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #14 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.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?