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

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5274
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #15 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
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 #16 on: August 15, 2009, 05:09:08 pm »
sleeping :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 Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: A feature request about CC and BrowseTracker
« Reply #17 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.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #18 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.
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: 5274
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #19 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();
}
« Last Edit: August 16, 2009, 07:05:20 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 ollydbg

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

  • Developer
  • Lives here!
  • *****
  • Posts: 5274
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #23 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
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 #24 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?
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 #25 on: August 22, 2009, 07:37:19 am »
ok,i have found that source codes.
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: 5274
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #26 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
« Last Edit: August 22, 2009, 01:28:50 pm 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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: A feature request about CC and BrowseTracker
« Reply #27 on: August 22, 2009, 08:25:40 am »
ok,i would like to do help if you have any plan
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: 5274
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: A feature request about CC and BrowseTracker
« Reply #28 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

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 mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 586
Re: A feature request about CC and BrowseTracker
« Reply #29 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.