From 3dd19fc92b22f39d7e75a47cb433c6c7ab448675 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 30 Jan 2010 15:54:37 +0000 Subject: [PATCH] jcf: store and load settings file from the IDE primary config path git-svn-id: trunk@23601 - --- .gitattributes | 2 +- JCFSettings.cfg | 184 ------------------ .../jcf2/IdePlugin/lazarus/jcfideregister.pas | 42 +++- .../jcf2/IdePlugin/lazarus/jcfsettings.lpi | 170 ++++++++++++++++ .../jcf2/Settings/JcfRegistrySettings.pas | 6 +- 5 files changed, 215 insertions(+), 189 deletions(-) delete mode 100644 JCFSettings.cfg create mode 100644 components/jcf2/IdePlugin/lazarus/jcfsettings.lpi diff --git a/.gitattributes b/.gitattributes index 1dcd6ea9da..2cf4e4ad68 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,6 @@ /COPYING.LGPL.txt svneol=native#text/plain /COPYING.modifiedLGPL.txt -text svneol=unset#application/octet-stream /COPYING.txt svneol=native#text/plain -/JCFSettings.cfg svneol=native#text/xml /README.txt svneol=native#text/plain components/README.txt svneol=native#text/plain components/aggpas/Agg2DDemo.dpr svneol=native#text/plain @@ -945,6 +944,7 @@ components/jcf2/IdePlugin/lazarus/jcfidelazarus.lpk svneol=native#text/plain components/jcf2/IdePlugin/lazarus/jcfidelazarus.pas svneol=native#text/pascal components/jcf2/IdePlugin/lazarus/jcfidemain.pas svneol=native#text/pascal components/jcf2/IdePlugin/lazarus/jcfideregister.pas svneol=native#text/pascal +components/jcf2/IdePlugin/lazarus/jcfsettings.lpi svneol=native#text/plain components/jcf2/Include/JcfGlobal.inc svneol=native#text/plain components/jcf2/JCF.ico -text svneol=unset#image/ico components/jcf2/JCFAllD11.bpg svneol=native#text/plain diff --git a/JCFSettings.cfg b/JCFSettings.cfg deleted file mode 100644 index 06e8250095..0000000000 --- a/JCFSettings.cfg +++ /dev/null @@ -1,184 +0,0 @@ - - - 2.44 - 40160.959233287 - format settings for use with Lazarus - - False - 1 - True - True - True - True - - - 0 - True - False - Sender - dpr,lpr,pas,pp - - - 2 - 0 - False - False - 2 - True - False - True - True - True - True - False - True - False - False - - - True - False - 2 - 2 - True - False - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 2 - True - 0 - False - False - False - False - False - False - - - 2 - 90 - 1 - True - True - False - False - True - True - True - True - True - True - True - 1 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - 1 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - True - 4 - 1 - 1 - - - True - True - - - True - 1 - 1 - 1 - 1 - 1 - - - True - - - - True - ActivePage,AnsiCompareStr,AnsiCompareText,AnsiUpperCase,AsBoolean,AsDateTime,AsFloat,AsInteger,Assign,AsString,AsVariant,BeginDrag,Buttons,Caption,Checked,Classes,ClassName,Clear,Close,Components,Controls,Count,Create,Data,Dec,Delete,Destroy,Dialogs,Enabled,EndDrag,EOF,Exception,Execute,False,FieldByName,First,Forms,Free,FreeAndNil,GetFirstChild,Graphics,Height,idAbort,idCancel,idIgnore,IDispatch,idNo,idOk,idRetry,idYes,Inc,Initialize,IntToStr,ItemIndex,IUnknown,Lines,Math,MaxValue,mbAbort,mbAll,mbCancel,mbHelp,mbIgnore,mbNo,mbOK,mbRetry,mbYes,mbYesToAll,Messages,MinValue,mnNoToAll,mrAbort,mrAll,mrCancel,mrIgnore,mrNo,mrNone,mrNoToAll,mrOk,mrRetry,mrYes,mrYesToAll,mtConfirmation,mtCustom,mtError,mtInformation,mtWarning,Name,Next,Open,Ord,ParamStr,PChar,Perform,ProcessMessages,Read,ReadOnly,RecordCount,Register,Release,Result,Sender,SetFocus,Show,ShowMessage,Source,StdCtrls,StrToInt,SysUtils,TAutoObject,TButton,TComponent,TDataModule,Text,TForm,TFrame,TList,TNotifyEvent,TObject,TObjectList,TPageControl,TPersistent,True,TStringList,TStrings,TTabSheet,Unassigned,Value,Visible,WideString,Width,Windows,Write - - - True - False,Name,nil,PChar,read,ReadOnly,True,WideString,write - - - True - ActnColorMaps,ActnCtrls,ActnList,ActnMan,ActnMenus,ActnPopup,ActnRes,ADOConst,ADODB,ADOInt,AppEvnts,AxCtrls,BandActn,bdeconst,bdemts,Buttons,CheckLst,Classes,Clipbrd.pas,CmAdmCtl,ComCtrls,ComStrs,Consts,Controls,CtlConsts,CtlPanel,CustomizeDlg,DataBkr,DB,DBActns,dbcgrids,DBClient,DBClientActnRes,DBClientActns,DBCommon,DBConnAdmin,DBConsts,DBCtrls,DbExcept,DBGrids,DBLocal,DBLocalI,DBLogDlg,dblookup,DBOleCtl,DBPWDlg,DBTables,DBXpress,DdeMan,Dialogs,DrTable,DSIntf,ExtActns,ExtCtrls,ExtDlgs,FileCtrl,FMTBcd,Forms,Graphics,GraphUtil,Grids,HTTPIntr,IB,IBBlob,IBCustomDataSet,IBDatabase,IBDatabaseInfo,IBDCLConst,IBErrorCodes,IBEvents,IBExternals,IBExtract,IBGeneratorEditor,IBHeader,IBIntf,IBQuery,IBRestoreEditor,IBSecurityEditor,IBServiceEditor,IBSQL,IBSQLMonitor,IBStoredProc,IBTable,IBUpdateSQL,IBUtils,IBXConst,ImgList,Jcl8087,JclAbstractContainers,JclAlgorithms,JclAnsiStrings,JclAppInst,JclArrayLists,JclArraySets,JclBase,JclBinaryTrees,JclBorlandTools,JclCIL,JclCLR,JclCOM,JclComplex,JclCompression,JclConsole,JclContainerIntf,JclCounter,JclDateTime,JclDebug,JclDotNet,JclEDI,JclEDI_ANSIX12,JclEDI_ANSIX12_Ext,JclEDI_UNEDIFACT,JclEDI_UNEDIFACT_Ext,JclEDISEF,JclEDITranslators,JclEDIXML,JclExprEval,JclFileUtils,JclFont,JclGraphics,JclGraphUtils,JclHashMaps,JclHashSets,JclHookExcept,JclIniFiles,JclLANMan,JclLinkedLists,JclLocales,JclLogic,JclMapi,JclMath,JclMetadata,JclMIDI,JclMime,JclMiscel,JclMsdosSys,JclMultimedia,JclNTFS,JclPCRE,JclPeImage,JclPrint,JclQGraphics,JclQGraphUtils,JclQueues,JclRegistry,JclResources,JclRTTI,JclSchedule,JclSecurity,JclShell,JclSimpleXml,JclStacks,JclStatistics,JclStreams,JclStrHashMap,JclStringLists,JclStrings,JclStructStorage,JclSvcCtrl,JclSynch,JclSysInfo,JclSysUtils,JclTask,JclTD32,JclUnicode,JclUnitConv,JclUnitVersioning,JclUnitVersioningProviders,JclValidation,JclVectors,JclWideFormat,JclWideStrings,JclWin32,JclWin32Ex,JclWinMIDI,ListActns,Mask,MConnect,Menus,Midas,MidasCon,MidConst,MPlayer,MtsRdm,Mxconsts,ObjBrkr,OleAuto,OleConst,OleCtnrs,OleCtrls,OleDB,OleServer,Outline,Printers,Provider,recerror,ScktCnst,ScktComp,ScktMain,SConnect,ShadowWnd,SimpleDS,SMINTF,SqlConst,SqlExpr,SqlTimSt,StdActnMenus,StdActns,StdCtrls,StdStyleActnCtrls,SvcMgr,SysUtils,TabNotBk,Tabs,TConnect,Themes,ToolWin,ValEdit,VDBConsts,WinHelpViewer,XPActnCtrls,XPMan,XPStyleActnCtrls - - - 0 - 1 - True - True - 7 - True - 15 - - - False - MSWINDOWS - - - - False - False - False - False - False - False - False - 2 - 60 - 5 - 5 - 0 - - - False - - - - False - False - False - False - - - - - - - - 1 - True - False - False - False - False - False - 0 - False - - diff --git a/components/jcf2/IdePlugin/lazarus/jcfideregister.pas b/components/jcf2/IdePlugin/lazarus/jcfideregister.pas index d06e6513c4..e5b9c7093e 100644 --- a/components/jcf2/IdePlugin/lazarus/jcfideregister.pas +++ b/components/jcf2/IdePlugin/lazarus/jcfideregister.pas @@ -36,7 +36,7 @@ uses { rtl } SysUtils, Classes, { lcl } - LCLType; + LCLType, FileUtil, LResources; procedure Register; @@ -44,9 +44,9 @@ implementation uses { lazarus } - MenuIntf, IdeCommands, + LazIDEIntf, MenuIntf, IdeCommands, { local } - JcfIdeMain; + JcfIdeMain, JcfRegistrySettings; const FORMAT_MENU_NAME = 'jcfJEDICodeFormat'; @@ -70,8 +70,40 @@ resourcestring FORMAT_ABOUT_MENU = '&About'; FORMAT_CATEGORY = 'JEDI Code Format'; +const + DefaultJCFOptsFile = 'jcfsettings.cfg'; + var lcJCFIDE: TJcfIdeMain; + JCFOptsFile: String; + +function IDEGetDefaultSettingsFileName: String; +begin + Result := JCFOptsFile; +end; + +procedure SetLazarusDefaultFileName; +var + R: TLResource; + S: TFileStream; +begin + JCFOptsFile := SetDirSeparators(LazarusIDE.GetPrimaryConfigPath + '/' + DefaultJCFOptsFile); + LazarusIDE.CopySecondaryConfigFile(DefaultJCFOptsFile); + if not FileExistsUTF8(JCFOptsFile) then + begin + // create default + R := LazarusResources.Find('JCFSettings', 'CFG'); + if (R <> nil) and (R.Value <> '') then + begin + S := TFileStream.Create(UTF8ToSys(JCFOptsFile), fmCreate); + try + S.Write(R.Value[1], Length(R.Value)); + finally + S.Free; + end; + end; + end; +end; procedure Register; var @@ -80,6 +112,9 @@ var fcMainMenu, SubSection: TIDEMenuSection; CmdFormatFile: TIDECommand; begin + SetLazarusDefaultFileName; + GetDefaultSettingsFileName := IDEGetDefaultSettingsFileName; + Cat := IDECommandList.CreateCategory(nil, FORMAT_CATEGORY_NAME, FORMAT_CATEGORY, IDECmdScopeSrcEditOnly); // Ctrl + D ? @@ -113,6 +148,7 @@ end; initialization + {$I jcfsettings.lpi} lcJCFIDE := TJcfIdeMain.Create; finalization diff --git a/components/jcf2/IdePlugin/lazarus/jcfsettings.lpi b/components/jcf2/IdePlugin/lazarus/jcfsettings.lpi new file mode 100644 index 0000000000..c13239b085 --- /dev/null +++ b/components/jcf2/IdePlugin/lazarus/jcfsettings.lpi @@ -0,0 +1,170 @@ +LazarusResources.Add('JCFSettings','CFG',[ + ''#13#10''#13#10' 2.44 '#13#10' 40208.0415705324 '#13#10' format settings for use with Lazarus <' + +'/Description>'#13#10' '#13#10' False ' + +#13#10' 1 '#13#10' True '#13#10' True '#13#10' ' + +' True '#13#10' True '#13#10' '#13#10' '#13#10' 0 '#13#10' True '#13#10' False '#13#10' S' + +'ender '#13#10' dpr,lpr,pas,pp '#13#10' '#13#10' '#13#10' 2 '#13#10' 0 '#13#10' False '#13#10' False '#13#10' 2 '#13#10' True '#13#10' False '#13#10' True '#13#10' True ' + +''#13#10' True '#13#10' True '#13#10' ' + +'False '#13#10' True '#13 + +#10' False '#13#10' False '#13#10' ' + +#13#10' '#13#10' True '#13#10' ' + +' False '#13#10' 2 '#13#10' 2 '#13#10' True '#13#10' False <' + +'/SpaceBeforeClassHeritage>'#13#10' 0 '#13#10' 0 '#13#10' 0 '#13 + +#10' 0 '#13#10' 0 '#13#10' 0 '#13#10' 0 '#13#10' 0 '#13#10' 0 '#13#10' ' + +' 2 '#13#10' True '#13#10' 0 '#13#10' ' + +' False '#13#10' False '#13#10' False '#13#10' False '#13#10' False '#13#10' False '#13 + +#10' '#13#10' '#13#10' 2 '#13#10' 90 '#13#10' ' + +' 1 '#13#10' True '#13#10' True '#13#10' False '#13#10 + +' False '#13#10' True '#13#10' ' + +'True '#13#10' True '#13#10' True '#13#10' True '#13#10' ' + +' True '#13#10' True '#13#10' ' + +'1 '#13#10' 0 '#13#10' '#13#10' 1 '#13#10' 1 '#13#10' 1 '#13#10' 0 '#13#10' 0 '#13#10 + +' 0 '#13#10' 1 '#13#10' ' + ,' 0 '#13#10' 1 '#13#10' 0 '#13#10' 1 ' + +''#13#10' 1 '#13#10' 0 '#13#10' 1 '#13#10' 0 '#13 + +#10' True ' + +#13#10' 4 '#13#10 + +' 1 '#13#10' 1 '#13#10' '#13#10' ' + +''#13#10' True '#13#10' True '#13#10' '#13#10' ' + +#13#10' True '#13#10' 1 '#13#10' 1 '#13#10' 1 '#13#10' 1 '#13#10' 1 '#13#10' '#13#10' '#13#10 + +' True '#13#10' '#13#10' '#13#10' '#13#10' True '#13#10' ActivePage,AnsiCompareStr,AnsiCompareText,AnsiUppe' + +'rCase,AsBoolean,AsDateTime,AsFloat,AsInteger,Assign,AsString,AsVariant,Begi' + +'nDrag,Buttons,Caption,Checked,Classes,ClassName,Clear,Close,Components,Cont' + +'rols,Count,Create,Data,Dec,Delete,Destroy,Dialogs,Enabled,EndDrag,EOF,Excep' + +'tion,Execute,False,FieldByName,First,Forms,Free,FreeAndNil,GetFirstChild,Gr' + +'aphics,Height,idAbort,idCancel,idIgnore,IDispatch,idNo,idOk,idRetry,idYes,I' + +'nc,Initialize,IntToStr,ItemIndex,IUnknown,Lines,Math,MaxValue,mbAbort,mbAll' + +',mbCancel,mbHelp,mbIgnore,mbNo,mbOK,mbRetry,mbYes,mbYesToAll,Messages,MinVa' + +'lue,mnNoToAll,mrAbort,mrAll,mrCancel,mrIgnore,mrNo,mrNone,mrNoToAll,mrOk,mr' + +'Retry,mrYes,mrYesToAll,mtConfirmation,mtCustom,mtError,mtInformation,mtWarn' + +'ing,Name,Next,Open,Ord,ParamStr,PChar,Perform,ProcessMessages,Read,ReadOnly' + +',RecordCount,Register,Release,Result,Sender,SetFocus,Show,ShowMessage,Sourc' + +'e,StdCtrls,StrToInt,SysUtils,TAutoObject,TButton,TComponent,TDataModule,Tex' + +'t,TForm,TFrame,TList,TNotifyEvent,TObject,TObjectList,TPageControl,TPersist' + +'ent,True,TStringList,TStrings,TTabSheet,Unassigned,Value,Visible,WideString' + +',Width,Windows,Write '#13#10' '#13#10' ' + +#13#10' True '#13#10' False,Name,nil,P' + +'Char,read,ReadOnly,True,WideString,write '#13#10' '#13 + +#10' '#13#10' True '#13#10' ActnColorMaps,ActnCtrls,ActnList,ActnMan,ActnMenus,ActnPopup,ActnRes,A' + +'DOConst,ADODB,ADOInt,AppEvnts,AxCtrls,BandActn,bdeconst,bdemts,Buttons,Chec' + +'kLst,Classes,Clipbrd.pas,CmAdmCtl,ComCtrls,ComStrs,Consts,Controls,CtlConst' + +'s,CtlPanel,CustomizeDlg,DataBkr,DB,DBActns,dbcgrids,DBClient,DBClientActnRe' + +'s,DBClientActns,DBCommon,DBConnAdmin,DBConsts,DBCtrls,DbExcept,DBGrids,DBLo' + +'cal,DBLocalI,DBLogDlg,dblookup,DBOleCtl,DBPWDlg,DBTables,DBXpress,DdeMan,Di' + +'alogs,DrTable,DSIntf,ExtActns,ExtCtrls,ExtDlgs,FileCtrl,FMTBcd,Forms,Graphi' + +'cs,GraphUtil,Grids,HTTPIntr,IB,IBBlob,IBCustomDataSet,IBDatabase,IBDatabase' + +'Info,IBDCLConst,IBErrorCodes,IBEvents,IBExternals,IBExtract,IBGeneratorEdit' + +'or,IBHeader,IBIntf,IBQuery,IBRestoreEditor,IBSecurityEditor,IBServiceEditor' + +',IBSQL,IBSQLMonitor,IBStoredProc,IBTable,IBUpdateSQL,IBUtils,IBXConst,ImgLi' + +'st,Jcl8087,JclAbstractContainers,JclAlgorithms,JclAnsiStrings,JclAppInst,Jc' + +'lArrayLists,JclArraySets,JclBase,JclBinaryTrees,JclBorlandTools,JclCIL,JclC' + +'LR,JclCOM,JclComplex,JclCompression,JclConsole,JclContainerIntf,JclCounter,' + +'JclDateTime,JclDebug,JclDotNet,JclEDI,JclEDI_ANSIX12,JclEDI_ANSIX12_Ext,Jcl' + +'EDI_UNEDIFACT,JclEDI_UNEDIFACT_Ext,JclEDISEF,JclEDITranslators,JclEDIXML,Jc' + +'lExprEval,JclFileUtils,JclFont,JclGraphics,JclGraphUtils,JclHashMaps,JclHas' + +'hSets,JclHookExcept,JclIniFiles,JclLANMan,JclLinkedLists,JclLocales,JclLogi' + +'c,JclMapi,JclMath,JclMetadata,JclMIDI,JclMime,JclMiscel,JclMsdosSys,JclMult' + +'imedia,JclNTFS,JclPCRE,JclPeImage,JclPrint,JclQGraphics,JclQGraphUtils,JclQ' + +'ueues,JclRegistry,JclResources,JclRTTI,JclSchedule,JclSecurity,JclShell,Jcl' + +'SimpleXml,JclStacks,JclStatistics,JclStreams,JclStrHashMap,JclStringLists,J' + +'clStrings,JclStructStorage,JclSvcCtrl,JclSynch,JclSysInfo,JclSysUtils,JclTa' + +'sk,JclTD32,JclUnicode,JclUnitConv,JclUnitVersioning,JclUnitVersioningProvid' + +'ers,JclValidation,JclVectors,JclWideFormat,JclWideStrings,JclWin32,JclWin32' + ,'Ex,JclWinMIDI,ListActns,Mask,MConnect,Menus,Midas,MidasCon,MidConst,MPlayer' + +',MtsRdm,Mxconsts,ObjBrkr,OleAuto,OleConst,OleCtnrs,OleCtrls,OleDB,OleServer' + +',Outline,Printers,Provider,recerror,ScktCnst,ScktComp,ScktMain,SConnect,Sha' + +'dowWnd,SimpleDS,SMINTF,SqlConst,SqlExpr,SqlTimSt,StdActnMenus,StdActns,StdC' + +'trls,StdStyleActnCtrls,SvcMgr,SysUtils,TabNotBk,Tabs,TConnect,Themes,ToolWi' + +'n,ValEdit,VDBConsts,WinHelpViewer,XPActnCtrls,XPMan,XPStyleActnCtrls '#13#10' '#13#10' '#13#10' 0 '#13 + +#10' 1 '#13#10' True '#13#10' True '#13#10' 7 '#13#10' True '#13#10' 15 '#13#10' '#13#10 + +' '#13#10' False '#13#10' MSWINDOWS '#13#10' '#13#10' '#13#10' '#13#10' False '#13#10' False ' + +#13#10' False '#13#10' F' + +'alse '#13#10' False '#13#10 + +' False '#13#10' False' + +' '#13#10' 2 '#13#10' 60 '#13#10' 5 '#13#10 + +' 5 '#13#10' 0 '#13#10' '#13#10' '#13#10' False '#13#10' '#13#10' '#13#10' '#13#10' False ' + +''#13#10' False '#13#10' False '#13#10' False '#13#10' '#13#10' '#13#10' ' + +#13#10' '#13#10' '#13#10' '#13#10' '#13#10' 1 ' + +#13#10' True '#13#10' ' + +' False '#13#10' False '#13#10' Fa' + +'lse '#13#10' False '#13#10' False '#13#10' 0 '#13#10' ' + +' False '#13#10' ' + +#13#10''#13#10 +]); diff --git a/components/jcf2/Settings/JcfRegistrySettings.pas b/components/jcf2/Settings/JcfRegistrySettings.pas index 9ae13072fa..9ae75d2186 100644 --- a/components/jcf2/Settings/JcfRegistrySettings.pas +++ b/components/jcf2/Settings/JcfRegistrySettings.pas @@ -184,6 +184,9 @@ type function GetRegSettings: TJCFRegistrySettings; +var + GetDefaultSettingsFileName: function: String; + implementation uses @@ -231,7 +234,7 @@ const - read from the settings file if it exists, else use the registry - always write to the file } -function GetDefaultSettingsFileName: string; +function DefGetDefaultSettingsFileName: string; begin Result := IncludeTrailingPathDelimiter(GetApplicationFolder) + 'JCFSettings.cfg'; end; @@ -638,6 +641,7 @@ begin end; initialization + GetDefaultSettingsFileName := DefGetDefaultSettingsFileName; finalization FreeAndNil(mcRegistrySettings);