[Initranslator-svncheckins] SF.net SVN: initranslator: [80] translator/trunk/src
Brought to you by:
peter3
|
From: <pe...@us...> - 2006-08-04 21:42:06
|
Revision: 80 Author: peter3 Date: 2006-08-04 14:41:52 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/initranslator/?rev=80&view=rev Log Message: ----------- - New tool plugin to view all properties of the translation items Added Paths: ----------- translator/trunk/src/ToolPropertiesView/ translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dof translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dpr translator/trunk/src/ToolPropertiesView/ToolPropertiesView.res translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.dfm translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.pas translator/trunk/src/ToolPropertiesView/ToolPropertiesViewImpl.pas Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dof =================================================================== --- translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dof (rev 0) +++ translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dof 2006-08-04 21:41:52 UTC (rev 80) @@ -0,0 +1,41 @@ +[Compiler] +UnsafeType=0 +UnsafeCode=0 +UnsafeCast=0 +[Linker] +MapFile=3 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +[Directories] +OutputDir=..\..\bin\plugins +UnitOutputDir=..\..\dcu +[Version Info] +IncludeVerInfo=1 +AutoIncBuild=1 +MajorVer=1 +MinorVer=9 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=1 +Locale=1053 +CodePage=1252 +[Version Info Keys] +CompanyName=IniTranslator +FileDescription=Tool Property Viewer Plugin for IniTranslator +FileVersion=1.9.0.0 +InternalName=ToolPropertiesView.dll +LegalCopyright=Copyright (c) 2006 by Peter Th\xF6rnqvist; all rights reserved +LegalTrademarks= +OriginalFilename=ToolPropertiesView.dll +ProductName=Tool Property Viewer Plugin for IniTranslator +ProductVersion=1.9.0.12 +Commments=Latest version available at http://initranslator.sourceforge.net \ No newline at end of file Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dpr =================================================================== --- translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dpr (rev 0) +++ translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dpr 2006-08-04 21:41:52 UTC (rev 80) @@ -0,0 +1,39 @@ +{@abstract(Tool plugin to view all properties of the items) } +{ + Copyright \xA9 2003-2006 by Peter Thornqvist; all rights reserved + + Developer(s): + p3 - peter3 att users dott sourceforge dott net + + Status: + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. +} + +// $Id$ +library ToolPropertiesView; + +uses + SysUtils, + Classes, + TransIntf in '..\TransIntf.pas', + ToolPropertiesViewImpl in 'ToolPropertiesViewImpl.pas', + ToolPropertiesViewFrm in 'ToolPropertiesViewFrm.pas' {frmToolPropertiesView: TTntForm}; + +{$R *.res} + +function InstallPlugin(out ToolItems: IToolItems): HResult; stdcall; +begin + ToolItems := TToolPropertiesViewPlugins.Create; + Result := S_OK; +end; + +exports InstallPlugin name cRegisterTransToolItemsFuncName; + +begin +end. Property changes on: translator/trunk/src/ToolPropertiesView/ToolPropertiesView.dpr ___________________________________________________________________ Name: svn:keywords + LastChangedDate Rev LastChangedBy URL Id Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesView.res =================================================================== (Binary files differ) Property changes on: translator/trunk/src/ToolPropertiesView/ToolPropertiesView.res ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.dfm =================================================================== --- translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.dfm (rev 0) +++ translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.dfm 2006-08-04 21:41:52 UTC (rev 80) @@ -0,0 +1,91 @@ +object frmToolPropertiesView: TfrmToolPropertiesView + Left = 460 + Top = 210 + Width = 699 + Height = 514 + Caption = 'View all properties' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Shell Dlg 2' + Font.Style = [] + OldCreateOrder = False + Position = poDesktopCenter + PixelsPerInch = 96 + TextHeight = 13 + object TntStatusBar1: TTntStatusBar + Left = 0 + Top = 468 + Width = 691 + Height = 19 + Panels = < + item + Width = 50 + end> + end + object lvItems: TTntListView + Left = 0 + Top = 0 + Width = 691 + Height = 468 + Align = alClient + BevelKind = bkFlat + BorderStyle = bsNone + Columns = < + item + Caption = 'Index' + end + item + Caption = 'Original' + Width = 100 + end + item + Caption = 'Translation' + Width = 100 + end + item + Caption = 'OrigComments' + Width = 100 + end + item + Caption = 'TransComments' + Width = 100 + end + item + Caption = 'PreData' + Width = 100 + end + item + Caption = 'PostData' + Width = 100 + end + item + Caption = 'OrigQuote' + Width = 70 + end + item + Caption = 'TransQuote' + Width = 70 + end + item + Caption = 'PrivateStorage' + Width = 100 + end + item + Caption = 'ClearOriginal' + Width = 100 + end + item + Caption = 'ClearTranslation' + Width = 100 + end> + GridLines = True + OwnerData = True + ReadOnly = True + RowSelect = True + TabOrder = 1 + ViewStyle = vsReport + OnData = lvItemsData + end +end Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.pas =================================================================== --- translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.pas (rev 0) +++ translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.pas 2006-08-04 21:41:52 UTC (rev 80) @@ -0,0 +1,81 @@ +unit ToolPropertiesViewFrm; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, TntForms, TransIntf, ComCtrls, TntComCtrls; + +type + TfrmToolPropertiesView = class(TTntForm) + TntStatusBar1: TTntStatusBar; + lvItems: TTntListView; + procedure lvItemsData(Sender: TObject; Item: TListItem); + private + { Private declarations } + FItems: ITranslationItems; + procedure LoadItems(const Items: ITranslationItems); + procedure RefreshView; + public + { Public declarations } + class function Execute(const Items, Orphans: ITranslationItems; var SelectedITem: ITranslationItem): Boolean; + end; + +implementation + +{$R *.DFM} + +{ TfrmToolPropertiesView } + +class function TfrmToolPropertiesView.Execute(const Items, + Orphans: ITranslationItems; var SelectedITem: ITranslationItem): Boolean; +var frm: TfrmToolPropertiesView; +begin + frm := self.Create(Application); + try + frm.LoadItems(Items); + frm.ShowModal; + Result := false; // no changes + finally + frm.Free; + end; +end; + +procedure TfrmToolPropertiesView.LoadItems(const Items: ITranslationItems); +begin + FItems := Items; + RefreshView; +end; + +procedure TfrmToolPropertiesView.RefreshView; +begin + if FItems <> nil then + lvItems.Items.Count := FItems.Count + else + lvItems.Items.Count := 0; + TntStatusBar1.Panels[0].Text := WideFormat(' %d item(s) in list',[lvItems.Items.Count]); +end; + +procedure TfrmToolPropertiesView.lvItemsData(Sender: TObject; + Item: TListItem); +begin + if (FItems <> nil) and (Item.Index >= 0) and (Item.Index < FItems.Count) then + with TTntListItem(Item) do + begin + Caption := IntToStr(FItems[Index].Index); + SubItems.Add(FItems[Index].Original); + SubItems.Add(FItems[Index].Translation); + SubItems.Add(FItems[Index].OrigComments); + SubItems.Add(FItems[Index].TransComments); + SubItems.Add(FItems[Index].PreData); + SubItems.Add(FItems[Index].PostData); + SubItems.Add(FItems[Index].OrigQuote); + SubItems.Add(FItems[Index].TransQuote); + SubItems.Add(FItems[Index].PrivateStorage); + SubItems.Add(FItems[Index].ClearOriginal); + SubItems.Add(FItems[Index].ClearTranslation); + end; +end; + +end. + Property changes on: translator/trunk/src/ToolPropertiesView/ToolPropertiesViewFrm.pas ___________________________________________________________________ Name: svn:keywords + LastChangedDate Rev LastChangedBy URL Id Added: translator/trunk/src/ToolPropertiesView/ToolPropertiesViewImpl.pas =================================================================== --- translator/trunk/src/ToolPropertiesView/ToolPropertiesViewImpl.pas (rev 0) +++ translator/trunk/src/ToolPropertiesView/ToolPropertiesViewImpl.pas 2006-08-04 21:41:52 UTC (rev 80) @@ -0,0 +1,123 @@ +{@abstract(Implementation if ToolPropertiesView) } +{ + Copyright \xA9 2003-2006 by Peter Thornqvist; all rights reserved + + Developer(s): + p3 - peter3 att users dott sourceforge dott net + + Status: + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. +} + +// $Id$ +unit ToolPropertiesViewImpl; + +interface +uses + Classes, TransIntf; + +type + TToolPropertiesViewPlugins = class(TInterfacedObject, IInterface, IToolItems) + public + function Count: Integer; safecall; + function ToolItem(Index: Integer; out ToolItem: IToolItem): HRESULT; safecall; + end; + + TToolPropertiesViewPlugin = class(TInterfacedObject, IInterface, IToolItem) + private + FOldAppHandle:Cardinal; + public + + function About: WideString; safecall; + function DisplayName: WideString; safecall; + function Execute(const Items: ITranslationItems; + const Orphans: ITranslationItems; + var SelectedItem: ITranslationItem): HRESULT; safecall; + function Icon: Cardinal; safecall; + procedure Init(AppHandle: Cardinal); safecall; + function Status(const Items: ITranslationItems; + const Orphans: ITranslationItems; + const SelectedItem: ITranslationItem): Integer; safecall; + destructor Destroy; override; + + end; + +implementation +uses + Forms, ToolPropertiesViewFrm; + +{ TToolPropertiesViewPlugins } + +function TToolPropertiesViewPlugins.Count: Integer; +begin + Result := 1; +end; + +function TToolPropertiesViewPlugins.ToolItem(Index: Integer; + out ToolItem: IToolItem): HRESULT; +begin + if Index = 0 then + begin + ToolItem := TToolPropertiesViewPlugin.Create; + Result := S_OK; + end + else + Result := S_FALSE; +end; + +{ TToolPropertiesViewPlugin } + +function TToolPropertiesViewPlugin.About: WideString; +begin + Result := 'Plugin to display all properties of the translation items'; +end; + +destructor TToolPropertiesViewPlugin.Destroy; +begin + if FOldAppHandle <> 0 then + Application.Handle := FOldAppHandle; + inherited Destroy; +end; + +function TToolPropertiesViewPlugin.DisplayName: WideString; +begin + Result := 'View all properties'; +end; + +function TToolPropertiesViewPlugin.Execute(const Items, + Orphans: ITranslationItems; var SelectedItem: ITranslationItem): HRESULT; +begin + if TfrmToolPropertiesView.Execute(Items, Orphans, SelectedItem) then + Result := S_OK + else + Result := S_FALSE; +end; + +function TToolPropertiesViewPlugin.Icon: Cardinal; +begin + Result := 0; +end; + +procedure TToolPropertiesViewPlugin.Init(AppHandle: Cardinal); +begin + if FOldAppHandle = 0 then + FOldAppHandle := Application.Handle; + Application.Handle := AppHandle; +end; + +function TToolPropertiesViewPlugin.Status(const Items, + Orphans: ITranslationItems; + const SelectedItem: ITranslationItem): Integer; +begin + Result := TOOL_VISIBLE; + if Items.Count > 0 then + Result := Result or TOOL_ENABLED; +end; + +end. Property changes on: translator/trunk/src/ToolPropertiesView/ToolPropertiesViewImpl.pas ___________________________________________________________________ Name: svn:keywords + LastChangedDate Rev LastChangedBy URL Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |