Author Topic: cbDiff plugin  (Read 27891 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: 9474
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: 1575
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: 9474
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: 2108
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: 11284
    • 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!]