Gsharp 3.3 - New Features

See also:

The Main Changes

  • The Gsharp interface has been completely redesigned.
    • The new menu layout is more standard and the most popular options have been made more easily available.
    • Short-cut keys have been added for the most common commands
    • Objects can be cut, copy, pasted and deleted either using the Edit menu, the canvas popup menu or directly on the canvas using the short-cut keys.
  • Gsharp now has support for multiple levels of undo and redo.
  • Gsharp can now create images using hardware fonts (e.g. TrueType fonts)
  • Gsharp can now create datasheet objects. A datasheet object displays the contents of a dataset as a table on the page.
  • Numerous enhancements to the Gsharp Script Language (GSL) and for Gsharp Application developers - see below.

Gsharp Interface

  • Gsharp will now open a script in a new page. It will also link each page with the script that was to create that page or that the page was saved as. Clicking on the Page Select icon in the command toolbar will show the associated GSL script for all of the pages.

  • The example menu is now constructed at start time from the contents of $UNIDIR/example/Gsharp. New examples can be added by saving them in this directory and specifying in the top of the file the submenu it should belong to. Examples now open in a new page.
  • A Wizards menu has been added with wizards to help new users create charts and contours. Wizards also exist to create histograms and to do linear regressions and other types of line fitting. Statistics such as correlation and standard deviation are also calculated.
  • Viewports can now be tiled or aligned.
  • On Windows, Gsharp now has editors for the object templates and a Color Editor.
  • On Windows, the OutputImage dialog now includes an option for creating Enhanced Metafiles

The Graphics

  • The title object can now, optionally, be freely moved around the page. To free a title from its usual constraints set its stacked resource to false.
  • The trailing zeros resource of the axis object has had two new options added. In the past axis labels ending in zeros could either be untouched (3.00000) or truncated (3.0). Now they can also be without decimal (3) or with decimal (3.).

Hierarchy Browser

  • In Windows, it is now possible to drag and drop objects by holding down the Ctrl key and dragging the object using the left mouse button (Gsharp on UNIX still uses the middle mouse button).
  • It is also possible to right click on an object in the canvas or in the browser and select Generate GSL. The GSL commands to create that object are then stored in the clipboard and can be pasted into the ScriptBuilder or an external editor.

DataManager

  • On Windows, it is now possible to specify that the current folder should follow the folder that is being viewed.
  • The excel spreadsheet reader can now accept an array of cells to use as dataset names
  • Gsharp can now read netCDF files.
  • On Windows, the DataEditor can now display multiple datasets.

ScriptBuilder

  • The ScriptBuilder menus have been re-organised.
  • Short cut keys have been added for the common tasks e.g. Ctrl-N for New and Ctrl-R for Run.
  • A toolbar has been added to enhance usability.
  • Support has been added for line numbers.
  • Users can control whether or not to reset the current page (on by default) and reset the data (off by default) whenever a script is run.
  • It is now possible to Generate GSL for all pages, the current page, the current object or the global objects.
  • The command log of all actions or just the data commands can also be pasted into the ScriptBuilder.

Gsharp Script Language

  • The keyword currentpage can be used to refer to the current page e.g.
    create Viewport currentpage.viewport1;
    Scripts saved by Gsharp will use currentpage so that the script can be opened into any page.
  • It is now possible to reset just the current page using the command reset page and to reset the counter for dataset name generation with reset names.
  • generate_gsl() can now generate GSL just for the current object and its children.
  • The all() function now has an optional parameter specifying the parent e.g. all("Viewport", "page_2") will return all the viewports in page_2.
  • A new function range2 has been added with the arguments start, end and step e.g. range2(0, 100, 20) will return 0, 20, 40, 60, 80 and 100
  • A new function linear() can be used to linearly calculate y values at specified x points from x, y data
  • The function dirlist() returns the names of sub directories of the specified directory.
  • The GSL parser is now more robust at reporting non-terminated strings.
  • It is now possible to specify the default value of input_float.
  • A new function has been added to prompt the user for a decision. input_choice can take up to three possible options e.g. input_choice("Your hard-disk has been formatted", "OK") or input_choice("Should I save this file before quitting?", "Yes"//"No"//"Cancel")
  • Gsharp now defines the enumerated values stdin, stdout and stderr to be 1, 2 and 3 respectively. These values can be used with fwrite and fread e.g. fwrite(stderr, "We have a problem");
  • The enumerated value sundef can be used to specify an undefined string e.g. page_1.view1.domain.graph.XuNyData = if(flag, sundef, "T2");
  • The function remove now accepts an array of filenames e.g. remove(filelist("*.lay"));
  • It is now possible to specify a Windows printer from GSL e.g. hardcopy.XuNdeviceDescription="\\\\machine\\HPLaserJet 4SI"
  • printf, sprintf and fprintf can now accept an area of values to be processed by the format string e.g. printf("%+03.1g", rnd(10));

Examples and Other Source Files

  • All of the Gsharp examples have been rewritten so that they can co-exist. Each example will read its data files into a separate folder.
  • Many examples have been rewritten to use functions and local variables. Mastermind.gsl and gallery.gsl have been rewritten to take advantage of new features like multiple-pages and input_choice.
  • Functions to read and write folders in a platform-independent ASCII format can be found in $UNIDIR/lib/libio.gsl

Documentation

  • The Gsharp Tutorial has been updated and extended.
  • All the new features have been documented.
  • Many sections have been added to the documentation e.g. command line options, short-cut keys.

GUI Objects and Gsharp Applications

  • Short-cut keys and their labels can now be specified for any Button using GSL.

  • All the new interface improvements are available to all users through the callbacks used in the standard interface e.g. GuiEditCopy and GuiEditPaste.
  • Whem the user exits the Gsharp Application, the gsharp_1 callback is now called with the reason XuCR_EXIT.
  • It is now possible to check the status of the Stop button and interrupt execution at a convenient place.
  • It is now possible to enable the close icon of a Gsharp dialog. Set the dialog resource XuNguiAllowDestroy to true. If a callback has been specified then it will be called with the reason XuCR_KILL_DIALOG. By default the dialog is popped down, to kill the dialog set the callback to be GuiKillDialog.
  • If a dialog is resized then the dialog callback will be called with the reason XuCR_RESIZE
  • A new function has been added to check if a dialog is visible or not - GuiDialogIsVisible()
  • The appearance of Menubars in dialogs have been improved.
  • A new resource XuNguiMargin has been added to dialog objects to control the size of the border around the working area.
  • It is now possible to reset an object's immutable resource using GSL. The value of the immutable resource is shown in the resource editors, but it can no longer be modified interactively.
  • The third argument to GuiSetString and GuiSwitchSetState is used to specify whether or not the objects callback should be called. In Gsharp 3.3 is is now possible to specify this argument either as false or as the callback reason the callback should be called with e.g. GuiSetString("gsharp_1.mydialog.text", "3.0", XuCR_VALUE_CHANGED);
  • The status line can now be set with the command GuiShowStatus("Thinking ...")
  • On Windows, It is now possible to double click on an item in a selection dialog.
  • A new function GuiGetListItems can be used to retrieve the items in a combobox or selection list.
  • A new resource XuNguiRadioGroup has been added to the Switch object to assist people when developing radio behaviour for their switches. See the Switch documentation for more details
  • On Windows, it is now possible to use the tab key to move between objects.
  • When a Text field gets the focus, its contents will now be selected.
  • All objects now have a resource called XuNuserFloatData which stores a float value and can be used however the developer wishes.
  • When Gsharp repaints just a single object, it whites out the original position of the object before rendering it again. This whiting out can now be skipped by setting displayoption.XuNautoEraseObject to false.
  • It is now possible to specify the startup logo of a Gsharp Application on the command line. See the command line options for more details.
  • You can now choose between the following options for the level of object interaction in the canvas: none, moveResize, edit and full.
  • Gsharp resources can now be quickly added as toggles to the Gsharp interface using a standard set of routines and specifying the resource as the callback data e.g.
      create Switch gsharp_1.menubar.view.toolbars.command
       ( XuNguiLabel = "Command",
         XuNguiCallback = "GuiToggleResource",
         XuNguiCreateFunction = "GuiCreateToggleResource",
         XuNguiDestroyFunction = "GuiDestroyToggleResource",
         XuNguiCallbackData = "'displayoption.XuNcommandToolbar'",
         XuNguiSwitchState = true,
         XuNguiMnemonic = "C"
       );
    

Gsharp Web Edition

  • Gsharp Web Edition scripts can now be created directly from Gsharp. Use File/Save As and then set the type to be Web Edition Script. The script will contain the commands that were used to read your data and the commands to recreate your graphics. The layout of the script is created from a template $UNIDIR/base/template.gsw which can be edited to include your own logos or in-house style.
  • If the Gsharp Web Edition encounters an error it will now precede this error with HTTP headers so that the error message will appear in the browser rather than be lost.