Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r9 - trunk: src www

delphiaddinfortortoisesvn
Discussion topic

Back to topic list

svn commit: r9 - trunk: src www

Author scdevelop
Full name Santiago C.
Date 2006-12-16 10:48:23 PST
Message Author: scdevelop
Date: 2006-12-16 10:48:22-0800
New Revision: 9

Modified:
   trunk/src/tsvnWizard.pas
   trunk/www/index.html
   trunk/www/screenshot.gif
   trunk/www/tsvnWizard.pas

Log:
Diff menu adds a subitem for each module file (.pas and .dfm in Delphi, .cpp, .h and .dfm in C++ Builder); if the current module is a single file works as before.


Modified: trunk/src/tsvnWizard.pas
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/trunk/src/tsvnWi​zard.pas?view=diff​&rev=9&p1=trun​k/src/tsvnWizard.pas​&p2=trunk/src/ts​vnWizard.pas&r1=​8&r2=9
====================​====================​====================​==================
--- trunk/src/tsvnWizard.pas (original)
+++ trunk/src/tsvnWizard.pas 2006-12-16 10:48:22-0800
@@ -26,7 +26,9 @@
     timer: TTimer;
     tsvnMenu: TMenuItem;
     TSVNPath: string;
- procedure Tick( sender: tobject );
+ procedure Tick( sender: TObject );
+ procedure TSVNMenuClick( sender: TObject );
+ procedure DiffClick( sender: TObject );
     procedure TSVNExec( params: string );
     function GetBitmapName(Index: Integer): string;
     function GetVerb(Index: Integer): string;
@@ -87,14 +89,18 @@
       end;
 end;
 
-function GetCurrentFileName: string;
-var editor: IOTAEditorServices;
+procedure GetCurrentModuleFileList( fileList: TStrings );
+var ModServices: IOTAModuleServices;
+ Module: IOTAModule;
+ i: integer;
 begin
- result:= '';
- editor:= BorlandIDEServices as IOTAEditorServices;
- if editor <> nil then begin
- if editor.TopBuffer <> nil then
- result:= editor.TopBuffer.FileName;
+ fileList.Clear;
+ ModServices := BorlandIDEServices as IOTAModuleServices;
+ if ModServices <> nil then begin
+ Module:= ModServices.CurrentModule;
+ if Module <> nil then
+ for i:= 0 to ModServices.CurrentM​odule.GetModuleFileC​ount-1 do
+ fileList.Add( ModServices.CurrentM​odule.GetModuleFileE​ditor(i).GetFileName​ );
     end;
 end;
 
@@ -120,7 +126,7 @@
 
 end;
 
-procedure TTortoiseSVN.Tick( sender: tobject );
+procedure TTortoiseSVN.Tick( sender: TObject );
 var intf: INTAServices;
 begin
     if BorlandIDEServices.Q​ueryInterface( INTAServices, intf ) = s_OK then begin
@@ -130,6 +136,53 @@
     end;
 end;
 
+procedure TTortoiseSVN.TSVNMenuClick( sender: TObject );
+var files: TStringList;
+ i: integer;
+ diff, item: TMenuItem;
+begin
+ // update the diff item and submenu; the diff action is handled by the
+ // menu item itself, not by the action list
+ diff:= tsvnMenu.Items[SVN_DIFF];
+ diff.Action:= nil;
+ diff.OnClick:= nil;
+ diff.Enabled:= false;
+ diff.Clear;
+ files:= TStringList.create;
+ GetCurrentModuleFile​List(files);
+ if files.Count > 0 then begin
+ diff.Enabled:= true;
+ diff.Caption:= 'Diff';
+ if files.Count > 1 then begin
+ for i:= 0 to files.count-1 do begin
+ item:= TMenuItem.Create(diff);
+ item.Caption:= ExtractFileName( files[i] );
+ item.OnClick:= DiffClick;
+ item.Tag:= i;
+ diff.Add( item );
+ end;
+ end else begin // files.Count = 1
+ diff.Caption:= 'Diff ' + ExtractFileName( files[0] );
+ diff.OnClick:= DiffClick;
+ end;
+ end;
+ files.free;
+end;
+
+procedure TTortoiseSVN.DiffClick( sender: TObject );
+var files: TStringList;
+ item: TMenuItem;
+begin
+ item:= sender as TMenuItem;
+ files:= TStringList.create;
+ GetCurrentModuleFile​List(files);
+ if files.Count > 1 then
+ TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( files[item.Tag], '"' ) )
+ else if files.Count = 1 then
+ TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( files[0], '"' ) );
+ files.free;
+end;
+
 procedure TTortoiseSVN.CreateMenu;
 var mainMenu: TMainMenu;
     item: TMenuItem;
