Functional Specification for SimplyHTML Enhancements

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
So I’ve been looking at 

WL-200-29:SimplyHTML kent$ git branch
* development
  master
WL-200-29:SimplyHTML kent$ sed -n '163,187p' src/com/lightdev/app/shtm/DynamicResource.java 
    public JMenu createMenu(final TextResources resources, final String key) {
        JMenu menu = null;
        String def = Util.getResourceString(resources, key);
        if (def == null) {
            def = "";
        }
        final String[] itemKeys = Util.tokenize(def, " ");
        menu = new JMenu(Util.getResourceString(resources, key + labelSuffix));
        for (int i = 0; i < itemKeys.length; i++) {
            if (itemKeys[i].equals(menuSeparatorKey)) {
                menu.addSeparator();
            }
            else {
                final JMenuItem mi = createMenuItem(resources, itemKeys[i]);
                menu.add(mi);
            }
        }
        menu.addMenuListener(new DynamicMenuListener());
        /**
         * store the menu in the menus hashtable for possible later use
         */
        menus.put(key, menu);
        return menu;
    }

and it seems like I could tweak it just a bit to add support for submenu’s.

My question is does what does Util.getResourceString(resources, key + labelSuffix) return if it cannot find a match? Looking at the following code, specifically what does `return properties.getProperty(pKey);` return? Additionally, would there be any side-effects if I decide to `return properties.getProperty(pKey, "");`?

WL-200-29:SimplyHTML kent$ sed -n '45,56p' src/com/lightdev/app/shtm/DefaultTextResources.java 

    public String getString(final String pKey) {
        try {
            return resources.getString(pKey);
        }
        catch (final MissingResourceException ex) {
            if (properties != null) {
                return properties.getProperty(pKey);
            }
            throw ex;
        }
    }

Regards,

Kent
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
hello Kent,

thank you for working on this!

"theworldbright [via Freeplane Developer]"
<[hidden email]> writes:

> So I’ve been looking at
>
> WL-200-29:SimplyHTML kent$ git branch
> * development
> master
> WL-200-29:SimplyHTML kent$ sed -n '163,187p'
> src/com/lightdev/app/shtm/DynamicResource.java
> public JMenu createMenu(final TextResources resources, final String key) {
> JMenu menu = null;
> String def = Util.getResourceString(resources, key);
> if (def == null) {
> def = "";
> }
> final String[] itemKeys = Util.tokenize(def, " ");
> menu = new JMenu(Util.getResourceString(resources, key + labelSuffix));
> for (int i = 0; i < itemKeys.length; i++) {
> if (itemKeys[i].equals(menuSeparatorKey)) {
> menu.addSeparator();
> }
> else {
> final JMenuItem mi = createMenuItem(resources, itemKeys[i]);
> menu.add(mi);
> }
> }
> menu.addMenuListener(new DynamicMenuListener());
> /**
> * store the menu in the menus hashtable for possible later use
> */
> menus.put(key, menu);
> return menu;
> }
>
> and it seems like I could tweak it just a bit to add support for submenu’s.

Maybe something like:
edit=undo redo - cut copy paste pasteOther - findMenuBar - editPrefs
findMenuBar=findReplace selectAll

or:

edit=undo redo - cut copy paste pasteOther - findMenubar/findReplace - \
  findMenubar/selectAll - editPrefs

(the latter would compile the hierarchical structure manually)

The freeplane configuration
(freeplane/viewer-resources/freeplane.properties) looks just the
same and I think it just passes the configuration to SimplyHTML,
so I think there's little work there.

What do you think?

We should tell the FreeMind maintainer(s) about this incompatibility.

> My question is does what does Util.getResourceString(resources, key +
> labelSuffix) return if it cannot find a match? Looking at the following
> code, specifically what does `return properties.getProperty(pKey);` return?

>
> WL-200-29:SimplyHTML kent$ sed -n '45,56p'
> src/com/lightdev/app/shtm/DefaultTextResources.java
>
> public String getString(final String pKey) {
> try {
> return resources.getString(pKey);
> }
> catch (final MissingResourceException ex) {
> if (properties != null) {
> return properties.getProperty(pKey);
> }
> throw ex;
> }
> }

com.lightdev.app.shtm.DefaultTextResources.getString(String)
returns either a translation ("resources.getString(pKey)"),
or a property ("properties.getProperty(pKey)").

