Címke: new features

Improvements in LibreOffice 6.2

With the support of the FSF.hu Foundation, I have successfully implemented some long-planned LibreLogo improvements. This has made LibreLogo more reliable in LibreOffice, helping more and more people to discover the beauty of programming with LibreLogo, like German schoolchildren or Italian kindergarten teachers. My developments:

  • Adding LibreOffice unit tests for LibreLogo program execution and compiling. Based on this automated testing, Red Hat developer Stephan Bergmann has already found an interesting regex change in Python 3.7 (LibreLogo was written in Python programming language), and he has fixed LibreLogo, too.
  • Compiling Logo expressions to Python, i.e. adding parentheses at the right places uses a parser instead of the former heuristic method. Thus, you can write arbitrarily complex expressions, either in combination with Python lists, and calling own Logo functions with more than one argument without parentheses. Note: In LibreLogo expressions you can use Logo and Python syntaxes at one time. To avoid conflict, now parenthesis directly following the function name, eg. in sin(x) * 2” denotes Python syntax, (meaning 2·sin(x)), while the space separated version, eg. sin (x) * 2”, denotes Logo syntax (meaning “sin(2·x)”, as the simpler Logo expression “sin x * 2”).
  • Function definitions and Logo-like function calls can be in any order, resulting for example completely Logo-like dragon curve drawing Logo program (see on the attached screenshot).
  • Fix of the “magic wand” icon enables a two-sided view, keeping also the debug function “jump text cursor to the wrong LibreLogo program line at compiling”.
  • We can write ASCII and typographical apostrophes in character strings.
  • The running program stops immediately by clicking the Cancel button on the dialog window of the commands INPUT and PRINT (no need to wait starting a new loop in cycles).
  • One of the goals of the planned future LibreLogo developments is to provide a more detailed documentation of LibreLogo’s Python source code. As you can see, I have already tried to do this in the current patches.

These developments will appear soon in the next preliminary version of LibreOffice 6.2.

LibreOffice 5.0

The Document Foundation has announced LibreOffice 5.0, bringing new features including the following useful LibreLogo extension: now it’s possible to join arbitrary number of points using the command POINT with CLOSE and FILL in PENUP mode. For example, drawing a chord is quite easy:
chord

CIRCLE 150
PENUP
FORWARD 75
POINT
BACK 75
RIGHT 60
FORWARD 75
POINT
CLOSE

or drawing a “flat” star:

flatstar

PENUP
REPEAT 5 [
    FORWARD 100
    POINT
    BACK 100
    RIGHT 360/10
    FORWARD 70
    POINT
    BACK 70
    RIGHT 360/10
]
FILLCOLOR “GOLD”
FILL

and drawing nice sheriff badges:
sheriff_mini

TO star n m
PENUP
PENSIZE n/m
REPEAT m [
    FORWARD n
    PENCOLOR “GOLD”
    POINT
    BACK n
    RIGHT 360/m/2
    FORWARD n*0.6
    PENCOLOR “INVISIBLE”
    POINT
    BACK n*0.6
    RIGHT 360/m/2
]
PENCOLOR “INVISIBLE”
FILLCOLOR  “GOLD”
FILL
PENSIZE n/m/3
FILLCOLOR “INVISIBLE”
PENCOLOR “WHITE”
PENDOWN
CIRCLE 2*n*0.6-n/m/3
PENUP
FONTSIZE n/4
FONTCOLOR “WHITE”
FONTFAMILY “Western”
TEXT “SHERIFF”
END

CLEARSCREEN
HOME
HIDETURTLE
PENUP
POSITION [130, 200]
HEADING 0
REPEAT 9 [
  PICTURE [
    star 70 2+REPCOUNT
  ]
  RIGHT 90
  FORWARD 160
  LEFT 90
  IF REPCOUNT % 3 = 0 [
    BACK 160
    RIGHT 90
    BACK 160*3
    LEFT 90
  ]
]

Color and transparency gradients

gradientLibreOffice 4.3 (see daily builds of its development version) will support color and transparency gradients in LibreLogo:

FILLCOLOR [“YELLOW”, “RED”, 2, 0, 0, 25, 75]
FILLTRANSPARENCY [100, 0]
CIRCLE 100

FILLCOLOR defines a radial color gradient, from yellow to red, the center is positioned horizontally 25% and vertically 75% from the left upper corner of the shape. FILLTRANSPARENCY defines a linear transparency gradient, too.
gradient2Next example shows linear color and radial transparency gradients:

FILLCOLOR [“YELLOW”, “RED”]
FILLTRANSPARENCY [100, 0, 2, 0, 0, 25, 75]
CIRCLE 100

gradient3This code draws circles with random color gradients:

PENUP
REPEAT 100 [
    FILLCOLOR [ANY, ANY]
    CIRCLE 20 + RANDOM 130
    POSITION ANY
]