@@ -141,6 +194,7 @@
 
     tsvnMenu:= TMenuItem.Create(nil);
     tsvnMenu.Caption:= 'TortoiseSVN';
+ tsvnMenu.OnClick:= TSVNMenuClick;
 
 
     for i:= 0 to SVN_VERB_COUNT-1 do begin
@@ -260,8 +314,8 @@
             if GetCurrentProject <> nil then
                 Result:= vsEnabled;
         SVN_DIFF:
- if GetCurrentFileName <> '' then
- Result:= vsEnabled;
+ // this verb state is updated by the menu itself
+ ;
         SVN_REVERT:
             if GetCurrentProject <> nil then
                 Result:= vsEnabled;
@@ -281,10 +335,8 @@
 
 procedure TTortoiseSVN.ExecuteVerb(Index: Integer);
 var project: IOTAProject;
- filename: string;
 begin
     project:= GetCurrentProject();
- filename:= getCurrentFileName();
     case index of
         SVN_PROJECT_EXPLORER:
             if project <> nil then
@@ -311,8 +363,8 @@
                     TSVNExec( '/command:commit /notempfile /path:' + AnsiQuotedStr( ExtractFilePath(proj​ect.GetFileName), '"' ) );
                 end;
         SVN_DIFF:
- if filename <> '' then
- TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( filename, '"' ) );
+ // this verb is handled by its menu item
+ ;
         SVN_REVERT:
             if project <> nil then
                 TSVNExec( '/command:revert /notempfile /path:' + AnsiQuotedStr( ExtractFilePath(proj​ect.GetFileName), '"' ) );

Modified: trunk/www/index.html
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/trunk/www/index.​html?view=diff&r​ev=9&p1=trunk/ww​w/index.html&p2=​trunk/www/index.html​&r1=8&r2=9
====================​====================​====================​==================
--- trunk/www/index.html (original)
+++ trunk/www/index.html 2006-12-16 10:48:22-0800
@@ -29,7 +29,7 @@
 <li>Add (project)
 <li>Update (project)
 <li>Commit (project)
-<li>Diff (current editor file)
+<li>Diff (current module files)
 <li>Revert (project)
 <li>Repository browser
 <li>Settings

Modified: trunk/www/screenshot.gif
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/trunk/www/screen​shot.gif?view=diff​&rev=9&p1=trun​k/www/screenshot.gif​&p2=trunk/www/sc​reenshot.gif&r1=​8&r2=9
====================​====================​====================​==================
Binary files. No diff available.

Modified: trunk/www/tsvnWizard.pas
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/trunk/www/tsvnWi​zard.pas?view=diff​&rev=9&p1=trun​k/www/tsvnWizard.pas​&p2=trunk/www/ts​vnWizard.pas&r1=​8&r2=9
====================​====================​====================​==================
--- trunk/www/tsvnWizard.pas (original)
+++ trunk/www/tsvnWizard.pas 2006-12-16 10:48:22-0800
@@ -26,7 +26,9 @@
     timer: TTimer;
     tsvnMenu: TMenuItem;
     TSVNPath: string;
- procedure Tick( sender: tobject );
+ procedure Tick( sender: TObject );
+ procedure TSVNMenuClick( sender: TObject );
+ procedure DiffClick( sender: TObject );
     procedure TSVNExec( params: string );
     function GetBitmapName(Index: Integer): string;
     function GetVerb(Index: Integer): string;
@@ -87,14 +89,18 @@
       end;
 end;
 
-function GetCurrentFileName: string;
-var editor: IOTAEditorServices;
+procedure GetCurrentModuleFileList( fileList: TStrings );
+var ModServices: IOTAModuleServices;
+ Module: IOTAModule;
+ i: integer;
 begin
