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

📄 umflocalization.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
字号:
{  JADD - Just Another DelphiDoc: Documentation from Delphi Source Code

Copyright (C) 2002-2008   Gerold Veith

This file is part of JADD - Just Another DelphiDoc.

DelphiDoc is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.

DelphiDoc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
}


unit UMFLocalization;

{Contains a simple page with a button to localize the documentation to be
 generated or just to change some texts. There is also a button to open a small
 wizard to change the options of the objects to generate the documentation, not
 exactly the best place, but I don't want to create just another almost empty
 page.
}

interface

uses Classes, Forms, Controls, StdCtrls, Buttons, ExtCtrls, 
     UMainFormFrame,
     UJADDState;

type
  {A simple page with a button to localize the documentation to be generated or
   just to change some texts. There is also a button to open a small wizard to
   change the options of the objects to generate the documentation, not exactly
   the best place, but I don't want to create just another almost empty page. }
  TMFLocalization = class(TMainFormFrame)
    ButtonLocalization: TButton;
    BitBtnWizard: TBitBtn;
    LabelPredefinedLanguage: TLabel;
    ComboBoxPredefinedLanguage: TComboBox;
    procedure ButtonLocalizationClick(Sender: TObject);
    procedure ComboBoxPredefinedLanguageChange(Sender: TObject);
    procedure BitBtnWizardClick(Sender: TObject);
  private
  protected
    //Called when the generator changes.
    procedure StateGeneratorChanged(State: TJADDState); override;
  public
    //Loads the available predefined languages.
    constructor Create(Parent: TWinControl; State: TJADDState); override;
  end;


implementation

{$R *.dfm}

uses UDocumentationTexts,
     UWizard, UOptionsWizard,
     UCatExpert;




{Loads the available predefined languages.
~param Parent the component to show the frame in, preferably a TPanel or a
              similar component
~param State  the state of the program }
constructor TMFLocalization.Create(Parent: TWinControl; State: TJADDState);
begin
 inherited Create(Parent, State);        //create the frame/page

 //get names of all available languages
 AddRegisteredLanguages(ComboBoxPredefinedLanguage.Items);
end;



{Called when the generator changes.
~param State the state that has been changed }
procedure TMFLocalization.StateGeneratorChanged(State: TJADDState);
begin
 //only show wizard, if options available to edit
 BitBtnWizard.Enabled := State.Generate.GeneratorUsesCommentEvaluators;
end;




{Called when the button to edit the texts for the generators, for localization
 etc., is chosen.
~param Sender the sender of the event, ~[link ButtonLocalization] }
procedure TMFLocalization.ButtonLocalizationClick(Sender: TObject);
var       Opt      :TDocumentationTextOptionWrapper;  //editor for the texts
begin
 Opt := TDocumentationTextOptionWrapper.Create;       //create editor
 try
   EditOptionsByCategory(Opt);                        //edit the texts
 finally
  Opt.Free;                                           //free editor
 end;
 ComboBoxPredefinedLanguage.ItemIndex := 0;           //deselect language
end;

{Called when a new button to edit the texts for the generators, for localization
 etc., is chosen.
~param Sender the sender of the event, ~[link ButtonLocalization] }
procedure TMFLocalization.ComboBoxPredefinedLanguageChange(Sender: TObject);
var       Opt      :TDocumentationTextOptionWrapper; //editor for the texts
begin
 if ComboBoxPredefinedLanguage.ItemIndex <> 0 then   //valid language selected?
  begin
   Opt := TDocumentationTextOptionWrapper.Create;      //create editor
   try
     Opt.SetOptionByName('Language',                   //set the language
                         ComboBoxPredefinedLanguage.Items[
                                        ComboBoxPredefinedLanguage.ItemIndex]);
   finally
    Opt.Free;                                          //free editor
   end;
  end;
end;

{Called when the button to show the wizard is pressed.
~param Sender the sender of the event, ~[link BitBtnWizard] }
procedure TMFLocalization.BitBtnWizardClick(Sender: TObject);
begin
 ShowWizard(Self, TGeneratorOptionsWizard, State.Generate);  //show the wizard
end;

end.

⌨️ 快捷键说明

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