Author Topic: cbDiff plugin  (Read 30858 times)

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
cbDiff plugin
« on: June 28, 2010, 10:46:04 pm »
cbDiff plugin - is a simple plugin, which visually shows the differences between two files.
You can view the differences in table or side by side mode or as a unified diff.
In table and side by side mode you can set the highlight language you want.

Source and cbDiff.cbp with targets for Unix and windows are attached.
Just open the project, build it and install the plugin.
You can use the plugin from menu bar "File->Diff Files..." or from within the editor- and projectcontext menus "Diff with".
You can save the generated diff as .diff file, by clicking "Save as..."
and there are some settings at "Environment Settings->cbDiff Settings".

ToDo list:
 - Make it possible to change the files in the view
 - Improve scroll synchronization done
 - Some problems with large files (like CodeBlocks.cbp) done
 - [Your suggestion here] :lol:

Note for developers:
You can use cbDiff from within your plugin (useful for version control plugins)
look at README it will show you the (ugly :?, but working :)) way.

Thanks to Tatsuhiko Kubo <cubicdaiya@gmail.com> for the diff template library

Changes 1.1.1
* fixed windows bugs reported by daniloz
* reorganized projectlayout
* updated to dtl 1.12 
* some code cleanup

Changes 1.1.01
* added possibility to switch the view mode and the highlight language within the editor
* added settings for default view mode and default highlight language
* added context menu entry "Diff with...": (as suggested by javmss)
   - on project tree it shows the project files and on an editor it shows all open files
* updated dtl to 1.11

Changes since alpha
* Improved scroll synchronization
* No more problems with large files (like CodeBlocks.cbp)
* Updated to dtl 1.09

If you find some bugs or you have some suggestions please report them.

GeO

Some screen shots:

Table:


Unified:


Side by Side:


[attachment deleted by admin]
« Last Edit: January 26, 2011, 11:04:28 am by GeO »

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: cbDiff plugin [alpha]
« Reply #1 on: July 12, 2010, 12:56:10 pm »
Maybe support subversion? diff in two rev?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: cbDiff plugin [alpha]
« Reply #2 on: July 12, 2010, 04:24:32 pm »
cbDiff plugin - is a simple plugin, which visually shows the differences between two files.
Cool stuff. I'll try out soon.

Maybe support subversion? diff in two rev?
Good point, that would certainly be useful. However, it should not be too specific to SVN or generic enough it also works with other "diff generating" tools (like any other version control diff command).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin [alpha]
« Reply #3 on: July 16, 2010, 07:29:05 pm »
Maybe support subversion? diff in two rev?
Yes it's possible to call a "Diff" function from outside (look at the readme),
so other plugin developers of version control systems (like svn, cvs, git, hg, bazaar and so on....) can use it.

Greets GeO

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: cbDiff plugin [alpha]
« Reply #4 on: July 17, 2010, 01:38:43 am »
GeO: Thanks for doing this, should be a very useful tool.

