CodeSnip Old Code (SVN)
A repository for source code snippets, designed with Pascal in mind.
Brought to you by:
delphidabbler
{TODO -oSelf -cRefactor : Add enumerator to TNews and change loop in UUpdateMgr accordingly.} {TODO -oSelf -cRefactor : Refactor TQuery to use enumerators and use class var for instance} {DONE -oSelf -cBug : TSnippetMgr.CanHandleView can return true for a category view containing only freeform code in current query, providing there is a routine present in while category - we need to test for routines in current query using Query.GetCatSelection rather than all snippets in category.} {TODO -oSelf -cProposal : Add a Garbage collector: + global singleton version that maintains lifetimes for life of program - maintains a list of objects / resources and frees when unit goes out of scope + local version that can be created and have multiple objects added to it (resource, object etc). Store wrapper objects in list, each of which can release a certain resource type, e.g. objects, DCs, handles, etc. Given and add method for each type and generate wrapper object on fly. Obvious close link to UAutoFree} {TODO -oBill Miller -cFeature : Add snippet's category (with link?) to information tab - near snippet kind. Suggested by Bill Miller: "Sometime please add the snippet group to the Information tab. Without it... it is more difficult to determine which group the snippet is in: Snippet Group: StringManagement "} {TODO -oSelf -cProposal : Change the Snippets Editor moving code for each pane into separate frame that can (1) validate entered data (2) calculate required size for controls} {TODO -oSelf -cImprovement : Make selecting list item in check list box toggle the check mark} {TODO -oSelf -cBug : Selecting a new printer in print dialog and clicking properties can give an exception or properties dialog has wrong title. Selecting some printers in print dialog and clicking OK can give an exception.} {DONE -oSelf -cBug : Fix bug where units required by types and consts are not output to generated units.} {DONE -oSelf -cRefactor : Use UAutoFree to free REML info in UREMLDataIO} {DONE -oJerry Mack -cFeature : Permit use of file:// protocol in extra text} {TODO -oSelf -cFeature : Add facility to Snippets Editor to display check, render and display REML text (button on extra tab?) + add button to test display if any <a> tags are present to test and display URLs.} {DONE -oSelf -cBug : Link to DelphiDabbler CodeSnip database in welcome page is broken.} {DONE -oSelf -cImprovement : When Vista UI font is implemented, change extra HTML text on extra tab from content font to UI font.} {DONE -oSelf -cRefactor : Merge comp-routine.js and detail.js into a single detail.js file and delete all references to comp-routine.js} {TODO -oSelf -cObservation : Update date for UNulFormAligner in unit for v1.1 is wrong: it reads 26 Jul 2007 and should be 26 Sep 2007.} {TODO -oSelf -cProposal : Make sure content font depends on themes} {TODO -oSelf -cRefactor : Rename identifiers that refer to "routine" with "snippet".} {DONE -oBill Miller -cProposal : Make Graphics unit come after Windows unit in generated units.} {TODO -oSelf -cProposal : UView - completely overhaul this unit (careful of assignements tho - check if this actually happens between different types (may need wrapper for various IView implementations?)} {TODO -oSelf -cRefactor :Make UOverviewTreeBuilder .TOverviewSnipKindTreeBuilder.Build better - use Kind to index section list rather than description: Uses Sections.Add( TSnippetKindInfoList.Instance[Snippet.Kind].Description, Snippet );} {TODO -oSelf -cRefactor : FmSelectionSearchDlg.pas - Rename a lot of methods etc} {TODO -oSelf -cProposal : USourceGen - Consider separating TConstAndTypeFormatter into two classes - Add new format class to format header comments} {DONE -cFeature : Make Preview dialogs display "Preview: <Document Title>" where title is supported by doc type (HTML - title tag, RTF ???)} {TODO -oSelf -cRefactor : Extract common resource strings re comment style from FrSourcePrefs and USaveSourceDlg} {DONE -oSelf -cProposal : Add static Execute or Generate method to TSnippetSourceGen} {DONE -oSelf -cRefactor : Check common code of UCopySourceMgr, UCopyInfoMgr and UCopySnippetMgr and provide supporter class that provides common functionality. + (May want to refactor TCopySnippetMgr so it no longer descends from base class shared with save snippet manager and pull code generation into separate class that generates code for copy snippet and save snippet) + (If we do this may want to collapse save snippet code into single class.} {TODO -oSelf -cRefactor : Merge common code in UCommandBars and UWBPoupMenus + Add detail frame IDs to IFrameMgrs.pas} {DONE -cFeature (v3) : Make installer detect empty UserData.3 and create it, offering to copy any data from old UserData it finds. No conversion required.} {TODO -oSelf -cImprovement : Remove database detection code from IniDataReader and XML IO classes - make them know they read / wrtie main and user databases respectively} {TODO -oSelf -cRefactor : Get rid of TDataIOFactories and make ini, xml and nul data readers and writers be used directly insetad of via factories.} {DONE -oSelf -cFeature (v3) : Change alphabetical display handlers / view item to handle underscore routine names} {DONE -cFeature (v3) : Add option to installer to replace any custom styles in preferences with new default style} {TODO -oSelf -cRefactor : Consider moving syntax highlighting setting (CSS builder) down into FrInfo from FrDetailView since comp check tab no longer uses highlighting} {TODO -oSelf -cFeature : Changes preferences dialog sytem so that dialog box code presents empty body and dynamically adds tabs (or other UI code - may want abract base class and implementation class). + Register pages with a prefs page manager - if each page registers itself then we don't need to change dialog manager code or dialog box when new tabs are added + Will need to subclass PageControl, create dynamically and insert tab sheets and frames from following table + Expose a tab name from each pref frame, then we can create this dialog with just the specified tabs rather than creating all then hiding some + ConfigForm override to create tabs and frames SOME SAMPLE CODE: type TPrefsBaseFrameClass = class of TPrefsBaseFrame; const cFrameClasses: array[TPreferencePage] of TPrefsBaseFrameClass = ( TGeneralPrefsFrame, // ppGeneral TSourcePrefsFrame, // ppSourceCode THiliterPrefsFrame, // ppSyntaxHighlighter TPrintingPrefsFrame // ppPrinting ); cFrameTabs: array[TPreferencePage] of record Caption: string; FrameName: string; // todo: use help key here instead of frame name FrameClass: TPrefsBaseFrameClass; end = ( ( Caption: 'General'; FrameName: 'frmGeneralPrefs'; FrameClass: TGeneralPrefsFrame; ), ( Caption: 'Source Code'; FrameName: 'frmSourceCodePrefs'; FrameClass: TSourcePrefsFrame; ), ( Caption: 'Syntax Highlighter'; FrameName: 'frmHiliterPrefs'; FrameClass: THiliterPrefsFrame; ), ( Caption: 'Printing'; FrameName: 'frmPrintingPrefs'; FrameClass: TPrintingPrefsFrame ) ); }} {DONE -oSelf -cFeature (v3) : Create a new backup system - old one fails} {TODO -oSelf -cProposal : New TSingleton class that prevents an object from being freed (descendants should permit this). To ease freeing when necessary (implementation section, garbage collector etc) make destructors check for support for a do nothing interface (ISingletonDestroy) and only free normally if supported, then support in implementations and not in interface of unit. Eg. TMySingleton = class(TInterfacedObject) ... end; TMySingletonImpl = class(TMySingleton, ISingletonDestroyable) ... end; TMySingleton.Destroy; begin if Supports(Self, ISingletonDestroy) then // prermit destruction else // don't permit destruction end; Could have base class TSingleton = class(TInterfacedObject) that provides default destruction and virtual method called to do tidy up only if can destroy.} {TODO -oSelf -cFeature : Institute user defined categories} {DONE -oSelf -cFeature (v3) : Change Copy Source action to Copy Fragment and revise Copy Source to simply copy the TRoutine.SourceCode property - available only for snippets.} {DONE -oSelf -cFeature (v3) : Change uncategorised display to list const/type and routines under separate headings} {DONE -oSelf -cBug : Fix bug in Select Routines search. It always selects both the user defined and the main database versions of routines with the same name even if only one of them is selected.} {DONE -oSelf -cBug : Fix bug where selecting a routine and selecting View | View Test Unit causes JavaScript error if Compiler Check pane has not been displayed} {DONE -oSelf -cImprovement : Make forms use appropriate font for operating system.} {DONE -cImprovement -oSelf -Improvement : Change paypal donation URL for http://www.delphidabbler.com/url/donate-cs - may want to use consts to allow for localhost etc.} {DONE -oSelf -cRefactor : Remove RectWidth and RectHeight local functions from TDlgAligner.OffsetDialog and replace with calls to TRectX functions.} {DONE -oSelf -cCode correction : Change result of TTestCompileAction to False from True (doesn't call OnExecute).} {TODO -oSelf -cProposal : Share email and user name persistence used by code submission to bug reports, mailing list etc.} {DONE -oBill Miller -cProposal : Make Graphics unit come after Windows unit in user defined routines.} {DONE -oBill Miller -cImprovement : Make user info in code submission dialog persistent.} {DONE -otim.sinaeve@gmail.com -cFeature (v3) : Make syntax highlighting in main display user-configurable.} {DONE -oSelf -cRefactor : Replace all literal HTML tags with calls to a generator function or method (in UHTMLUtils).} {DONE -oSelf -cProposal : Check locale info code in UMeasurement and 1) see if needs ammending for Vista 2) decide whether to move to own unit.} {DONE -oSelf -cRefactor : Rationalise use of whitespace and move it to a constant or two in UConsts.} {DONE -oSelf -cImprovement : There appear to be two tabs needed to tab into web browser. See if same fix that applies in TV selection dialogs works (FrameEnter, set Focus)} {DONE -oSelf -cRefactor : Remove UGlobals unit, passing code into TAppInfo and new TWebInfo units.} {TODO -oSelf -cRefactor : Pull out Find Text dlg's history list into separate local class.} {TODO -oSelf -cImprovement : Make margins set in preview controls either configurable or in constant} {DONE -oSelf -cImprovement : Add these flags to IntfUIHandlers: First three are values for error values: DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x00400000, DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x00800000, DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x01000000, FInal five are new. DOCHOSTUIFLAG_HOST_NAVIGATES = 0x02000000, DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x04000000, DOCHOSTUIFLAG_USE_WINDOWLESS_SELECTCONTROL = 0x08000000, DOCHOSTUIFLAG_USE_WINDOWED_SELECTCONTROL = 0x10000000, DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE = 0x20000000 See MS SDK for descriptions} {DONE -oSelf -cRefactor :Use IStringList.Contains if list has specified string where IndexOf(xxx) >= 0 is used.} {TODO -oSelf -cRefactor : Merge UDataStreamReader and UDataStreamWriter into UDataStreamIO} {DONE -oSelf -cRefactor : Move cMax???? constants from UGlobals to relevant units / classes: + UHistory + UHistoryMenus + FmFindTextDlg} {TODO -oSelf -cProposal : Move Compile, View compile errors and configure compilers menu options to a new Compile menu?} {DONE -oSelf -cProposal : Consider a parent class of TMainCompilerMgr without configuration for use in user db edit} {DONE -oSelf -cImprovement : Change HTML generation to always generate all required page HTML for any page.} {DONE -oSelf -cImprovement : Change so that each user of Compilers has own local instance and remove global singleton. Current arrangement is confusing since we to use local copies on occasion.} {DONE -oSelf -cImprovement : Make test compile wait dialog centre over snippets edit dialog rather than place in top left corner.} {DONE -oSelf -cImprovement : Add shortcut key for links that display compiler errors (compres pane and user dit dlg last tab)} {DONE -oSelf --cBug:Make Ctrl+Tab and Shift+Ctrl+Tab work in Compiler Errors dialog} {DONE -oSelf -cFeature : Add ability place snippets on clipboard as RTF (and HTML?) as well as plain text.} {DONE -oSelf -cFeature (v3) : Add support for overloaded routines, stdcall routines etc.} {DONE -oSelf -cFeature (v3) : Add support for types and consts} {TODO -oSelf -cRefactor : See if we can pull out common HTML and REML code into SGML unit} {DONE -oSelf -cBug : Change UMessageBox so that & signs don't display underscores.} {TODO -oSelf -cRefactor : Create StringToOrd and OrdToString dictionaries and use to create two way char entity object to replace one in UTaggedTextLexer and UREMLDataIO etc. Also use for tag lookup in TTaggedTextLexer} {TODO -oSelf -cRefactor : Re-implement MakeSafeHTML in terms of a char entity class like that for REML? Use common base class with entities class in UREMLDataIO?} {TODO -oSelf -cProposal : Consider making TDateTime a record that can use =, < etc and to use TRange in when comparing file differences} {TODO -oSelf -cProposal : Add update date to each routine object} {DONE -oSelf -cImprovement : Try to make selected routines frame (or its base class) focus tree view when frame gets focus.} {DONE -cRefactor -oSelf : Use IStringList in TSaveUnitMgr.CreateHeaderComments??} {DONE -oSelf -cRefactor : Add enumerator to TProtocolRegistrar and use it in TProtocolFactory} {TODO -oSelf -cRefactor : Pull out common code from USaveDialogEx and UOpenDialogEx} {TODO -oSelf -cImprovement : Make custom colours persistent in colour dialog box on preferences menu.} {TODO -oSelf -cRefactor : Merge the IO and UI manager code into WBController} {DONE -oSelf -cFeature (v3) : Allow overview categorised tree to be expanded and collapsed.} {TODO -oSelf -cBug : Try to enable all custom printer properties set in Doc Properties dialog to be passed to printer - e.g. number of copies per page in PDF writer} {TODO -oSelf -cRefactor : Try to decouple UPageSetup, UPrintMgr and source code manager objects from associated dialog boxes} {DONE -oSelf -cFeature (v3) : Update pascal parser to recognise keywords added since Delphi 7.} {TODO -cProposal -oSelf :Terminate application when unexpected (non-CodeSnip) error trapped.} {TODO -oSelf -cFeature : Add code to THilitePasParser to detect location of directives and decide if they should be classed as reserved words or not} {TODO -oSelf -cFeature : Add parsing for standard user routine. Must start with procedure or function. Need to parse. Grammar is: <proc_proto> ::= "procedure" <ident> [<param_list>] ";" [<directives>] <fn_proto> ::= "function" <ident> [<param_list>] ":" <ident> ";" [<directives>] <param_list> ::= "(" <param_def> (*repeat ";" <param_def> *) ")" <param_def> ::= <ident> [ ":" <ident> ] <ident> ::= valid Pascal identifier <directives> ::= <directive> (*repeat ";" <directive> *) <directive> ::= "register" | "pascal" | "cdecl" | "stdcall" | "safecall" | "overload" Parsing for consts and types for our purpose is simple: <type-def> ::= "type" <definitions> <const-def> ::= "const" <definitions>} {DONE -oSelf -cRefactor : Replace call to MD5 in UAppInfo with call to static TCheckSum. } {DONE -oSelf -cRefactor : Replace all StringReplace() calls with [rfReplaceAll] with StrUtils ReplaceStr() calls. } {TODO -oSelf -cImprovement : Make treeview appear in Vista style on Vista.}