# HG changeset patch # User Diggory Hardy # Date 1237025151 -3600 # Node ID 1125ba603af64c8b847f3e8bd101f25e56ccf962 # Parent 17438f17bfb5d38fe0737b8f79dc9adf4260179f Some ideas for content service menus. diff -r 17438f17bfb5 -r 1125ba603af6 codeDoc/ideas.txt --- a/codeDoc/ideas.txt Sat Mar 14 11:05:31 2009 +0100 +++ b/codeDoc/ideas.txt Sat Mar 14 11:05:51 2009 +0100 @@ -28,10 +28,41 @@ -> may require moving through a lot of widgets -> with complicated substructures, may not be very intuitive -> limit to popup menus? - -> these keyboard events only passed if activated by code outside the WidgetManager and no text input callback is active? + -> these keyboard events only passed if activated by code outside the WidgetManager and no text input callback is active Content: -> Per-content undo support? - +> Services: + > All content: + +> Clipboard + > Some content: + +> Spellchecking + +> Calculator + -2> Fixed list of services working on IContent/Content: + > Clipboard - can't store Content (callbacks) + -> needs to check content type + > unless stored as char[] which all content can take + -> extra conversions (minor) + -> Need to check type of content for specific services + +1> List for each type of content: + +> can use a static list widget for each type + -> clipboard is type specific; need to decide when to convert, etc. + +> enables better copying; e.g. from double 3.5e9 to int 4×10⁹ +> Non-static content manager + > Separate managers for options, GUI symbols, data fields, passwords(?) + > Optional saving/loading + > Possibly different translation sources + > manager can take an optional Translator interface/super class, using it to translate strings if provided +> Lists + > filtering uses + > filter context menu services to those relevant + > user-filters on, e.g., options + > filtering implementations (list widget) + > keep all sub-widgets, but hide some cells + > takes advantage of fact that actual elts don't change + > rebuild list + -> more work, recreating sub-widgets + > dynamic lists (add/remove elts) + > have to rebuild lists Extend content with a validator function/delegate, specific to each class, which takes the new value and returns it or a corrected version of it. Not so good to do it generally from Content, since setting a new value via usual method will re-trigger validator and callbacks (e.g. bad validator could cause infinite loop). diff -r 17438f17bfb5 -r 1125ba603af6 mde/content/Services.d --- a/mde/content/Services.d Sat Mar 14 11:05:31 2009 +0100 +++ b/mde/content/Services.d Sat Mar 14 11:05:51 2009 +0100 @@ -20,31 +20,31 @@ * * Services act on a content, potentially modifying it. They have the form: * --- - * bool service (ref Content c); + * bool service (Content c); * --- * where c is the content acted on, and the return value is true if the content was changed (useful * to know whether caches need updating or not). */ module mde.content.Services; -bool copy (ref Content c) { - // Put a duplicate on the clipboard, so later changes don't affect what's on the clipboard. - clipboard = c.dup; - return false; +import mde.content.AStringContent; + +union ContentUnion { + *Content ; } -bool paste (ref ContentText c) { - if (clipboard is null) - return false; // no item on clipboard, so don't do anything - c = clipboard.toText; - return true; +bool copy (Content c) { + // store by type + clipboard = c; } -bool paste (ref ContentInt c) { - if (clipboard is null) - return false; // no item on clipboard, so don't do anything - c = clipboard.toInt; - return true; +bool paste (StringContent c) { + if (clipboard) + c = clipboard.toString (0); +} + +bool paste (IntContent c) { + } bool link (ref ContentText c) { @@ -54,4 +54,4 @@ return true; } -Content clipboard; +ContentUnion clipboard;