List Info

Thread: patch to make the OptionPanel widgets use TextEditorProperties directly




patch to make the OptionPanel widgets use TextEditorProperties directly
country flaguser name
United States
2007-02-22 13:33:36
Notes:

In order for GeneralTextEditorPanel.cs to be able to use
TextEditorProperties for the font name, I had to add some
extra property
methods to TextEditorProperties:

UseDefaultMonoFont
UseDefaultSansFont
FontName


the UseDefault*Font props, I think, make higher level code a
bit nicer
to read rather than having to compare FontName to
__default_monospace
and/or __default_sans ourselves.

As far as setting these bool values... not sure I like what
the code
does if you do:

TextEditorProperties.UseDefaultSansFont = false;

for example. Since that doesn't really give us a font choice
to set it
to, I just defaulted it to __monospace_font. Likewise, for
setting
UseDefaultMonoFont to false.

Settings these props really only makes sense if you set them
to true.

So... is there a cleaner way to do this? I see a couple of
options:

1. leave it as-is... "it's fine"
2. modify them to do nothing if value != true.
3. maybe something like:

enum EditorFontType {
	EditorFontDefaultMono,
	EditorFontDefaultSans,
	EditorFontOther
}

struct EditorFont {
	EditorFontType type;
	string name;
}

and we could have getter/setter props that return/take
EditorFont
structs?



This way might be cleaner...

Any preference?

Jeff

_______________________________________________
Monodevelop-list mailing list
Monodevelop-listlists.ximian.com
http://lists.ximian.com/mailman/listinfo/monodevelop-li
st

  
Re: patch to make the OptionPanel widgets use TextEditorProperties directly
user name
2007-02-23 06:37:23
Hi!

The patch looks good. About the boolean properties issue, I
think the
easiest solution is to provide two properties:

EditorFontType FontType { get; set; }
string FontName { get; set; }

So the FontType property would return which font kind to
use, and
FontName would return the font name when FontType is set to
Other.

BTW, you don't need to prefix enum members with the name of
the enum,
since you always need to reference it anyway, e.g,
EditorFontType.EditorFontOther is a bit redundant.

Thanks!
Lluis.

El dj 22 de 02 del 2007 a les 14:33 -0500, en/na Jeffrey
Stedfast va
escriure:
> Notes:
> 
> In order for GeneralTextEditorPanel.cs to be able to
use
> TextEditorProperties for the font name, I had to add
some extra property
> methods to TextEditorProperties:
> 
> UseDefaultMonoFont
> UseDefaultSansFont
> FontName
> 
> 
> the UseDefault*Font props, I think, make higher level
code a bit nicer
> to read rather than having to compare FontName to
__default_monospace
> and/or __default_sans ourselves.
> 
> As far as setting these bool values... not sure I like
what the code
> does if you do:
> 
> TextEditorProperties.UseDefaultSansFont = false;
> 
> for example. Since that doesn't really give us a font
choice to set it
> to, I just defaulted it to __monospace_font. Likewise,
for setting
> UseDefaultMonoFont to false.
> 
> Settings these props really only makes sense if you set
them to true.
> 
> So... is there a cleaner way to do this? I see a couple
of options:
> 
> 1. leave it as-is... "it's fine"
> 2. modify them to do nothing if value != true.
> 3. maybe something like:
> 
> enum EditorFontType {
> 	EditorFontDefaultMono,
> 	EditorFontDefaultSans,
> 	EditorFontOther
> }
> 
> struct EditorFont {
> 	EditorFontType type;
> 	string name;
> }
> 
> and we could have getter/setter props that return/take
EditorFont
> structs?
> 
> 
> 
> This way might be cleaner...
> 
> Any preference?
> 
> Jeff
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-listlists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-li
st

_______________________________________________
Monodevelop-list mailing list
Monodevelop-listlists.ximian.com
http://lists.ximian.com/mailman/listinfo/monodevelop-li
st

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )