Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: GeO 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:
(http://img704.imageshack.us/img704/958/cbdifftab.th.png) (http://img704.imageshack.us/i/cbdifftab.png/)
Unified:
(http://img163.imageshack.us/img163/1774/cbdiffuni.th.png) (http://img163.imageshack.us/i/cbdiffuni.png/)
Side by Side:
(http://img682.imageshack.us/img682/3875/cbdiffsbs.th.png) (http://img682.imageshack.us/i/cbdiffsbs.png/)
[attachment deleted by admin]
-
Maybe support subversion? diff in two rev?
-
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).
-
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
-
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
-
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... :-(
-
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.
-
Fixed some minor bugs. See first post.
-
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?
-
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.
-
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!
-
- 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.
-
- 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... ;-)
-
- 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 (http://forums.codeblocks.org/index.php/topic,12829.msg86682.html#msg86682)!)
- 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.
-
Probably no one have asked this feature, so there is no way to access it :)
-
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... :-)
-
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
-
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.
-
Only the API/ABI :)
-
Only the API/ABI :)
:) :) Well nothing except these.
-
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:
@Geo: BTW, is there any new version around? Where do you usually make them available? Here? ;-)
-
@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
-
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
-
Do you have the devel package for wxGTK?
-
Yes, maybe th wrong version, maybe with the wrong flags ...
-
The plugin can't be built with latest CB svn & wx2.8-branch svn.
The patch can solve the issue.
-
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 !
-
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 (https://github.com/ywx/cbDiff)
it's work fine.
Thanks to 'gocad'
Best regards
-
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