Author Topic: Move Occurrence highlighting from core into a plugin  (Read 21689 times)

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
Move Occurrence highlighting from core into a plugin
« on: July 29, 2013, 11:22:39 pm »
Hi

As mentioned here:
http://forums.codeblocks.org/index.php/topic,18070.msg123704.html#msg123704
I moved the code of the occurrence highlighting from sdk and the mentioned plugin into a core-plugin. Patch is attached.

Does anybody have some time to
  • prepare the auto foo magic
  • review
  • provide an image (on and off) for the config dialog

Regards,


daniel




[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Move Occurrence highlighting from core into a plugin
« Reply #1 on: July 30, 2013, 01:07:13 am »
I can do the automake-stuff (in fact I just started doing it).
I will also have a quick look into the sources/headers.
I will see if I can make iamges also. Most likely made of a screenshot, similar to IncSearch.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Move Occurrence highlighting from core into a plugin
« Reply #2 on: July 30, 2013, 01:53:54 am »
Here comes a first addition to your patch.
It has to be applied after yours.

I can put it in one patch, but it will be more difficult to see the changes I made.

I did not (yet) update the wx2.9 project-files.

Hopefully tomorrow.
Now I go to bed.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Move Occurrence highlighting from core into a plugin
« Reply #3 on: July 30, 2013, 04:01:14 am »
Good work, I did not test the patch, just quick read the patch file:

Code
Index: src/plugins/occurrenceshighlighting/highlighter.cpp
===================================================================
--- src/plugins/occurrenceshighlighting/highlighter.cpp (revision 0)
+++ src/plugins/occurrenceshighlighting/highlighter.cpp (working copy)
@@ -0,0 +1,356 @@
+#include "Highlighter.h"
+
+#include <sdk.h> // Code::Blocks SDK
+//#include <editorcolourset.h>
+#include <cbstyledtextctrl.h>
+#include <cbcolourmanager.h>
Is it better to put sdk.h as the first include files?

Code
+#ifndef Highlighter_h
+#define Highlighter_h
and
Code
+#ifndef OCCURRENCESHIGHLIGHTING_H_INCLUDED
+#define OCCURRENCESHIGHLIGHTING_H_INCLUDED
I would suggest to use a uniform string. like XXXXX_H
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Move Occurrence highlighting from core into a plugin
« Reply #4 on: July 30, 2013, 03:39:01 pm »
Well I cannot apply Jens' patch (I assume its GIT based again), but the part of Daniel works fine for me so far. Nice work!
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: Move Occurrence highlighting from core into a plugin
« Reply #5 on: July 30, 2013, 03:40:24 pm »
...(I assume its GIT based again)...
It is not in git format, looks like a valid svn patch.
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Move Occurrence highlighting from core into a plugin
« Reply #6 on: July 30, 2013, 03:53:53 pm »
...(I assume its GIT based again)...
It is not in git format, looks like a valid svn patch.
Code
commit 76a459e2d6c0f8d420ac4bf20807abb73e02052e
Author: Jens Lody <jens@codeblocks.org>
Date:   Tue Jul 30 01:50:04 2013 +0200

    * additional patch for move of occurrences highlighting

Index: acinclude.m4
===================================================================
--- acinclude.m4
+++ acinclude.m4
@@ -170,6 +170,17 @@
  AC_MSG_RESULT(no)
Look at the first line, it should be a git patch, Jens may use some utility tool to translate this patch a little to make it svn compatible.
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Move Occurrence highlighting from core into a plugin
« Reply #7 on: July 30, 2013, 04:07:09 pm »
Look at the first line, it should be a git patch, Jens may use some utility tool to translate this patch a little to make it svn compatible.
You can have whatever you want before the Index lines. The patch is in a format that is almost like a patch produced by svn.
If you remove the top lines you won't be able to guess that it has been produced with git.

The thing is that Morten uses some broken patch utility, so it is not a problem that the patch is broken, but the tool Morten is using is broken.

From what I remember it is pretty hard to find working patch utility for windows.  :'(
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Move Occurrence highlighting from core into a plugin
« Reply #8 on: July 30, 2013, 04:18:16 pm »
The thing is that Morten uses some broken patch utility, so it is not a problem that the patch is broken, but the tool Morten is using is broken.

From what I remember it is pretty hard to find working patch utility for windows.  :'(
I do not have any problem about the patch utility.
For the record, the most recent patch utility is in MSYS2 package
Quote
New MSYS2 snapshots:

32-bit:    x32-msys2-alpha-20130728.tar.xz  http://sourceforge.net/projects/msys2/files/Alpha-versions/32-bit/x32-msys2-alpha-20130728.tar.xz/download

64-bit:    x64-msys2-alpha-20130728.tar.xz  http://sourceforge.net/projects/msys2/files/Alpha-versions/64-bit/x64-msys2-alpha-20130728.tar.xz/download
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Move Occurrence highlighting from core into a plugin
« Reply #9 on: July 30, 2013, 04:27:29 pm »
The thing is that Morten uses some broken patch utility, so it is not a problem that the patch is broken, but the tool Morten is using is broken.
Nope - it works 100% if you use SVN diff. I'd say its just purely SVN oriented.

From what I remember it is pretty hard to find working patch utility for windows.  :'(
However, thats true as well. Thing is I don't want to use a console utility if I have a full-blown GUI-based IDE. Thats basically also the reason why I prefer Windows over Linux.

If I were a console guy and there were a nice utility I wouldn't mind at all and take the time to even compile patch myself. The point is: Its actually so easy to create as working SVN patch. So why do work-arounds?

I think we had this discussion now over and over again. So please, whenever I post "I cannot apply this" just take it as a hint that besides me probably other user cannot try what you've posted and you limit the testers. If thats fine with you, everything is alright!
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: Move Occurrence highlighting from core into a plugin
« Reply #10 on: July 30, 2013, 04:44:21 pm »
However, thats true as well. Thing is I don't want to use a console utility if I have a full-blown GUI-based IDE. Thats basically also the reason why I prefer Windows over Linux.
Then report the problems to your IDE providers, as far as I know it is even a paid one.

The point is: Its actually so easy to create as working SVN patch. So why do work-arounds?
Because svn doesn't have local commits, yet! When they add local commits/branches to svn you'll see why we prefer to use git. :)
And it is not that easy if you don't have svn checkout. :)  But at least my script works fine, I don't know what Jens' is using though.
(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: 9699
Re: Move Occurrence highlighting from core into a plugin
« Reply #11 on: July 30, 2013, 04:56:50 pm »
Then report the problems to your IDE providers, as far as I know it is even a paid one.
I won't anymore for three reasons:
1.) Its only C::B where these issues occur and this is spare-time, so its not a show-stopper for me at all
2.) They usually want to have a small test-case and thats hard to do as I first need to find out what actually fails and I don't have time for it.
3.) The software was just sold to a larger company and this affects support which has basically stalled. Previously it was a flexible 2-3 employees (German) company, now its a large 100+ (US) company.

