Glimmr Canvas Editor

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Spawning new text elements

    Rule for printing a parser error when the command parser error is the i beg your pardon error:
        if the impelling action is drawing a string:
            say "[current cancelation message][line break]";
            deactivate text question mode;
            follow the cancelling drawing rules;
            follow the window-drawing rules for the working window;
            now the impelling action is the action of waiting;[This resets the impelling action so that we don't remain in text question mode.]
            rule succeeds;
        continue the action.

    This is the string creation rule:
        return to normal input;
        now current question is "Please specify the text you want this string to display. Individual strings can only occupy a single line; no line breaks.";
        now current prompt is "Enter a string: >";
        ask a closed question, in text mode.

    A text question rule when drawing mode is true (this is the string element text input rule):
        replace the text "[quotation mark]" in the current answer with "_";
        [replace the regular expression "\pline break\p" in the current answer with "[left-bent-uni-arrow]";[1]]
        create a new rendered string from the currently drawn element in the working window using the current answer;
        follow the cancelling drawing rules;
        follow the window-drawing rules for the working window;
        exit;

    To create a new rendered string from (X - a rendered string) in (win - a g-window) using (text input - indexed text):
        increase the instance-counter of X by 1;
        let the new element be a new object cloned from X;
        now the new element is standard;
        change the display status of new element to g-active;
        unlink the element-name of the new element;
        change the element-name of the new element to "[text input]" concatenated with the instance-counter of X;
        replace the regular expression "\p" in the element-name of the new element with "_";
        replace the text " " in the element-name of the new element with "_";
        replace the regular expression "\b(\w)(\w*)" in the element-name of the new element with "\u1\l2";
        change the x-scaling factor of the new element to the default scaling factor;
        change the y-scaling factor of the new element to the default scaling factor;
        unlink the of-kind of the new element;
        unlink the tag of the new element;
        unlink the replacement-command of the new element;
        [now the of-kind of the new element is the kind-flag of X;***]
        change the display-layer of the new element to the current display-layer;
        change the x-scaling factor of the new element to the default scaling factor;
        change the y-scaling factor of the new element to the default scaling factor;
        unlink the origin of the new element;
        change the origin of the new element to first point;
        unlink the text-string of the new element;
        change the text-string of the new element to text input;
        if the currently drawn element is a bitmap-rendered string:
            change the bit-size of the new element to the current line-weight;
        change the tint of the new element to the current element color;
        change the background tint of the new element to current element background color;
        if the current text alignment is:
            -- left-jambed: change the new element to left-aligned;
            -- centered: change the new element to center-aligned;
            -- right-jambed: change the new element to right-aligned;
        change element-selection set to {};
        add the new element at entry 1 in the element-selection set;
        [follow the window-drawing rules for the layers-window;]
        say "New rendered string element drawn: [element-name of new element].";