> Additionally, would there be any side-effects if I decide to `return
> properties.getProperty(pKey, "");`?

com.lightdev.app.shtm.Util.getPreference(String, String)
will break then because it returns 'defaultValue' if
DefaultTextResources.getString(String) returns null
(which will no longer be the case)

thus

java.util.prefs.AbstractPreferences.get(String, String)
will return "" and _not_ 'defaultValue'.

--> I think it's much prefered to hand in "" as a default
where you actually need it. Where do you need it?

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
Hey Felix!

I managed to get submenu’s working in SimplyHTML. I went ahead and reformatted the format menu as specified in a earlier email:

Format 
----Font 
--------Show Fonts (equivalent to the Fonts... modal right now) 
--------Style 
------------Bold 
------------Italic 
------------Underline 
--------Size 
------------Bigger 
------------Smaller 
--------Font Color 
--------Remove Formatting 
------------------------------------- (The current separator line) 
----Paragraph 
etc...

To summarize all my changes on develop, I have

- Added accelerator keys for increase/decreasing font size and adjusting font color
- Added submenu support
- Reformatted the format menu (I’ve included translations were appropriate in the .properties file)

Is there anything I now need to do to have these new features integrated into Freeplane? You mentioned something about telling the FreeMind maintainer(s) about this incompatibility but what would this specifically require/mean?

Regards,

Kent

On Oct 3, 2015, at 3:58 AM, Felix Natter [via Freeplane Developer] <[hidden email]> wrote:

hello Kent, 

thank you for working on this! 

"theworldbright [via Freeplane Developer]" 
<<a href="x-msg://2/user/SendEmail.jtp?type=node&amp;node=761&amp;i=0" target="_top" rel="nofollow" link="external" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">[hidden email]> writes:

> So I’ve been looking at 
> 
> WL-200-29:SimplyHTML kent$ git branch 
> * development 
> master 
> WL-200-29:SimplyHTML kent$ sed -n '163,187p' 
> src/com/lightdev/app/shtm/DynamicResource.java 
> public JMenu createMenu(final TextResources resources, final String key) { 
> JMenu menu = null; 
> String def = Util.getResourceString(resources, key); 
> if (def == null) { 
> def = ""; 
> } 
> final String[] itemKeys = Util.tokenize(def, " "); 
> menu = new JMenu(Util.getResourceString(resources, key + labelSuffix)); 
> for (int i = 0; i < itemKeys.length; i++) { 
> if (itemKeys[i].equals(menuSeparatorKey)) { 
> menu.addSeparator(); 
> } 
> else { 
> final JMenuItem mi = createMenuItem(resources, itemKeys[i]); 
> menu.add(mi); 
> } 
> } 
> menu.addMenuListener(new DynamicMenuListener()); 
> /** 
> * store the menu in the menus hashtable for possible later use 
> */ 
> menus.put(key, menu); 
> return menu; 
> } 
> 
> and it seems like I could tweak it just a bit to add support for submenu’s.
Maybe something like: 
edit=undo redo - cut copy paste pasteOther - findMenuBar - editPrefs 
findMenuBar=findReplace selectAll 

or: 

edit=undo redo - cut copy paste pasteOther - findMenubar/findReplace - \ 
  findMenubar/selectAll - editPrefs 

(the latter would compile the hierarchical structure manually) 

The freeplane configuration 
(freeplane/viewer-resources/freeplane.properties) looks just the 
same and I think it just passes the configuration to SimplyHTML, 
so I think there's little work there. 

What do you think? 

We should tell the FreeMind maintainer(s) about this incompatibility. 

> My question is does what does Util.getResourceString(resources, key + 
> labelSuffix) return if it cannot find a match? Looking at the following 
> code, specifically what does `return properties.getProperty(pKey);` return? 

> 
> WL-200-29:SimplyHTML kent$ sed -n '45,56p' 
> src/com/lightdev/app/shtm/DefaultTextResources.java 
> 
> public String getString(final String pKey) { 
> try { 
> return resources.getString(pKey); 
> } 
> catch (final MissingResourceException ex) { 
> if (properties != null) { 
> return properties.getProperty(pKey); 
> } 
> throw ex; 
> } 
> }
com.lightdev.app.shtm.DefaultTextResources.getString(String) 
returns either a translation ("resources.getString(pKey)"), 
or a property ("properties.getProperty(pKey)"). 

> Additionally, would there be any side-effects if I decide to `return 
> properties.getProperty(pKey, "");`? 

com.lightdev.app.shtm.Util.getPreference(String, String) 
will break then because it returns 'defaultValue' if 
DefaultTextResources.getString(String) returns null 
(which will no longer be the case) 

thus 

java.util.prefs.AbstractPreferences.get(String, String) 
will return "" and _not_ 'defaultValue'. 

--> I think it's much prefered to hand in "" as a default 
where you actually need it. Where do you need it? 

Cheers and Best Regards, 
-- 
Felix Natter 



If you reply to this email, your message will be added to the discussion below:
http://freeplane-developer.996965.n3.nabble.com/Functional-Specification-for-SimplyHTML-Enhancements-tp600p761.html
To unsubscribe from Functional Specification for SimplyHTML Enhancements, click here.
NAML


signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
> Hey Felix!

hello Kent,

> I managed to get submenu’s working in SimplyHTML. I went ahead and
> reformatted the format menu as specified in a earlier email:

great news!!

> Format
> ----Font
> --------Show Fonts (equivalent to the Fonts... modal right now)
> --------Style
> ------------Bold
> ------------Italic
> ------------Underline
> --------Size
> ------------Bigger
> ------------Smaller
> --------Font Color
> --------Remove Formatting
> ------------------------------------- (The current separator line)
> ----Paragraph
> etc...
>
> To summarize all my changes on develop, I have
>
> - Added accelerator keys for increase/decreasing font size and adjusting
> font color
> - Added submenu support
> - Reformatted the format menu (I’ve included translations were appropriate
> in the .properties file)
>
> Is there anything I now need to do to have these new features integrated
> into Freeplane? You mentioned something about telling the FreeMind
> maintainer(s) about this incompatibility but what would this specifically
> require/mean?

To all devs: I am working with modem speed using my smart phone
(and mail sending currently does not work), because
our DSL router is broken (will be fixed on end of January at the
earliest).


You need to:

- test the changes using standalone simplyhtml (I'll try to do this, too
  --> please tell me when you are ready)

- merge your changes to master branch

- release simplyhtml 0.17.00 (you might want to integrate into freeplane first, see below)
  Please see my existing commits for how to do this (you need to change
  the version number in at least two places).
 
- upload the three "ant clean dist" artifacts (src/bin/manual) to
  sourceforge using (S)FTP. This is necessary for including the new
  simplyhtml in linux packages.  Please tell me if you need help with
  this.

- make sure that freeplane (1.5.x branch) pulls simplyhtml 0.17.00
  (freeplane/build.gradle, freeplane/lib/SimplyHTML* [1])

- adapt viewer-resources/freeplane.properties (I think that is the one)
  to reflect the changes you made to simplyhtml's properties files

- test the changes using freeplane (I'll try to do this, too --> please
  tell me when you are ready)

- since the changes you made to simplyhtml require changes in
  FreeMind/Freeplane (that's why I suggest a major version bump), we
  _might_ want to tell the FreeMind devs about this, but I think they do
  not update simplyhtml at all (This does not affect Debian packages,
  since FreeMind was removed from Debian)

[1] binary and source jars with version, should be built by "ant clean
dist"

Thanks for you Work, Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

theworldbright
Hey again Felix!

I’m back on break so I should have some time to finish this up.

On Dec 24, 2015, at 4:36 AM, Felix Natter [via Freeplane Developer] <[hidden email]> wrote:

- test the changes using standalone simplyhtml (I'll try to do this, too 
  --> please tell me when you are ready) 

Yeah I believe this is ready. Should I just go ahead to the next step and merge my changes to master?

Cheers,

Kent

signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing the font size with a hot key in SimplyHTML

Felix Natter
Administrator
hello Kent,

> I’m back on break so I should have some time to finish this up.

Glad to hear that, welcome back!

> Yeah I believe this is ready. Should I just go ahead to the next step and merge my changes to master?

I think it would be good to delay this until 1.5 has been released (and branch 1.6.x has opened),
because we're in a beta state and IMHO it would be good to release soon.
What do you / the other devs think?

Cheers and Best Regards,
Felix

12