- result:= '';
- editor:= BorlandIDEServices as IOTAEditorServices;
- if editor <> nil then begin
- if editor.TopBuffer <> nil then
- result:= editor.TopBuffer.FileName;
+ fileList.Clear;
+ ModServices := BorlandIDEServices as IOTAModuleServices;
+ if ModServices <> nil then begin
+ Module:= ModServices.CurrentModule;
+ if Module <> nil then
+ for i:= 0 to ModServices.CurrentM​odule.GetModuleFileC​ount-1 do
+ fileList.Add( ModServices.CurrentM​odule.GetModuleFileE​ditor(i).GetFileName​ );
     end;
 end;
 
@@ -120,7 +126,7 @@
 
 end;
 
-procedure TTortoiseSVN.Tick( sender: tobject );
+procedure TTortoiseSVN.Tick( sender: TObject );
 var intf: INTAServices;
 begin
     if BorlandIDEServices.Q​ueryInterface( INTAServices, intf ) = s_OK then begin
@@ -130,6 +136,53 @@
     end;
 end;
 
+procedure TTortoiseSVN.TSVNMenuClick( sender: TObject );
+var files: TStringList;
+ i: integer;
+ diff, item: TMenuItem;
+begin
+ // update the diff item and submenu; the diff action is handled by the
+ // menu item itself, not by the action list
+ diff:= tsvnMenu.Items[SVN_DIFF];
+ diff.Action:= nil;
+ diff.OnClick:= nil;
+ diff.Enabled:= false;
+ diff.Clear;
+ files:= TStringList.create;
+ GetCurrentModuleFile​List(files);
+ if files.Count > 0 then begin
+ diff.Enabled:= true;
+ diff.Caption:= 'Diff';
+ if files.Count > 1 then begin
+ for i:= 0 to files.count-1 do begin
+ item:= TMenuItem.Create(diff);
+ item.Caption:= ExtractFileName( files[i] );
+ item.OnClick:= DiffClick;
+ item.Tag:= i;
+ diff.Add( item );
+ end;
+ end else begin // files.Count = 1
+ diff.Caption:= 'Diff ' + ExtractFileName( files[0] );
+ diff.OnClick:= DiffClick;
+ end;
+ end;
+ files.free;
+end;
+
+procedure TTortoiseSVN.DiffClick( sender: TObject );
+var files: TStringList;
+ item: TMenuItem;
+begin
+ item:= sender as TMenuItem;
+ files:= TStringList.create;
+ GetCurrentModuleFile​List(files);
+ if files.Count > 1 then
+ TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( files[item.Tag], '"' ) )
+ else if files.Count = 1 then
+ TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( files[0], '"' ) );
+ files.free;
+end;
+
 procedure TTortoiseSVN.CreateMenu;
 var mainMenu: TMainMenu;
     item: TMenuItem;
@@ -141,6 +194,7 @@
 
     tsvnMenu:= TMenuItem.Create(nil);
     tsvnMenu.Caption:= 'TortoiseSVN';
+ tsvnMenu.OnClick:= TSVNMenuClick;
 
 
     for i:= 0 to SVN_VERB_COUNT-1 do begin
@@ -260,8 +314,8 @@
             if GetCurrentProject <> nil then
                 Result:= vsEnabled;
         SVN_DIFF:
- if GetCurrentFileName <> '' then
- Result:= vsEnabled;
+ // this verb state is updated by the menu itself
+ ;
         SVN_REVERT:
             if GetCurrentProject <> nil then
                 Result:= vsEnabled;
@@ -281,10 +335,8 @@
 
 procedure TTortoiseSVN.ExecuteVerb(Index: Integer);
 var project: IOTAProject;
- filename: string;
 begin
     project:= GetCurrentProject();
- filename:= getCurrentFileName();
     case index of
         SVN_PROJECT_EXPLORER:
             if project <> nil then
@@ -311,8 +363,8 @@
                     TSVNExec( '/command:commit /notempfile /path:' + AnsiQuotedStr( ExtractFilePath(proj​ect.GetFileName), '"' ) );
                 end;
         SVN_DIFF:
- if filename <> '' then
- TSVNExec( '/command:diff /notempfile /path:' + AnsiQuotedStr( filename, '"' ) );
+ // this verb is handled by its menu item
+ ;
         SVN_REVERT:
             if project <> nil then
                 TSVNExec( '/command:revert /notempfile /path:' + AnsiQuotedStr( ExtractFilePath(proj​ect.GetFileName), '"' ) );

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r9 - trunk: src www scdevelop Santiago C. 2006-12-16 10:48:23 PST
Messages per page: