From 96ccd451dbd2ed34d8b324283ff9972228cb4415 Mon Sep 17 00:00:00 2001 From: vincents Date: Mon, 29 Sep 2008 10:58:15 +0000 Subject: [PATCH] IDE: add option to print selected text from Michael van Canneyt (issue #12197) git-svn-id: trunk@16790 - --- components/printers/design/ideprinting.pas | 37 +++++++++++++++++-- .../design/languages/ideprinting.de.po | 16 ++++++++ .../design/languages/ideprinting.fi.po | 16 ++++++++ .../design/languages/ideprinting.fr.po | 16 ++++++++ .../design/languages/ideprinting.id.po | 16 ++++++++ .../design/languages/ideprinting.lt.po | 16 ++++++++ .../design/languages/ideprinting.pb.po | 16 ++++++++ .../design/languages/ideprinting.pl.po | 16 ++++++++ .../printers/design/languages/ideprinting.po | 16 ++++++++ .../design/languages/ideprinting.ru.po | 16 ++++++++ 10 files changed, 177 insertions(+), 4 deletions(-) diff --git a/components/printers/design/ideprinting.pas b/components/printers/design/ideprinting.pas index 8b268067f8..22837c3978 100644 --- a/components/printers/design/ideprinting.pas +++ b/components/printers/design/ideprinting.pas @@ -31,10 +31,15 @@ procedure Register; implementation uses - MenuIntf, IDECommands, Dialogs, SrcEditorIntf, SourcePrinter; + MenuIntf, IDECommands, Controls, Forms, Dialogs, SrcEditorIntf, SourcePrinter; resourcestring SDescrPFSelection = 'Print...'; + SPrintSources = 'Print sources'; + SPrintWhat = 'What would you like to print ?'; + SPrintFile = 'Complete file'; + SPrintSelection = 'Selected text'; + var CmdFormatSelection : TIDECommand; @@ -72,12 +77,36 @@ begin end; procedure PrintFile(Sender: TObject); + var sp: TSourcePrinter; + L : TStrings; + R : TModalResult; + begin - sp := TSourcePrinter.Create; - sp.Execute(SourceEditorWindow.ActiveEditor.Lines); - sp.Free; + If Not Assigned(SourceEditorWindow) or Not Assigned(SourceEditorWindow.ActiveEditor) then + Exit; + If (SourceEditorWindow.ActiveEditor.Selection='') then + R:=mrYesToAll + else + R:=QuestionDlg(SPrintSources,SPrintWhat,mtInformation,[mrYesToAll,SPrintFile,mrYes,SPrintSelection,mrCancel],0); + If R=mrCancel then + exit; + L:=TStringList.Create; + try + case R of + mrYesToAll : L.Assign(SourceEditorWindow.ActiveEditor.Lines); + mrYes : L.Text:=SourceEditorWindow.ActiveEditor.Selection; + end; + sp := TSourcePrinter.Create; + try + sp.Execute(L); + finally + sp.Free; + end; + finally + L.Free; + end; end; end. diff --git a/components/printers/design/languages/ideprinting.de.po b/components/printers/design/languages/ideprinting.de.po index 665cdd3cc5..eae21f1684 100644 --- a/components/printers/design/languages/ideprinting.de.po +++ b/components/printers/design/languages/ideprinting.de.po @@ -13,3 +13,19 @@ msgstr "" msgid "Print..." msgstr "Drucken ..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.fi.po b/components/printers/design/languages/ideprinting.fi.po index 7151908ca3..a1cc0d5401 100644 --- a/components/printers/design/languages/ideprinting.fi.po +++ b/components/printers/design/languages/ideprinting.fi.po @@ -8,3 +8,19 @@ msgstr "" msgid "Print..." msgstr "Tulosta..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.fr.po b/components/printers/design/languages/ideprinting.fr.po index 06727bfe22..1ce4eef8f7 100644 --- a/components/printers/design/languages/ideprinting.fr.po +++ b/components/printers/design/languages/ideprinting.fr.po @@ -15,3 +15,19 @@ msgstr "" msgid "Print..." msgstr "Imprimer..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.id.po b/components/printers/design/languages/ideprinting.id.po index 1b5a221483..cff4ddd13f 100644 --- a/components/printers/design/languages/ideprinting.id.po +++ b/components/printers/design/languages/ideprinting.id.po @@ -13,3 +13,19 @@ msgstr "" msgid "Print..." msgstr "" +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.lt.po b/components/printers/design/languages/ideprinting.lt.po index 7bd0c18297..0a79b0a095 100644 --- a/components/printers/design/languages/ideprinting.lt.po +++ b/components/printers/design/languages/ideprinting.lt.po @@ -14,3 +14,19 @@ msgstr "" msgid "Print..." msgstr "Spausdinti..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.pb.po b/components/printers/design/languages/ideprinting.pb.po index 742b39a441..81ad09c24c 100644 --- a/components/printers/design/languages/ideprinting.pb.po +++ b/components/printers/design/languages/ideprinting.pb.po @@ -8,3 +8,19 @@ msgstr "" msgid "Print..." msgstr "Imprimir" +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.pl.po b/components/printers/design/languages/ideprinting.pl.po index 3b7dffe502..36d031da73 100644 --- a/components/printers/design/languages/ideprinting.pl.po +++ b/components/printers/design/languages/ideprinting.pl.po @@ -15,3 +15,19 @@ msgstr "" msgid "Print..." msgstr "Drukuj..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.po b/components/printers/design/languages/ideprinting.po index 4b21f883ac..d6d47626e7 100644 --- a/components/printers/design/languages/ideprinting.po +++ b/components/printers/design/languages/ideprinting.po @@ -8,3 +8,19 @@ msgstr "" msgid "Print..." msgstr "" +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" + diff --git a/components/printers/design/languages/ideprinting.ru.po b/components/printers/design/languages/ideprinting.ru.po index 3f8c7dc0a1..7f910eed3e 100644 --- a/components/printers/design/languages/ideprinting.ru.po +++ b/components/printers/design/languages/ideprinting.ru.po @@ -13,3 +13,19 @@ msgstr "" msgid "Print..." msgstr "Печать..." +#: ideprinting.sprintfile +msgid "Complete file" +msgstr "" + +#: ideprinting.sprintselection +msgid "Selected text" +msgstr "" + +#: ideprinting.sprintsources +msgid "Print sources" +msgstr "" + +#: ideprinting.sprintwhat +msgid "What would you like to print ?" +msgstr "" +