So in fact once my license has run out I will look for alternatives, if they are affordable.
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: Move Occurrence highlighting from core into a plugin
« Reply #12 on: July 30, 2013, 05:06:17 pm »
Fair enough. I suppose you can try one of the command line patch utilities in the mean time, so at least you have a working alternative for the case where your tool fails. :)
(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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Move Occurrence highlighting from core into a plugin
« Reply #13 on: July 30, 2013, 09:12:01 pm »
I upload a new patch, that fixes the Makefile.am of the highlighte, it replaces the older version of my additional patch.
By the way: both of my patches apply fine with TortoisSVN.

If they don't apply with "Smart"SVN, I do not really care, sorry.
There is no way for me to fix or even test it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Move Occurrence highlighting from core into a plugin
« Reply #14 on: July 31, 2013, 03:04:01 am »
Next updated patch.
Should cover all project-files and update-scripts now.
Name changed back from CamelCase to all lower letteres, as we have it for all core-plugins, therefore also changed the case for the zip-file.

Windows files are not (yet) tested.
Linux files should build correctly now.


There is one issue with permanently highlighting.

The highlighting will occurr (most of the times) first after clicking into the file (if it is already opened and not the active one).
It's the same when permanently highlighting is turned off for a word: in actual file highlighting is removed immediately, in open files it is removed after clicking into the file at any place.

I can look into it tomorrow, if you want.
« Last Edit: July 31, 2013, 08:41:48 am by jens »