Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r18 - branches/SOPTIM/src/tsvnWizard.pas

delphiaddinfortortoisesvn
Discussion topic

Back to topic list

svn commit: r18 - branches/SOPTIM/src/tsvnWizard.pas

Author otto_noll
Full name Otto Noll
Date 2008-12-18 04:10:44 PST
Message Author: otto_noll
Date: 2008-12-18 04:10:44-0800
New Revision: 18

Modified:
   branches/SOPTIM/src/​tsvnWizard.pas

Log:
Introduce Enumeration ESVNFeature

Modified: branches/SOPTIM/src/​tsvnWizard.pas
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/branches/SOPTIM/​src/tsvnWizard.pas?v​iew=diff&pathrev​=18&r1=17&r2​=18
====================​====================​====================​==================
--- branches/SOPTIM/src/​tsvnWizard.pas (original)
+++ branches/SOPTIM/src/​tsvnWizard.pas 2008-12-18 04:10:44-0800
@@ -6,21 +6,20 @@
 
 uses ToolsAPI, SysUtils, Windows, Dialogs, Menus, Registry, ShellApi,
     Classes, Controls, Graphics, ImgList, ExtCtrls, ActnList,Forms;
-
-const
- SVN_PROJECT_EXPLORER = 0;
- SVN_LOG = 1;
- SVN_CHECK_MODIFICATIONS = 2;
- SVN_ADD = 3;
- SVN_UPDATE = 4;
- SVN_COMMIT = 5;
- SVN_DIFF = 6;
- SVN_REVERT = 7;
- SVN_REPOSITORY_BROWSER = 8;
- SVN_SETTINGS = 9;
- SVN_ABOUT = 10;
- SVN_VERB_COUNT = 11;
-
+type
+ ESVNFeature = (
+ SVN_PROJECT_EXPLORER,
+ SVN_LOG,
+ SVN_CHECK_MODIFICATIONS,
+ SVN_ADD,
+ SVN_UPDATE,
+ SVN_COMMIT,
+ SVN_DIFF,
+ SVN_REVERT,
+ SVN_REPOSITORY_BROWSER,
+ SVN_SETTINGS,
+ SVN_ABOUT
+ );
 type TTortoiseSVN = class(TNotifierObject, IOTANotifier, IOTAWizard)
 private
     timer: TTimer;
@@ -30,10 +29,10 @@
     procedure TSVNMenuClick( sender: TObject );
     procedure DiffClick( sender: TObject );
     procedure TSVNExec( params: string );
- function GetBitmapName(Index: Integer): string;
- function GetVerb(Index: Integer): string;
- function GetVerbState(Index: Integer): Word;
- procedure ExecuteVerb(Index: Integer);
+ function GetBitmapName(Index: ESVNFeature): string;
+ function GetVerb(Index: ESVNFeature): string;
+ function GetVerbState(Index: ESVNFeature): Word;
+ procedure ExecuteVerb(Index: ESVNFeature);
     procedure CreateMenu;
     procedure UpdateAction( sender: TObject );
     procedure ExecuteAction( sender: TObject );
@@ -145,7 +144,7 @@
 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:= tsvnMenu.Items[ord(SVN_DIFF)];
     diff.Action:= nil;
     diff.OnClick:= nil;
     diff.Enabled:= false;
@@ -188,7 +187,7 @@
 procedure TTortoiseSVN.CreateMenu;
 var mainMenu: TMainMenu;
     item: TMenuItem;
- i: integer;
+ i: ESVNFeature;
     bmp: TBitmap;
     action: TAction;
 begin
@@ -199,7 +198,7 @@
     tsvnMenu.OnClick:= TSVNMenuClick;
 
 
- for i:= 0 to SVN_VERB_COUNT-1 do begin
+ for i:= SVN_PROJECT_EXPLORER to SVN_About do begin
 
         bmp:= TBitmap.create;
         try
@@ -215,7 +214,7 @@
         bmp.free;
         action.OnUpdate:= updateAction;
         action.OnExecute:= executeAction;
- action.Tag:= i;
+ action.Tag:= ord(i);
 
         item:= TMenuItem.Create( tsvnMenu );
         item.action:= action;
@@ -230,7 +229,7 @@
 var
     I: Integer;
     PMenu: TPopupMenu;
- MItem,Diff: TMenuItem;
+ MItem: TMenuItem;
 begin
     for I := 0 to Screen.FormCount - 1 do
     begin
@@ -258,7 +257,7 @@
     inherited;
 end;
 
-function TTortoiseSVN.GetBitm​apName(Index: Integer): string;
+function TTortoiseSVN.GetBitm​apName(Index: ESVNFeature): string;
 begin
     case index of
         SVN_PROJECT_EXPLORER:
@@ -286,7 +285,7 @@
     end;
 end;
 
-function TTortoiseSVN.GetVerb(Index: Integer): string;
+function TTortoiseSVN.GetVerb(Index: ESVNFeature): string;
 begin
     case index of
         SVN_PROJECT_EXPLORER:
@@ -316,7 +315,7 @@
 
 const vsEnabled = 1;
 
-function TTortoiseSVN.GetVerb​State(Index: Integer): Word;
+function TTortoiseSVN.GetVerb​State(Index: ESVNFeature): Word;
 begin
     Result:= 0;
     case index of
@@ -358,7 +357,7 @@
     WinExec( pchar( TSVNPath + ' ' + params ), SW_SHOW );
 end;
 
-procedure TTortoiseSVN.ExecuteVerb(Index: Integer);
+procedure TTortoiseSVN.ExecuteVerb(Index: ESVNFeature);
 var project: IOTAProject;
 begin
     project:= GetCurrentProject();
@@ -409,14 +408,14 @@
 var action: TAction;
 begin
     action:= sender as TAction;
- action.Enabled:= getVerbState( action.tag ) = vsEnabled;
+ action.Enabled:= getVerbState(ESVNFea​ture(action.tag)) = vsEnabled;
 end;
 
 procedure TTortoiseSVN.ExecuteAction( sender: TObject );
 var action: TAction;
 begin
     action:= sender as TAction;
- executeVerb( action.tag );
+ executeVerb(ESVNFeat​ure(action.tag));
 end;

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

Messages

Show all messages in topic

svn commit: r18 - branches/SOPTIM/src/tsvnWizard.pas otto_noll Otto Noll 2008-12-18 04:10:44 PST
Messages per page: