Thursday, March 28, 2013

Wide Margin 1.2.2 Alpha 1

I am please to announce the release of Wide Margin 1.2.2 Alpha 1

Wide Margin 1.2.2 Alpha 1 is the first release to support a Sword module. Currently only one sword module is supported, the ESV (English Standard Version).
The ESV was chosen because it it is modern and accurate. Support for the KJV will be coming soon.

New Features include:
  •  ESV sword module support.
  •  Paragraph layout instead of verse per line.
  •  First searching using lucene.net



This was made possible through our new SharpSword backend. Which I will blog about later.

I want to say a big thank you to all the people who contributed to this release to make it possible.

Wide Margin is free and opensource and is produced entirely by volunteers. If you would like to help or contribute please visit our contribute page:

Wide margin 1.2 Alpha 1 can be downloaded from our website at http://widemargin.org/Download

Saturday, March 16, 2013

Subscript and Superscript in GTK#

In Wide Margin I had a need to use superscript for verse numbers. This is quite common in printed bibles because it reduces the impact of the verse number on the readability of the text. In Wide Margin I use a Gtk TextView to display my text, formatting in a Gtk TextView is achieved using TextTags which specify formatting for a range in the text.

A TextTag does not have a property for subscript or superscript rather it has a property call Rise. Setting this to a positive value moves the text up and setting it to negative moves the text below the line.

In GTK3 the value of Rise is in pixels, in GTK2 the value of Rise is in Pango Units, There are 1024 pango units in a Pixel. This confused me for quite a while because I was reading the GTK3 docs and assuming a unit of Pixels, but I was using GTK2. I was trying to Rise my text by 5 units which in GTK2 is smaller then what can be rendered.

 Setting Rise will move the character up or down but will leave the size unaffected. To get superscript or subscript you will also need to reduce the font size.

Superscript (GTK2) Subscript (GTK2)
The exact amount you want to move change the size and move the the text up or down will depend on how you want it to look. So have a play until you get it right.

Wednesday, October 31, 2012

Wide Margin 1.1 Released


I am please to announce the release of Wide Margin 1.1

Wide Margin 1.1 comes with a load of usability improvements and bug fixes.

New Features include:
  •  Mouse driven passage lookup
  •  Filtered Searches
  •  Continuous Scrolling for search results
  •  Target verse highlighting



I want to say a big thank you to all the people who contributed to this release to make it possible.

The application can be downloaded here and supports both ubuntu and windows.

Wide Margin is free and opensource and is produced entirely by volunteers. If you would like to help or contribute please visit our website:

http://widemargin.org

Monday, October 8, 2012

Invoking on the UI thread in GTK#

Not Threadsafe
GTK like most GUI toolkits is not thread safe. This means that you must only ever update it form the UI thread. If we want our applications to be responsive however we must run any long running processing on a different thread so that the UI thread is free to respond to user input. This posses a problem because we need to be able to update the UI to reflect the progress and outcome of the processing, but we can't do that directly because the UI is not threadsafe.

How to update from another thread without updating from another thread
Fortunitely GTK# has a built in mechanizm for running code on the UI thread from another thread. This mechanism is call Application.Invoke and you can call it like this.


Application.Invoke((_,__) =>
{
    // update UI here
});


This method however is suboptimal, firstly because Application.Invoke takes two parameters (object sender, EventArg args). In most cases we don't need these and so in my example I have used _ for the sender and __ for the args. The second problem is that we only really need to call this if we are not already on the UI thread. We don't want to take on the penalty of the overhead if we are already on the UI thread.

There must be a better way
In winforms useful methods are provided which solve the problems presented by Application.Invoke.

The first is Control.InvokeRequired this will return true if we are not on the UI thread or false if we are.

The second is Control.Invoke this is like Application.Invoke but without the overhead of having to specify a sender and args and can be called like this:

Control.Invoke(()  =>
{
    //update UI here
});

By combining these you can write code that only invokes when it needs to. The details of this can be found here:
http://msdn.microsoft.com/en-us/library/ms171728(v=vs.80).aspx

Can we do that in GTK?
Yes we can. We can achive exactly that using Extension Methods. Actually we can improve on it by making the Invoke method only call Application.Invoke if we are not already on the UI thread. The following code is provided under the Unicorn licence.

Doing this means that what was:

Application.Invoke((_,__) =>
{
    // update UI here
});

Becomes:

Invoke(()  =>
{
    //update UI here
});

Which is cleaner and takes care of figuring out what thread your are on for you.

Saturday, September 15, 2012

Wide Margin 1.1 hits Beta

I am please to announce that the 1.1 release of Wide Margin has hit Beta.

Changes since 1.0 include:

  • Mouse friendly passage navigation and filtering.
  • Search Filtering.
  • Continuous scrolling on search results.
  • Windows support.


How ca you get it?
The windows version can be downloaded from here:
The ubuntu version can be installed from our PPA:

How can you help?
At this stage we need testers. We need people to install and use Wide Margin. If you find any problem please raise them on our bug tracker here:



Wednesday, August 31, 2011

Wide Margin's first full release.


Wide Margin has reached a major milestone, it has had it's first full release, Wide Margin 1.0.9.
Wide Margin is a simple and quick bible application for ubuntu and has the following features:
  • As you type searching and passage navigation
  • Out of the box King James Version support
  • Full navigation history
  • Familiar browser inspired interface
  • Daily reading planner
  • Ubuntu PPA
You can install it now using our Ubuntu PPA ppa:trampster/widemargin

We welcome bug reports, patches, UI mockup and any other way you might want to contribute. Please visit our website https://bitbucket.org/trampster/widemargin/wiki/Home to get started

Going forward we plan to start development on release 2 which will bring Wide Margin to windows. Release 1 will continue to get bug fixes and regular updates until Release 2 is complete.

Monday, August 15, 2011

Wide Margin goes Beta

I am pleased to announce the first Beta release of the Wide Margin project.

Wide Margin 1.0.8 Beta

Changes include:
- Packaging improvement courtesy of directhex
- Daily Reading fix to bug causing the app to crash when loaded on some days.

For those of you who don't know Wide Margin is a quick and simple bible application for ubuntu. You can get it now from our ubuntu PPA ppa:trampster/widemargin



Wide Margin will stay beta for the next few weeks and if no major bugs are found will then become the first full release.

If you want to learn more or to help out please visit https://bitbucket.org/trampster/widemargin