Sunday, March 15, 2015

User-configurable Start Variables

While it is easy to quickly change most of the settings in the Template, it can become tedious if every time you start it you find yourself having to reset the Figurine Language or the chess font that you always use, etc. For this reason, a number of important variable settings have been placed at the top of the Basic script of the Template to allow you to modify their starting values permanently. This is not at all difficult to do, and you only have to do this only once.

TIP: Before modifying the Template file itself, you should make a backup copy of it!

To modify the Template itself, you must right-click on the Template file and then select Open. When the Template file has finished opening, click:

Tools → Macros → Organize Macros → Openoffice.org Basic
This will bring up the Openoffice.org Basic Macros Dialog.



Now click on the small box in front of the Template's name to open up the subheadings Standard and then ChessDiag1. You should now see all the Basic Subroutines listed on the right side of the dialog window. It should look like the following:


 
Now click on the Edit button. This will bring up the IDE (Integrated Development Environment) Window. Scroll to the very top of that window. You should now see something like this:


At the very top in the Macro editor you should see the User-configurable Start Variable list. It will look something like this:

' The User-configurable Start Variables ----------------

Const StartDiagramAlignment = 3 ' 0 = LEFT, 1 = RIGHT, 2 = BLOCK , 3 = CENTER
Const StartWaitTime = 500 ' the time to delay before making the next move after taking one or more back
Const StartSkipVars = 0 ' by default we don't skip over variations when parsing moves (Use 1 to skip over them)
Const StartStrictParsing = 1 ' tells the move parser to skip orphaned moves if set to 1 otherwise try to parse them

Const StartDiagSmall = 12 ' 10 to 32 in increments of 2
Const StartDiagMedium = 18 ' 10 to 32 in increments of 2
Const StartDiagLarge = 22 ' 10 to 32 in increments of 2
Const StartFont = 0 ' 0 = Linares 1 = Zurich, 2 = Hastings
Const StartLanguage = 0 ' 0 = English "PNBRQK" 1 = "BSLTDK" 2 = "PSLTDK" 3 = "PCFTDR" 4 = "PCATDR"
Const StartBorder = 2 ' 2 = Single border (1 = Thick, 2 = Single 3 = Double, 4 = Wide, 5 = Single Algebraic, 6 = Double Algebraic)
Const StartSingleFigs = 1 ' Convert single letters to Figs (0 diables this.)

Const StartFigNudge = 1 ' Nudge Figurines up 1 pt. (0 disables this)

' Start Variables for the Insert Opening Index Dialog ---------

Const StartOpenIndexGameReference = 2 ' 0=Number Only 1=Page Number 2=Hyperlink
Const StartOpenIndexOpeningNames = 1 ' 0=None 1=Opening Only 2=Openign+Variation 3=Opening+Var+SubVar
Const StartOpenIndexIgnoreGameFragment = 1 ' 0=Use Game Fragments 1=Ignore Game Fragments
Const StartOpenIndexFigurines = 1 ' 0=Dont use Figurines, 1=Use Figurines

' Start Variables for the Insert Game Index Dialog ---------

Const StartGameIndexGameReference = 2 ' 0=Number Only 1=Page Number 2=Hyperlink
Const StartGameMainPlayerName = "" ' Used for the name of the player to make an Oppoent Index of
Const StartGameIndexUseLetterHeadings = 1 ' 0=Don't use them 1=Use them
Const StartGameIndexCapEntryName = 1 ' 0=Don't captitalize Entry Names 1=Capitalize them
Const StartGameIndexIncludeOpponentNames = 1 ' 0=Don't Include them 1=Include them
Const StartGameIndexIgnoreGameFragment = 1 ' 0=Use Game Fragments 1=Ignore Game Fragments
Const StartGameIndexTabLetterHeadings = 0 ' 0=Don't wrie a Tab for letter headings 1=Write a Tab
Const StartGameCreateOpponentIndex = 0 ' 0=Don't create an opponent index 1Do


' Start Variables for the Insert PGN & Quiz Dialog ------------

Const StartPGNGameFormatStyle = 0 ' 0=Traditional 1=Classical, 2=Modern
Const StartPGNBoldGameMoves = 1 ' Use Bold for actual Game Moves (not variations) 0=Don't use Bold
Const StartPGNUseFigurines = 1 ' Use Figurines for Game Moves 0=Don't use Figurines
Const StartPGNResetDiagramNumber = 1 ' Reset Diagram Number to 1 for each new Game (0 disbles this)
Const StartPGNGameNumber = 1 ' First Game Numbered 1
Const StartPGNDiagramNumber = 0 ' First Diagram Numbered 1 (0 cancels diagram numbering)
Const StartUseQuizInfo = 0 ' Don't use Game Info in Quiz Solution (set to 1 if you want it)
Const StartQuizSelection = 3 ' Start with 3 Diagrams across the page (Legal values are 1 to 4)
Const StartMoveNumberPeriod = 0 ' Don't write a Period after the Move Nubmber (set to 1 if you want it)
Const StartDiagramCaptions = 0 ' Don't write a Caption under the Diagrams (set to 1 if you want them)

Const StartCaptionSize = 12 ' Font size to use for Diagram Captions. Valid options are 8,10,12,14 ONLY!
Const StartInfoSize = 10 ' Font size to use for Game Information. Valid options are 8,10,12,14 ONLY!
Const StartUseInfoBox = 1 ' If you don't want the InfoBox for your games, set this to zero
Const StartInfoWidth = 75 ' Width of Game InfoBox as a % of columns width
Const StartInfoBorder = 1 ' Single Border for InfoBox (2 is Double border)
Const StartTextSize = 12 ' Font size to use forGame Text. Valid options are 8,10,12,14 ONLY!
Const StartLinkedQuiz = 0 ' Detemines whether we link the Quiz diagram number to hte solution New Code: May 30, 2014
Const StartTwoQuizSolColumns = 0 ' Determines if we use two columns for Quiz solutions New Code: July 21, 2014
Const StartQuizSolDiagSize = 16 ' Determines the size to use diagrams created as part of the Quiz solutions New Code: July 23, 2014
Const StartBracket1stLevelVars = 0 ' by defualt we don't bracket 1st level vars in Quiz solutions! New Code: July 26, 2014

' Start Variables for the Insert Crosstable  Dialog ------------

Const StartXTableBorders = 1 ' 1=Borders
Const StartXTableFontSize = 10 '
Const StartXTablePadding = 10 '
Const StartXTableTitles = 0 '
Const StartXTableElos = 0 '
Const StartXTableNameFormat = 0 ' Last name only
Const StartXTableMaxSwissPlayers = 20 ' Maximum no. of player to add to a Swiss crosstable
Const StartXTablePerfElo = 0 ' Don't bothe writing a Performance Rating Column

The numbers, in red, are the values that you can change.

Most of the above Start Variables are clear enough to understand and the comments following them describe the allowable options.

There is, however, one more important pseudo-start variable that you may wish to alter. This is the small array of available fonts to be used for the text of inserted PNG games or a Quiz. By default, the Template has four different text fonts pre- recognized. They are: Times New Roman, Palatino Linotype, Calibri and Gisha. In almost all instances you'll want to stick with Times New Roman, but you can choose any text font that you wish. In fact, in the Insert PGN Dialog or the Insert Quiz Dialog, you can select any of the available text fonts shown in the list, or you can enter your own favorite text font in the list and it will be remembered for the duration of your editing session. But you can easily add any text font that you wish to the Template permanently, just as you can do for the Start Variables. All you have to do is ad the name of your favorite font to the TextFontNames list that is located inside the OoChess Sub. This is the Template's initialization subroutine that gets called whenever you open a document with the Template. It is located near the top of the Template's Basic code, just after the long list of various variables. It looks like this:

' ------ This is the Initialization Macro ----------------------------
Sub OoChess
   TextFontNames = array("Times New Roman", "Palatino Linotype", "Calibri", "Gisha", "", "", "", "", "", "")
   TextFont = "Times New Roman"

As you can see above, there are already four fonts in the list, but there is room for ten font names in total. Let's assume that you wanted to add the font Arial to the list permanently. All you would need to do is simply find the first empty string in the list, and replace it with "Arial". If you did this in the above example, you'd end up with:

   TextFontNames = array("Times New Roman", "Palatino Linotype", "Calibri", "Gisha", "Ariel", "", "", "", "", "")

 This will permanently add the font Arial to your Template file and it will always be available to you in the font list of both the Insert PGN and Insert Quiz Dialogs.

This might seem like a strange way to add fonts to a list, but it is much better than trying to add all the fonts installed on a computer to a drop down list. Almost all of the fonts installed on your computer are unsuitable to use as a text font for chess, and all of these fonts would have to be sorted by name as well. Furthermore, many of the fonts that should be removed from such a list, such as mathematical symbols or web symbols, etc., are poorly identified as 'symbol' fonts, and so they cannot be reliably removed from a font list. For this reason, I chose to use the current system for choosing a text font. It is both simple and flexible.

Once you have edited the values of the user-configurable start variables, all you need to do is save the new Template file. To do this, simply click on the Save button in the IDE window. (It is the button that looks like a floppy disk.) Close your Template file, and then right-click on it and select New to start a new document.

No comments:

Post a Comment