I'm planning to implement version control revision browsing in my FileManager plugin. Will have to figure out a way to allow diff viewing between revisions using your plugin

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: cbDiff plugin [alpha]
« Reply #5 on: July 19, 2010, 07:16:44 am »
cbDiff plugin - is a simple plugin, which visually shows the differences between two files.
Cool stuff. I'll try out soon.
Strange... I am unable to compile this... :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2162
Re: cbDiff plugin [alpha]
« Reply #6 on: July 19, 2010, 01:20:34 pm »
cbDiff plugin - is a simple plugin, which visually shows the differences between two files.
Cool stuff. I'll try out soon.
Strange... I am unable to compile this... :-(

For me, when I removed WX_PRECOMP, it compiled ok.

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #7 on: October 11, 2010, 03:23:41 pm »
Fixed some minor bugs. See first post.

Offline javmss

  • Single posting newcomer
  • *
  • Posts: 7
Re: cbDiff plugin
« Reply #8 on: January 09, 2011, 08:03:56 pm »
Very good!
It fills one of the (few) missing features in Code::Blocks.
Must have!

Now, the suggestions.
I don't know how hard it is, but I believe that would really too much useful if I could:

- Compare two open files by right clicking on its tabs.
- Compare selected files from project file tree.

Any chance to get this done, please?

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #9 on: January 12, 2011, 02:04:50 pm »
Very good!
It fills one of the (few) missing features in Code::Blocks.
Must have!

Now, the suggestions.
I don't know how hard it is, but I believe that would really too much useful if I could:

- Compare two open files by right clicking on its tabs.
- Compare selected files from project file tree.

Any chance to get this done, please?

First, thanks for the motivation.
I implemented your suggestion in version 1.1.01 (see start post).
It's now possible to compare the current active file with an other open file, with the context menu of the editor, not the tab.
the same thing is possible with the project files.

As always, any feedback is welcome.

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: cbDiff plugin
« Reply #10 on: January 13, 2011, 10:35:53 am »
First of all, great job!!! This is a really nice plugin... Thank you!!!

I like the new features... However I found some bugs:

- when I use the File|Diff files... menu entry, I got a new tab, but empty. I only get the diff if I resize the tab. I think it's just a refresh missing... :-)

- if I use the "Diff with..." context menu here, nothing happens, i.e. no new tab opened after I select the other file in the list.

And have some suggestions also:

- for me, it would be more natural to have the "Diff with..." context menu when clicking on the tab, instead of on the editor (I'm ok in having both, of course).

- is it possible to have a last entry in the file selection list (from the context menu) to browse for a file? I mean, I'd like to compare an opened file with one that is outside the project, so I'd like to browse the disk for it...

- how difficult it is to have the mouse wheel working on the file selection list (from the context menu)?

Thank's in advance!

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #11 on: January 13, 2011, 02:05:26 pm »
- when I use the File|Diff files... menu entry, I got a new tab, but empty. I only get the diff if I resize the tab. I think it's just a refresh missing... :-)
- if I use the "Diff with..." context menu here, nothing happens, i.e. no new tab opened after I select the other file in the list.
Which OS do you use? Both of them work for me on Ubuntu, it's probably a Windows problem. I'll look in to.

Now to the suggestions:
- for me, it would be more natural to have the "Diff with..." context menu when clicking on the tab, instead of on the editor (I'm ok in having both, of course).
Yes, this was javmss suggestion too, but i didn't found a possibility to access this menu from a plugin. I'll look again, maybe i can find another way
- is it possible to have a last entry in the file selection list (from the context menu) to browse for a file? I mean, I'd like to compare an opened file with one that is outside the project, so I'd like to browse the disk for it...
Well, i could make a general diff menu, used by all context menus, where you have all three options.
It would something like this: Diff with... -> Open file.. -> submenu with all open files
                                                                 -> Project file.. -> submenu with all project files
                                                                 -> Disk file... -> file selection dialog

- how difficult it is to have the mouse wheel working on the file selection list (from the context menu)?
As far as i know this is not possible, because wxWidget uses the native menus.

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: cbDiff plugin
« Reply #12 on: January 13, 2011, 02:13:04 pm »
- when I use the File|Diff files... menu entry, I got a new tab, but empty. I only get the diff if I resize the tab. I think it's just a refresh missing... :-)
- if I use the "Diff with..." context menu here, nothing happens, i.e. no new tab opened after I select the other file in the list.
Which OS do you use? Both of them work for me on Ubuntu, it's probably a Windows problem. I'll look in to.
Yeah... Windows Vista 32bit here... :-(

- is it possible to have a last entry in the file selection list (from the context menu) to browse for a file? I mean, I'd like to compare an opened file with one that is outside the project, so I'd like to browse the disk for it...
Well, i could make a general diff menu, used by all context menus, where you have all three options.
It would something like this: Diff with... -> Open file.. -> submenu with all open files
                                                                 -> Project file.. -> submenu with all project files
                                                                 -> Disk file... -> file selection dialog
That would be a pretty good solution...

- how difficult it is to have the mouse wheel working on the file selection list (from the context menu)?
As far as i know this is not possible, because wxWidget uses the native menus.
Pitty... :-)

Anyway, thank you again for the plugin and for the support... ;-)

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #13 on: January 26, 2011, 11:34:08 am »
- when I use the File|Diff files... menu entry, I got a new tab, but empty. I only get the diff if I resize the tab. I think it's just a refresh missing... :-)
- if I use the "Diff with..." context menu here, nothing happens, i.e. no new tab opened after I select the other file in the list.
- is it possible to have a last entry in the file selection list (from the context menu) to browse for a file? I mean, I'd like to compare an opened file with one that is outside the project, so I'd like to browse the disk for it...
fixed and implemented in 1.1.1 (see startpost!)

- for me, it would be more natural to have the "Diff with..." context menu when clicking on the tab, instead of on the editor (I'm ok in having both, of course).
I looked in to the source of codeblocks, but now there is no way to access this contextmenu.
However, it could be made accessible by:
*adding a new ModuleType(mtEditorTab) in globals.h
*adding the method "Manager::Get()->GetPluginManager()->AskPluginsForModuleMenu(mtEditorTab, &pop);" in editormanager.cpp's OnPageContextMenu

That would be a simple task, but maybe the devs don't want that plugins can access this menu, because else it will be overloaded just like the editors context menu.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11902
    • Travis build status
Re: cbDiff plugin
« Reply #14 on: January 26, 2011, 01:10:16 pm »
Probably no one have asked this feature, so there is no way to access it :)
(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 daniloz

  • Regular
  • ***
  • Posts: 268
Re: cbDiff plugin
« Reply #15 on: January 26, 2011, 01:34:14 pm »
Probably no one have asked this feature, so there is no way to access it :)
This means, if I kindly ask for it, there's a chance it would be implemented?

Btw, I'm kindly asking for it... :-)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: cbDiff plugin
« Reply #16 on: January 26, 2011, 01:43:15 pm »
Probably no one have asked this feature, so there is no way to access it :)
This means, if I kindly ask for it, there's a chance it would be implemented?
Could GeO provide a patch for this purpose? It seems he has done it already...?!
See:
However, it could be made accessible by:
*adding a new ModuleType(mtEditorTab) in globals.h
*adding the method "Manager::Get()->GetPluginManager()->AskPluginsForModuleMenu(mtEditorTab, &pop);" in editormanager.cpp's OnPageContextMenu
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #17 on: January 26, 2011, 02:20:50 pm »
Could GeO provide a patch for this purpose? It seems he has done it already...?!

Sure, i didn't test it yet, but it shouldn't break anything.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11902
    • Travis build status
Re: cbDiff plugin
« Reply #18 on: January 26, 2011, 02:43:00 pm »
Only the API/ABI :)
(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 GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #19 on: January 26, 2011, 03:04:43 pm »
Only the API/ABI :)
:) :) Well nothing except these.
« Last Edit: January 26, 2011, 03:19:42 pm by GeO »

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: cbDiff plugin
« Reply #20 on: July 26, 2011, 08:46:04 am »
The compilation of the cbDiff plugin was broken after r7291, so in order to fix that I have to add the following include to cbDiffUtils.cpp:

