[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Customizing SIOUX

This following sections describe how you can customize the SIOUX environment by modifying the structure SIOUXSettings. SIOUX examines the data fields of SIOUXSettings to determine how to create the SIOUX window and environment.


NOTE

To customize SIOUX, you must modify SIOUXSettings before you call any function that uses standard input or output. If you modify SIOUXSettings afterwards, SIOUX does not change its window.

The first three sections, "Changing the font and tabs," "Changing the size and location," and "Showing the status line," describe how to customize the SIOUX window. The next section, "Changing what happens on quit," describe how to modify how SIOUX acts when you quit it. The last section, "Using SIOUX windows in your own application," describes how you can use a SIOUX window in your own Macintosh program.

"The SIOUXSettings structure" summarizes what's in the SIOUXSettings structure.

The SIOUXSettings structure:

This field
Specifies
char  
initializeTB  
Whether to initialize the Macintosh toolbox.  
char  
standalone  
Whether to use your own event loop or SIOUX's.  
char  
setupmenus  
Whether to create File and Edit menus for the application.  
char  
autocloseonquit  
Whether to quit the application automatically when your program is done.  
char  
asktosaveonclose  
Query the user whether to save the SIOUX output as a file, when the program is done.  
char  
showstatusline  
Whether to draw the status line in the SIOUX window.  
short  
tabspaces  
If greater than zero, substitute a tab with that number of spaces. If zero, print the tabs.  
short  
column  
The number of characters per line that the SIOUX window will contain.  
short  
rows  
The number of lines of text that the SIOUX window will contain.  
short  
toppixel  
The location of the top of the SIOUX window.  
short  
leftpixel  
The location of the left of the SIOUX window.  
short  
fontid  
The font in the SIOUX window.  
short  
fontsize  
The size of the font in the SIOUX window.  
short  
fontface  
The style of the font in the SIOUX window.  

"Example of customizing a SIOUX Window" contains a small program that customizes a SIOUX window.

Example of customizing a SIOUX Window:
#include <stdio.h>
#include <sioux.h>
#include <MacTypes.h>
#include <Fonts.h>

int main(void)
{
	short familyID;
	
	/* Don't exit the program after it runs or ask whether 
		to save the window when the program exit */
	SIOUXSettings.autocloseonquit = false;
	SIOUXSettings.asktosaveonclose = false;

	/* Don't show the status line */
	SIOUXSettings.showstatusline = false;

	/* Make the window large enough to fit 1 line 
		of text that contains 12 characters. */
	SIOUXSettings.columns = 12;
	SIOUXSettings.rows = 1;

	/* Place the window's top left corner at (5,40).  */
	SIOUXSettings.toppixel = 40;
	SIOUXSettings.leftpixel = 5;

	/* Set the font to be 48-point, bold, italic Times.   */
	SIOUXSettings.fontsize = 48;
	SIOUXSettings.fontface = bold + italic;
	GetFNum("\ptimes", &familyID);
	SIOUXSettings.fontid = familyID;

	printf("Hello World!");

	return 0;
}


Changing the font and tabs

This section describes how to change how SIOUX handles tabs with the field tabspaces and how to change the font with the fields fontid, fontsize, and fontface.


NOTE

The status line in the SIOUX window writes its messages with the font specified in the fields fontid, fontsize, and fontface. If that font is too large, the status line may be unreadable. You can remove the status line by setting the field showstatusline to false, as described in "Showing the status line."

To change the font in the SIOUX window, set fontid to one of these values defined inthe header file Fonts.h:

By default, fontid is monaco.

To change the character style for the font, set fontface to one of these values:

  • normal
  • bold
  • italic
  • underline
  • outline
  • shadow
  • condense
  • extend
  • To combine styles, add them together. For example, to write text that's bold and italic, set fontface to bold + italic. By default, fontface is normal.

    To change the size of the font, set fontsize to the size. By default, fontsize is 9.

    The field tabspaces controls how SIOUX handles tabs. If tabspaces is any number greater than 0, SIOUX prints that number of spaces required to get to the next tab position instead of a tab. If tabspaces is 0, it prints a tab. In the SIOUX window, a tab looks like a single space, so if you are printing a table, you should set tabspaces to an appropriate number, such as 4 or 8. By default, tabspaces is 4.

    The sample below sets the font to 12-point, bold, italic New York and substitutes 4 spaces for every tab:


       SIOUXSettings.fontsize = 12;    SIOUXSettings.fontface = bold + italic;
       SIOUXSettings.fontid = kFontIDNewYork;
       SIOUXSettings.tabspaces = 4;

    [ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

    Visit the Metrowerks website at: http://www.metrowerks.com
    For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
    Copyright © 2000, Metrowerks Corp. All rights reserved.

    Last updated: August 16, 2000