Re: Dia find & replace?

Thanks Hans!

If anyone besides Hans is reading, I have a question for any interested Dia-zens about the find & replace 
"checkboxes" below...

--- On Fri, 10/17/08, Hans Breuer <hans breuer org> wrote:

From: Hans Breuer <hans breuer org>
I made a few changes to find-and-replace.c so that --
optionally -- any and all text properties can be found &
replaced (rather than just the "name" and
"text" properties of an object).
This gives me the rest of what I was looking for -- the
ability to replace text in UML attribute types and operation
parameter names and what-not.

I would definitely appreciate your feedback.  

First thing is keeping consisteny , at least on the single
file level. You
have introduce some new programming style, which make the
patch unnecessary
hard to read:

My apologies for the inadvertent stylistic shifts.  I was actually making a conscious effort to follow the 
Dia style.  But I didn't do one crucial thing: proofread the patch line-by-line for style-sloppiness!  I will 
certainly do that in future.

since some of the data structures had me scratching my head
a bit (like the list-of-property-lists "records"
inside sarray and darray properties -- why a list-of-lists
of Properties? Why not just a list of Properties?).

This on is simple:
For example the UML class has methods (list).
A method is a _record_ with name, return value and
parameters (list).
A parameter again consists of a record with a name, a
(default-)value, a
type etc.

Thanks for the explanation of sarray & darray.  If it's not verboten I might add a comment to the header the 
next time I get a chance for some hacking, just so that your explanation is in the same spot as the structure 

I have not yet touched the i18n/l10n stuff either.  There
is currently a rather cumbersome message for the "all
properties" checkbox.  I'd rather have a
terse-yet-still-meaningful message before I figure out how
to hack the message catalogs.

No need to hack any message catalogs. By simply marking a
string with _() your are usually done with
Localization is than done on the message catalog by the
translation teams.
The thing missing is a good name for the two new options.

If anyone who's interested is reading this, there are a few checkboxes in the "find & replace" dialog:

  [ ] _Match case
  [ ] Match _entire word only
  [ ] Match _all properties (not just object name)   <-- ***

The last one is obviously way too clunky...  Any suggestions?

The basic idea is that if you have, say, a UML Class object:

  Class Foo
  - Attribute parent: Foo
  + Operation get_parent(): Foo

Then when "all properties" is NOT checked (default), you might replace "Foo" with "Bar" and end up with:

  Class Bar
  - Attribute parent: Foo
  + Operation get_parent(): Foo

Whereas when the third checkbox IS checked, you would end up with:

  Class Bar
  - Attribute parent: Bar
  + Operation get_parent(): Bar

I have no idea what to name the checkbox...  Any suggestions?

(Or completely different ways of looking at the problem would be welcome too!)

I've doen the reformatting and some minor changes and
just commited it.

I noticed you added a "FIXME" which I didn't consider:

  //FIXME: do we realy want a replace all here?

It may require some uprooting of code to fix that (stopping after the 1st property matched -- though I 
believe the fix belongs elsewhere in the code than where the comment is...).   I'll certainly take a crack at 
it -- probably won't be for at least a few days though.

I also seem to have left in one (of 2) "TODO"s which I should have dealt with -- string list properties.


Oh my...  Have you ever considered directing your inbound email to "hans example com"?

From the sounds of it, it's much cheaper than that NetIdentity / Tucows monstrosity -- and would probably 
have the same end result...

Thanks & cheers,


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]