Code: [Select]
#include <wx/image.h>

@Geo: BTW, is there any new version around? Where do you usually make them available? Here? ;-)

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
Re: cbDiff plugin
« Reply #21 on: July 26, 2011, 07:14:29 pm »
@Geo: BTW, is there any new version around? Where do you usually make them available? Here? ;-)
Well, actually i have a new version, with some cool features, for a while, but it needs some speed improvements.
Maybe i'll find some time this weekend, so i'll finish it.

I announce new versions usually in the first post of this thread.

Greets GeO

Offline UHM

  • Single posting newcomer
  • *
  • Posts: 2
Re: cbDiff plugin
« Reply #22 on: October 26, 2011, 02:17:18 pm »
Is there anybody who can help a new user (without C++ knowledge) by sending him
 
   libcbdiff.so

for
Linux version 2.6.27.39-0.3-default (geeko@buildhost) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-11-23 12:57:38 +0100

???

i tried to compile it myself but I failed for hours, because of missing setup.h and other problems.

Thanks & Greetings, Uwe

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11902
    • Travis build status
Re: cbDiff plugin
« Reply #23 on: October 26, 2011, 03:45:44 pm »
Do you have the devel package for wxGTK?
(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 UHM

  • Single posting newcomer
  • *
  • Posts: 2
Re: cbDiff plugin
« Reply #24 on: November 09, 2011, 06:00:11 pm »
Yes, maybe th wrong version, maybe with the wrong flags ...

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: cbDiff plugin
« Reply #25 on: November 23, 2011, 10:29:33 am »
The plugin can't be built with latest CB svn & wx2.8-branch svn.

The patch can solve the issue.
Regards,
xunxun

Offline gocad

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: cbDiff plugin
« Reply #26 on: December 25, 2012, 01:04:46 pm »
For Code::Blocks 12.11 rev 8629
Compiled by MinGW32 TDM 4.7.1 with wxWidgets 2.8.12

......
mingw32/bin/ld.exe: warning: cannot find entry symbol nable-auto-import; defaulting to 671c1000
......

You can replace "-enable-auto-import" with "--enable-auto-import" in cbDiff.cbp.

Good Luck !

Offline LETARTARE

  • Regular
  • ***
  • Posts: 384
  • L'ami de l'homme.The friend of man.
Re: cbDiff plugin
« Reply #27 on: January 17, 2015, 12:11:06 pm »
Hello,
for Code::Blocks svn 10035
Compiled by MinGW32 TDM 4.7.1 with wxWidgets 2.8.12 and VISTA

https://github.com/ywx/cbDiff

it's work fine.

Thanks to 'gocad'

Best regards
C::B  : svn11798, wx2.8, plugins : QtPregen-2.6.0-sdk143
1-Vista Business Pack 2 32bits : TDM-GCC-5.1.0.3
2-OpenSuse-42.3-Leap 64bits :  g++-4.8.5,
=> !! The messages are translated by Deepl !!

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 226
Re: cbDiff plugin
« Reply #28 on: February 10, 2016, 06:01:41 pm »
Seems like someone branched this plugin and added filetype detection. I merged the 2 branches into another branch that can be found here:

https://github.com/yvesdm3000/cbDiff
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib