⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utype.pas

📁 delphi 写的delphi的程序 Handel is a free, standalone development tool created with Delphi 3 that enable
💻 PAS
📖 第 1 页 / 共 4 页
字号:
      CreateDefaultProject;
   end}
   else
   begin
      SetProjectInfo;
      fProjectSource[0]:= Format('%s %s;',['program',GetNetFileName(ProjName)]);
   end;
end;

procedure TProjectInfo.RenameUnit(OldName,NewName:string);
var
  I:Integer;
  S,S1,S2:string;
begin
   I:= GetStrPos(OldName);
   if I = -1 then Exit;
   S1:= GetNetFileName(OldName);
   S2:= GetNetFileName(NewName);
   S := ProjectSource[I];
   S := ReplaceStr(S, S1, S2);
   S := ReplaceStr(S, OldName, NewName);
   ProjectSource[I]:= S;
end;

// 橇肺璃飘 家胶俊辑 巩磊凯狼 且寸等 蔼(捞抚)阑 倒妨霖促.
function TProjectInfo.GetStrValue(const Str:string):string;
var
  Pos1,Pos2:Integer;
  S:string;
begin
   Pos1  := Pos(':=',Str);
   Pos2  := Pos(';',Str);
   S     := Trim(Copy(Str,Pos1+2,Pos2-Pos1-2));
   Result:= Copy(S,2,Length(S)-2);
end;

procedure TProjectInfo.SetTitle(TitleName:string);
var
   I:Integer;
