Author Topic: MiniDoc  (Read 82019 times)

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
MiniDoc
« on: August 07, 2014, 12:56:07 am »
Hi

Find attached the surces for the MiniDoc plugin. It provides a small view of the document.
See here how  it looks like:


As always, any feedback is welcome.

Todo's:
- position of grey rectangle is wrong with folded code in the editor.
- ?

regards danselmi
« Last Edit: August 07, 2014, 10:41:29 am by danselmi »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: MiniDoc
« Reply #1 on: August 07, 2014, 01:12:55 am »
Hm, interesting...
I have a similar task in the todo, but I'm not sure when I'll have time to try it...
Have you considered attaching this miniview to every editor's tab?
(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 danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
Re: MiniDoc
« Reply #2 on: August 07, 2014, 10:40:46 am »

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: MiniDoc
« Reply #3 on: August 07, 2014, 01:50:59 pm »
post removed (shame)
« Last Edit: August 07, 2014, 09:04:32 pm by frithjofh »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: MiniDoc
« Reply #4 on: August 07, 2014, 08:19:24 pm »
SublimeText, Notepad++, VisualStudio all provide this feature...
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re:
« Reply #5 on: August 08, 2014, 05:25:21 am »
Really nice one. In fact I started the same some time back but never finished it. GREAT! That was a feature I missed hardly from notepad++. This should be merged with svn in the future... Do you have plans to do so? What is missing/what feedback do you need?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: MiniDoc
« Reply #6 on: August 08, 2014, 07:39:06 am »
...I've "ported" this to wx30 and wx30 64 bit on Windows.. If you transfer the sources to contrib plugins in the SVN tree I can merge them...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: MiniDoc
« Reply #7 on: August 08, 2014, 09:41:12 am »
Morten you can always fork his repo and then make pull request. :)
(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 danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
Re: MiniDoc
« Reply #8 on: August 08, 2014, 11:16:17 am »
Really nice one. In fact I started the same some time back but never finished it. GREAT! That was a feature I missed hardly from notepad++. This should be merged with svn in the future... Do you have plans to do so? What is missing/what feedback do you need?
Feedback I need/wish:
  • is it stable? (I am not sure about that, possibly it makes infinite loops. But I can not reproduce it.)
  • Should the MiniDoc sync to the main Doc so it automatically scrolls so that the grey rectangle is visible?
  • On a click in the minidoc it makes the clicked line the first line in the main doc. Should it be become the line in the center?
  • When to set the focus to the MiniDoc, to be able to scroll in the MiniDoc (without changing position of the main Doc). Right click?
  • What should be configured? (Any volunteers?)
  • The constants for the Indicators (highlight occurences and incremental search) in MiniStyledTextCtrl::MiniStyledTextCtrl() are bad to maintain.
     (copy from Occurences highlighter and incremental search plugins). By the way is there a need for a central instance where a plugin can register for an Indicator?
  • Given by the decision to use a cbStyledTextCtrl to show the miniature, it is not possible to disply long documents without a scrollbar. Bad?

If we have some feedback about stability we can integrate it into the repo.

regards danselmi

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: MiniDoc
« Reply #9 on: August 09, 2014, 10:07:44 am »
  • is it stable? (I am not sure about that, possibly it makes infinite loops. But I can not reproduce it.)
Well I am using it from no on - so far no problem on Windows. I'll tell if I see something different.

  • Should the MiniDoc sync to the main Doc so it automatically scrolls so that the grey rectangle is visible?
I didn't miss this feature so far but if you say so - it might be nice. However, This sounds to me likt it should be an option.

  • On a click in the minidoc it makes the clicked line the first line in the main doc. Should it be become the line in the center?
Again: I am happy with as it is so I don't see an urgent need for this, but if - an option. :-)

  • When to set the focus to the MiniDoc, to be able to scroll in the MiniDoc (without changing position of the main Doc). Right click?
Right clieck sounds obvious. Alternatively with mouse wheel if MiniDoc is under the mouse cursor (similar like we do it with editor tabs).

  • What should be configured? (Any volunteers?)
* Size of the font in the minidoc
* any specific behaviour option
* Colours (I think you are already using colormanager, right?)

I can try if you like, but currently my time is really limited due to work an family (we have moved...). However, please move it to SVN before. I don't really want to use an external GIT and we keep the history in SVN. We have enough unsynchronised bits and pieces all around different GIT places already and I am afraid having so many forks will lead to trouble sooner or later. We could NOT add it to the full build system (workspace, automake...) for now and do it if its ready, if you like or use a branch (which would be a little overdone for an independent plugin though...).

  • The constants for the Indicators (highlight occurences and incremental search) in MiniStyledTextCtrl::MiniStyledTextCtrl() are bad to maintain.
     (copy from Occurences highlighter and incremental search plugins). By the way is there a need for a central instance where a plugin can register for an Indicator?
I've seen this, its not nice. You proposal would be a solution but required implementation and rewrite of the other plugins as well.

  • Given by the decision to use a cbStyledTextCtrl to show the miniature, it is not possible to disply long documents without a scrollbar. Bad?
I don't think so. If the font size is an option you can minimize it. But at some point for VERY long documents it does not make sense to minimise it even further. So an option to select the minimal font size and therefore zoom level is good, but no more. (These are my feelings.)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: MiniDoc
« Reply #10 on: August 10, 2014, 01:12:40 pm »
Bug: Showing the panel resets the background of my greyish syntax highlight theme in the editor.

Suggestions:
1. remove the scroll, because it just wastes space
2. mark the currently visible part of the document/file by greying out the non-visible part -> currently you're doing the inverse and so highlighting staff in the editor is hard to see.
3. use even smaller font for larger files
4. it would be good if the space between the lines could be made smaller, so more text could be made visible.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re:
« Reply #11 on: August 10, 2014, 01:17:06 pm »
Btw: Your code also reveals another weakness in the sdk: The menus shouldn't been accessed by name... This will break as soon as we change a menus name. I've seen similar in several other plugins. There should better be an sdk method providing plugins with access to the top level menus at least...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: MiniDoc
« Reply #12 on: August 10, 2014, 06:33:15 pm »
Two issues (on linux):
if I scroll in the main-window the grey rectangle in the MiniDoc-view is moved also, but if it leaves the visible area the miniDoc should auto-scroll, so the grey rectangle is always visible.

If I resize the mainview, the grey rectangle is not resized (until I click into the mainview).

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
Re: MiniDoc
« Reply #13 on: August 12, 2014, 07:25:47 pm »
I already addressed some issues.

What remains is:
Bug: Showing the panel resets the background of my greyish syntax highlight theme in the editor.
Can you explain how to reproduce?

... If I resize the mainview, the grey rectangle is not resized (until I click into the mainview).
How do I get the plugin informed about the resize?

...
3. use even smaller font for larger files
4. it would be good if the space between the lines could be made smaller, so more text could be made visible.
For both suggestions; I don't know how to achieve them.

regards danselmi

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: MiniDoc
« Reply #14 on: August 12, 2014, 08:09:02 pm »
... If I resize the mainview, the grey rectangle is not resized (until I click into the mainview).
How do I get the plugin informed about the resize?

You can use:
Code
event.GetEditor()->Connect(wxEVT_SIZE,wxSizeEventHandler(MiniDoc::OnResize));
in the EditorActivated eventhandler and
Code
event.GetEditor()->Disconnect(wxEVT_SIZE,wxSizeEventHandler(MiniDoc::OnResize));
in the deactivate handler.
The problem is, that it does not works for splitted editors, but in this case there is more broken (at least here): the actual highlighted lines (grey rectangle) get a white circle in the editors margin of the second control.