Thingamablog 1.0.6 Wikilink + ISCIM extension

Back to program page

Details on version 1.0.2

Program description
ISCIM (Insert Special Char Improved) is a feature modification for the Thingamablog 1.0.6 blogging software.
I never understood why my selected text isn't preserved when I'm using the Insert > Special Character command from the Thingamablog Entry Editor. So I have adjusted this feature for my needs. After having installed the ISCIM modification, your selected texts won't be replaced by the special character you insert, but surrounded by it. For example if you select the word

example

and then insert the special quotation mark characters, it resulted in the following up to now:

«»

This is neither a very intuitional, nor a very user-friendly behaviour.
In order to improve this, the ISCIM modification arranges, that your inserting operation will result in

«example»

- just as expected.
If you don't have selected any text or inserted a special character which doesn't allow the inclusion of text (e.g. this character: ©), the feature works the same as in the original Thingamablog 1.0.6 release.

How to get it running
Installing the modification is simple: Just download the program data (I recommend the executable package, but if you wary about downloading an inofficially compiled program version, you can also download the source code package and compile it yourself), extract it and replace your old thingamablog-1.0.6 folder with the new one you just extracted. Now you can work as usual with Thingamablog, but with an improved Insert Special Character feature and furthermore you have the ability to create Wikilinks (see Extending Thingamablog 1.0.6: Interlinking blog entries (Wikilinking) for details).
To ensure that you are working with the improved Thingamablog version, take a look at the program title bar- there you should see something like this:

Thingamablog 1.0.6 - WikiMod+ISCIM-Version by Fabian Voith (www.FaVorithSoft.de)

How to develop it
To improve the special character feature, you just have to add and modify a few lines of code. Open the gui/editor/CharTablePanel.java file, located within the internal folder structure and navigate to the CharAction.actionPerformed method. Replace this method with the following one:

public void actionPerformed(ActionEvent e) {
  // greater edits (code/comments) by Fabian Voith - don't replace existing text with the special char but surround it
  String s = this.getValue(Action.NAME).toString();
  //if(!editor.getContentType().equals("text/html"))
  StringBuffer sb = new StringBuffer();
  boolean preservedtext = false;
  if(!(editor.getDocument() instanceof HTMLDocument))
  {
    // src edit  
    // preserve selected text
    if ((s.length()==2)&&(editor.getSelectedText()!=null)) {
      sb.append("&#");
      sb.append(new Integer(s.charAt(0)).toString());
      sb.append(';');
      sb.append(editor.getSelectedText());
      sb.append("&#");
      sb.append(new Integer(s.charAt(1)).toString());
      sb.append(';');
      preservedtext = true;

    } else {

      for(int i = 0; i < s.length(); i++)
      {

        sb.append("&#");
        sb.append(new Integer(s.charAt(i)).toString());
        sb.append(';');
      }
    }
    s = sb.toString();
  } else {
    // wysiwyg edit

    // preserve selected text
    if ((s.length()==2)&&(editor.getSelectedText()!=null)) {
      sb.append(s.charAt(0));
      sb.append(editor.getSelectedText());
      sb.append(s.charAt(1));
      s = sb.toString();
      preservedtext = true;
    }

  }

  editor.replaceSelection(s);
  // only reset cursor if no text selection was made
  if (!preservedtext) {
    if (s.length() == 2) {
      editor.setCaretPosition(editor.getCaretPosition()-1);
    }
  }
}

Finished.