two questions/wishes, one string conversion (removeCamelCase)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

two questions/wishes, one string conversion (removeCamelCase)

Rainer M. Engel
Hey..

1) I would like to use/see something like a DividerLine in dialogues of
Macros/Plugins. Opening bUnwarpJ I recognized something like this "-----
Advanced Options -----", which appeared to be some kind of neat
workaround but not that elegant.


2) I like to work with the Log-Window to get feedback during macro
execution. Its window is created at the exact same position where it was
closed before but my adjustment in size is gone every time. If the
topleft position is stored, couldn't that be done for the dimension of
this window too?


3) Once upon a time there was a need to get rid of CamelCase, so here is
a macro with a function to do so.

> string = "CamelCaseIsNiceInFilenamesButNotInsideOfDocuments";
> print("original: "+string);
> mod = removeCamelCase(string);
> print("modified: "+mod);
>
> function removeCamelCase(string) {
> mod = replace(string, "[a-z]{1}[A-Z]{1}", "#%#");
> frags = split(mod, "%");
> offset = 0;
> coll = "";
> for (i=0; i<frags.length; i++) {
> segL = lengthOf(frags[i]);
> str = substring(string, offset, (offset+segL));
> coll = coll+str+" ";
> offset = offset+segL;
> }
> return coll;
> }

Best regards,
Rainer


--
Rainer M. Engel, Dipl. Digital Artist
scientific|Media GbR
Pichelsdorferstr. 143
D-13595 Berlin

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: two questions/wishes, one string conversion (removeCamelCase)

Michael Schmid
Hi Rainer,

maybe a few possibilities for the first point of your wishlist:
In a macro:
  Dialog.addMessage("___________________________");
(Underscore characters blend into a nice line)

There are also all the box drawing characters starting at unicode 2500hex (9472 decimal). The following works well on a Mac, not sure about Windows, with its poor unicode suppport:
  lineString = fromCharCode(9473,9473,9473,9473,9473,9473,9473,9473);
  Dialog.addMessage(lineString + " Advanced Options "+ lineString);

You get a thinner line with 9472.

In Java, you can have genericDialog.addPanel, and you can add a Canvas to the Panel. There you can draw whatever you like.


Michael
________________________________________________________________
On Dec 6, 2012, at 16:17, Rainer M. Engel wrote:

> Hey..
>
> 1) I would like to use/see something like a DividerLine in dialogues of
> Macros/Plugins. Opening bUnwarpJ I recognized something like this "-----
> Advanced Options -----", which appeared to be some kind of neat
> workaround but not that elegant.
>
>
> 2) I like to work with the Log-Window to get feedback during macro
> execution. Its window is created at the exact same position where it was
> closed before but my adjustment in size is gone every time. If the
> topleft position is stored, couldn't that be done for the dimension of
> this window too?
>
>
> 3) Once upon a time there was a need to get rid of CamelCase, so here is
> a macro with a function to do so.
>
>> string = "CamelCaseIsNiceInFilenamesButNotInsideOfDocuments";
>> print("original: "+string);
>> mod = removeCamelCase(string);
>> print("modified: "+mod);
>>
>> function removeCamelCase(string) {
>> mod = replace(string, "[a-z]{1}[A-Z]{1}", "#%#");
>> frags = split(mod, "%");
>> offset = 0;
>> coll = "";
>> for (i=0; i<frags.length; i++) {
>> segL = lengthOf(frags[i]);
>> str = substring(string, offset, (offset+segL));
>> coll = coll+str+" ";
>> offset = offset+segL;
>> }
>> return coll;
>> }
>
> Best regards,
> Rainer
>
>
> --
> Rainer M. Engel, Dipl. Digital Artist
> scientific|Media GbR
> Pichelsdorferstr. 143
> D-13595 Berlin
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: two questions/wishes, one string conversion (removeCamelCase)

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Rainer M. Engel
On Dec 6, 2012, at 10:17 AM, Rainer M. Engel wrote:

> Hey..
>
> 1) I would like to use/see something like a DividerLine in dialogues of
> Macros/Plugins. Opening bUnwarpJ I recognized something like this "-----
> Advanced Options -----", which appeared to be some kind of neat
> workaround but not that elegant.

You can add bold headings to checkbox groups. There is an example at

    http://imagej.nih.gov/ij/plugins/multi-column-dialog/

> 2) I like to work with the Log-Window to get feedback during macro
> execution. Its window is created at the exact same position where it was
> closed before but my adjustment in size is gone every time. If the
> topleft position is stored, couldn't that be done for the dimension of
> this window too?

The "Log" window remembers its dimensions in the ImageJ 1.47h daily build.

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: two questions/wishes, one string conversion (removeCamelCase)

Rainer M. Engel
Thank you both for these suggestions, help..
.. and of course the build.

Best regards,
Rainer

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html