begin
   I:= GetStrPos('Application.Title');
   if I<>-1 then
   begin
      ProjectSource[I]:='  Application.Title :='+''''+TitleName+''''+';';
      ProjectSource.SaveToFile(ProjectName);
      Exit;
   end;
   I:= GetStrPos('Application.Initialize;');
   if I= -1 then Exit;
   ProjectSource.Insert(I+1,'  Application.Title :='+''''+TitleName+''''+';');
   ProjectSource.SaveToFile(ProjectName);
end;

procedure TProjectInfo.SetHelpFile(HelpName:string);
var
   I:Integer;
begin
   I:=GetStrPos('Application.HelpFile');
   if I<>-1 then
   begin
      ProjectSource[I]:='  Application.HelpFile :='+''''+HelpName+''''+';';
      ProjectSource.SaveToFile(ProjectName);
      Exit;
   end;
   I:= GetStrPos('Application.Initialize;');
   if I= -1 then Exit;
   ProjectSource.Insert(I+1,'  Application.HelpFile :='+''''+HelpName+''''+';');
   ProjectSource.SaveToFile(ProjectName);
end;

// 橇肺璃飘 家胶俊辑 漂沥茄 巩磊凯捞 乐绰 青阑 舅妨霖促.
function TProjectInfo.GetStrPos(const Str:string):Integer;
var
  I:Integer;
begin
   Result:=-1;
   for I:=0 to ProjectSource.Count-1 do
       if Pos(Str,ProjectSource[I])>0 then
       begin
          Result:=I;
          Exit;
       end;
end;

procedure TProjectInfo.SetProjectInfo;
// 橇肺璃飘俊 包茄 沥焊甫 汲沥茄促.
var
   txtFile:TextFile;
   txtLine:string;
   NamePos,FormPos,FormEndPos:integer;
begin
   if not FileExists(fProjectName) then Exit;
   AssignFile(txtFile,fProjectName);
   Reset(txtFile);
   UnitItems.Clear;
   FormItems.Clear;
   ProjectPath:= ExtractFilePath(fProjectName);
   while not EOF(txtFile) do
   begin
      Readln(txtFile,txtLine);
      if Pos('{$R',txtLine)>0 then Break;   // 橇肺璃飘狼 格废阑 葛滴 佬菌栏搁 狐廉唱皑
      NamePos:=Pos(' in',txtLine);           // 蜡聪飘 颇老捞 场唱绰 困摹
      if NamePos>0 then
      begin
         FormPos:=Pos('{',txtLine);         // 汽狼 矫累 困摹
         FormEndPos:=Pos('}',txtLine);      // 汽 颇老狼 场 困摹
         UnitItems.Add(ProjectPath+Trim(Copy(txtLine,1,NamePos-1)+'.pas'));   // 蜡聪飘 格废
         FormItems.Add(Copy(txtLine,FormPos+1,FormEndPos-FormPos-1)); // 汽 格废
      end;
   end;
   CloseFile(txtFile);
   ProjectInfo.ProjectSource.LoadFromFile(ProjectName);
   ProjectInfo.UpdateProject(self);
   ProjectInfo.ProjectState:= psOpen;
end;

function TProjectInfo.GetUniqueUnitName:string;
// 橇肺璃飘俊辑 蜡老茄 蜡聪飘 捞抚阑 倒妨霖促.
var
   I,Count:Integer;
begin
   Result:='Unit1.pas';
   Count:=1;
   if UnitItems.Count<1 then Exit;
   for I:=0 to UnitItems.Count-1 do
   begin
      if Pos('Unit',UnitItems[I])>0 then Inc(Count);
   end;
   Result:='Unit'+IntToStr(Count)+'.pas';
end;

function TProjectInfo.GetUniqueFormName:string;
var
   I,Count:Integer;
begin
   Result:='Form1.dfm';
   Count:=1;
   if FormItems.Count<1 then Exit;
   for I:=0 to FormItems.Count-1 do
   begin
      if Pos('Form',FormItems[I])>0 then Inc(Count);
   end;
   Result:='Form'+IntToStr(Count)+'.dfm';
end;

procedure TProjectInfo.NewForm(var FormName, UnitName:string);
// Add New Form to Project
begin
   UnitName:= ProjectInfo.ProjectPath + GetUniqueUnitName;
   FormName:= GetUniqueFormName;
   UnitItems.Add(UnitName);
   FormItems.Add(ProjectInfo.ProjectPath+FormName);
   ProjectState:= psChange;
end;

procedure TProjectInfo.CreateDefaultProject;
//  Create default project source code
begin
   fProjectSource.Clear;
   with fProjectSource do
   begin
      Add(Format('%s %s;',['program','Project1']));
      Add(' ');
      Add('uses');
   //   Add(' ');
      Add('  Forms,');
   //   Add(Format('%s %s',['  Unit1 in','''Unit1.pas'' {Form1};']));
   //   Add(' ');
      Add('{$R *.RES}');
      Add(' ');
      Add('begin');
      Add('  Application.Initialize;');
      Add('  Application.CreateForm(TForm1,Form1);');
      Add('  Application.Run;');
      Add('end.');
   end;
end;

procedure TProjectInfo.InsertProjectCode(const UnitName,FormName:string);
// Insert unit to project source
var
   I: Integer;
   Temp:string;
begin
   for I:=0 to ProjectSource.Count-1 do
   begin
      if Pos('{$R *.RES}',ProjectSource[I])>0 then Break;
   end;
   // 付瘤阜 蜡聪飘 急攫俊辑 ';'甫 力芭窍绊 , ','肺 措眉
   Temp:=Copy(ProjectSource[I-1],1,Length(ProjectSource[I-1])-1);
   ProjectSource[I-1]:=Temp+',';
   ProjectSource.Insert(I ,Ident+GetNetFileName(UnitName)+' in '+''''+
       ExtractFileName(UnitName)+''''+' {'+GetNetFileName(FormName)+'};');
end;

procedure TProjectInfo.DeleteProjectCode(const UnitName:string);
// Delete unit from project source
var
   I: Integer;
   Temp:string;
begin
   for I:=0 to ProjectSource.Count-1 do
   begin
      if Pos(UnitName,ProjectSource[I])>0 then Break;
   end;
   ProjectSource.Delete(I);
end;

{TExposeComponent}
procedure TExposeComponent.SetDesigning(Value: Boolean);
begin
   inherited SetDesigning(Value);
end;

{TProxyDesigner}
constructor TProxyDesigner.Create(Owner:TForm);
begin
   FGrabList     := TList.Create;
   FMethods      := TStringList.Create;
   FSelectList   := TList.Create;
   FComponentList:= TComponentList.Create;
   FUndoList     := TUndoList.Create;
   Form:= Owner;
   {$IFDEF DELPHI4}
   FForm:= Owner;
   {$ENDIF}
end;

destructor TProxyDesigner.Destroy;
begin
   FGrabList.Free;
   FSelectList.Free;
   FComponentList.Free;
   FMethods.Free;
   FUndoList.Free;
   inherited;
end;

procedure TProxyDesigner.Modified;
begin
  // ProjectInfo.ProjectState := psChange;
   FMainForm.UpdateControl(psChange);
end;

procedure TProxyDesigner.AddInterfaceMember(const MemberText: string);
begin
end;

{$IFDEF DELPHI3}
procedure TProxyDesigner.GetSelections(List: TComponentList);
begin
end;

procedure TProxyDesigner.SetSelections(List: TComponentList);
var
  I: Integer;
begin
   ClearSelectList;
   if List.Count > 1 then FMultiSelected:= True;
   for I:= 0 to List.Count - 1 do
      SelectComponent(List[I]);
   FMultiSelected:= False;
end;

procedure TProxyDesigner.Notification(AComponent: TComponent;
                                      Operation: TOperation);
begin
  { case Operation of
      opInsert:
      begin
        if (AComponent is TGrabHandle) then Exit;
        AddComponentList(AComponent);
      end;
      opRemove:
      begin
        if (AComponent is TGrabHandle) then Exit;
        DeleteComponentList(AComponent);
       // GetComponentList;
      end;
   end;}
end;

{$ENDIF}

procedure TProxyDesigner.DeleteComponentList(Component:TComponent);
begin
   GetComponentList;
end;

procedure TProxyDesigner.GetComponentNames(TypeData: PTypeData; Proc: TGetStrProc);
begin
end;

function TProxyDesigner.GetComponent(const Name: string): TComponent;
begin
   Result:= Form.FindComponent(Name);
end;

function TProxyDesigner.GetObject(const Name: string): TPersistent;
begin
   Result:= nil;
end;

function TProxyDesigner.GetComponentName(Component:TComponent):string;
begin
   Result:=Component.Name;
end;

function TProxyDesigner.GetObjectName(Instance: TPersistent): string;
begin
   Result:= Instance.ClassName;
end;

procedure TProxyDesigner.GetObjectNames(TypeData: PTypeData; Proc: TGetStrProc);
begin
end;

{$IFDEF DELPHI4}
function TProxyDesigner.GetCustomForm: TCustomForm;
begin
   Result:= FForm;
end;

procedure TProxyDesigner.SetCustomForm(Value: TCustomForm);
begin
   FForm:= Value;
   FMethods.Clear;
end;

function TProxyDesigner.GetIsControl: Boolean;
begin
   Result:= False;
end;

procedure TProxyDesigner.SetIsControl(Value: Boolean);
begin
end;

procedure TProxyDesigner.Notification(AnObject: TPersistent; Operation: TOperation);
begin
   case Operation of
      opInsert:
      begin
        if (AnObject is TGrabHandle) then Exit;
        AddComponentList(TComponent(AnObject));
      end;
      opRemove:
      begin
        if (AnObject is TGrabHandle) then Exit;
        DeleteComponentList(TComponent(AnObject));
      end;
   end;
end;

procedure TProxyDesigner.GetSelections(const List: IDesignerSelections);
begin
end;

procedure TProxyDesigner.SetSelections(const List: IDesignerSelections);
var
  I: Integer;
begin
  ClearSelectList;
  if List.Count > 1 then FMultiSelected:= True;
  for I:= 0 to List.Count - 1 do
     SelectComponent(TPersistent(List[I]));
  FMultiSelected:= False;
end;

function TProxyDesigner.IsComponentLinkable(Component: TComponent): Boolean;
begin
   Result:= False;
end;

procedure TProxyDesigner.MakeComponentLinkable(Component: TComponent);
begin
end;

procedure TProxyDesigner.AddToInterface(InvKind: Integer; const Name: string; VT: Word;
   const TypeInfo: string);
begin
end;

procedure TProxyDesigner.GetProjectModules(Proc: TGetModuleProc);
begin
end;

function TProxyDesigner.GetAncestorDesigner: IFormDesigner;
begin
end;

function TProxyDesigner.IsSourceReadOnly: Boolean;
begin
   Result:= False;
end;
{$ENDIF}


function TProxyDesigner.GetRoot: TComponent;
begin
   Result:= nil;
end;

procedure TProxyDesigner.Revert(Instance: TPersistent; PropInfo: PPropInfo);
begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -