static void saveHistory (HyperPage me, const wchar_t *title) { if (! title) return; /* * The page title will be saved at the top. Go there. */ while (my historyPointer < 19 && my history [my historyPointer]. page) my historyPointer ++; /* * If the page title to be saved is already at the top, ignore it. */ if (my history [my historyPointer]. page) { if (wcsequ (my history [my historyPointer]. page, title)) return; } else if (my historyPointer > 0 && wcsequ (my history [my historyPointer - 1]. page, title)) { my historyPointer --; return; } /* * If the history buffer is full, shift it. */ if (my historyPointer == 19 && my history [my historyPointer]. page) { int i; Melder_free (my history [0]. page); for (i = 0; i < 19; i ++) my history [i] = my history [i + 1]; } /* * Add the page title to the top of the history list. */ my history [my historyPointer]. page = Melder_wcsdup_f (title); }
static void print (I, Graphics graphics) { iam (Manual); ManPages manPages = (ManPages) my data; long numberOfPages = manPages -> pages -> size, savePage = my path; my ps = graphics; Graphics_setDollarSignIsCode (my ps, TRUE); Graphics_setAtSignIsLink (my ps, TRUE); my printing = TRUE; HyperPage_initSheetOfPaper ((HyperPage) me); for (long ipage = 1; ipage <= numberOfPages; ipage ++) { ManPage page = (ManPage) manPages -> pages -> item [ipage]; if (my printPagesStartingWith == NULL || Melder_stringMatchesCriterion (page -> title, kMelder_string_STARTS_WITH, my printPagesStartingWith)) { ManPage_Paragraph par; my path = ipage; my paragraphs = page -> paragraphs; my numberOfParagraphs = 0; par = my paragraphs; while ((par ++) -> type) my numberOfParagraphs ++; Melder_free (my currentPageTitle); my currentPageTitle = Melder_wcsdup_f (page -> title); my v_goToPage_i (ipage); my v_draw (); my v_goToPage_i (savePage); } } my printing = FALSE; my printPagesStartingWith = NULL; }
UiFile::UiFile (GuiObject parent, const wchar_t *title, int (*okCallback) (UiForm *sendingForm, const wchar_t *sendingString, Interpreter *interpreter, const wchar_t *invokingButtonTitle, bool modified, void *closure), void *okClosure, const wchar_t *invokingButtonTitle, const wchar_t *helpTitle) : UiForm (parent, title, okCallback, okClosure, invokingButtonTitle, helpTitle), _okClosure(NULL), _shiftKeyPressed(0) { _parent = parent; _name = Melder_wcsdup_f (title); }
static void do_forth (HyperPage me) { if (my historyPointer >= 19 || ! my history [my historyPointer + 1]. page) return; autostring page = Melder_wcsdup_f (my history [++ my historyPointer]. page); int top = my history [my historyPointer]. top; if (my v_goToPage (page.peek())) { my top = top; HyperPage_clear (me); updateVerticalScrollBar (me); } }
static void do_back (HyperPage me) { if (my historyPointer <= 0) return; autostring page = Melder_wcsdup_f (my history [-- my historyPointer]. page); // temporary, because pointer will be moved int top = my history [my historyPointer]. top; if (my v_goToPage (page.peek())) { my top = top; HyperPage_clear (me); updateVerticalScrollBar (me); } }
void Thing_setName (I, const wchar_t *name) { iam (Thing); /* * First check without change. */ wchar *newName = Melder_wcsdup_f (name); // BUG: that's no checking /* * Then change without error. */ Melder_free (my name); my name = newName; our nameChanged (me); // BUG: what if this fails? }
int HyperPage_goToPage (I, const wchar_t *title) { iam (HyperPage); switch (my v_goToPage (title)) { case -1: return 0; case 0: HyperPage_clear (me); return 0; } saveHistory (me, title); /* Last chance: HyperPage_clear will destroy "title" !!! */ Melder_free (my currentPageTitle); my currentPageTitle = Melder_wcsdup_f (title); my top = 0; HyperPage_clear (me); updateVerticalScrollBar (me); /* Scroll to the top (my top == 0). */ return 1; }
Strings FilesInMemory_to_Strings_id (FilesInMemory me) { try { autoStrings thee = Thing_new (Strings); thy strings = NUMvector <wchar *> (1, my size); thy numberOfStrings = 0; for (long ifile = 1; ifile <= my size; ifile++) { FileInMemory fim = (FileInMemory) my item[ifile]; thy strings[ifile] = Melder_wcsdup_f (fim -> d_id); thy numberOfStrings++; } return thee.transfer(); } catch (MelderError) { Melder_throw ("No Strings created from FilesinMemory."); } }
static void replaceOutput (OTGrammarCandidate me) { int abstract = FALSE; Melder_assert (my output != NULL); wchar_t newOutput [100], *q = & newOutput [0]; for (const wchar_t *p = & my output [0]; *p != '\0'; p ++) { if (p [0] == ' ') { *q ++ = p [-1] == ']' || p [1] == '/' ? ' ' : '.'; } else if (isSyllable (p [0])) { *q ++ = 'c'; if (abstract) { *q ++ = 'V'; if (isStress (p [1])) { *q ++ = p [1]; } if (p [0] == 'L') { ; } else if (p [0] == 'H') { *q ++ = 'V'; } else if (p [0] == 'K') { *q ++ = 'c'; } else { *q ++ = 'C'; } } else { *q ++ = 'v'; if (p [0] == 'L') { ; } else if (p [0] == 'H') { *q ++ = ':'; } else { *q ++ = 'c'; } } } else if (isStress (p [0]) && abstract) { ; } else { if (p [0] == '/') abstract = TRUE; *q ++ = p [0]; } } *q = '\0'; Melder_free (my output); my output = Melder_wcsdup_f (newOutput); }
void praat_addAction4 (ClassInfo class1, int n1, ClassInfo class2, int n2, ClassInfo class3, int n3, ClassInfo class4, int n4, const wchar_t *title, const wchar_t *after, unsigned long flags, void (*callback) (UiForm, int, Stackel, const wchar_t *, Interpreter, const wchar_t *, bool, void *)) { try { int depth = flags, unhidable = FALSE, hidden = FALSE, key = 0, attractive = 0; unsigned long motifFlags = 0; if (flags > 7) { depth = ((flags & praat_DEPTH_7) >> 16); unhidable = (flags & praat_UNHIDABLE) != 0; hidden = (flags & praat_HIDDEN) != 0 && ! unhidable; key = flags & 0x000000FF; motifFlags = key ? flags & (0x002000FF | GuiMenu_BUTTON_STATE_MASK) : flags & GuiMenu_BUTTON_STATE_MASK; attractive = (motifFlags & praat_ATTRACTIVE) != 0; } fixSelectionSpecification (& class1, & n1, & class2, & n2, & class3, & n3); if (callback && ! title) Melder_throw ("An action command with callback has no title. Classes: ", class1 ? class1 -> className : L"", L" ", class2 ? class2 -> className : L"", L" ", class3 ? class3 -> className : L"", L" ", class4 ? class4 -> className : L"", L"."); if (! class1) Melder_throw ("The action command \"", title, "\" has no first class."); /* * Determine the position of the new command. */ long position; if (after) { // search for existing command with same selection long found = lookUpMatchingAction (class1, class2, class3, class4, after); if (found == 0) Melder_throw ("The action command \"", title, "\" cannot be put after \"", after, "\",\n" "because the latter command does not exist."); position = found + 1; // after 'after' } else { position = theNumberOfActions + 1; // at end } /* * Increment the command area. */ if (theNumberOfActions >= praat_MAXNUM_LOOSE_COMMANDS) Melder_throw ("Too many action commands (maximum ", praat_MAXNUM_LOOSE_COMMANDS, ")."); theNumberOfActions += 1; /* * Make room for insertion. */ for (long i = theNumberOfActions; i > position; i --) theActions [i] = theActions [i - 1]; memset (& theActions [position], 0, sizeof (struct structPraat_Command)); /* * Insert new command. */ theActions [position]. class1 = class1; theActions [position]. n1 = n1; theActions [position]. class2 = class2; theActions [position]. n2 = n2; theActions [position]. class3 = class3; theActions [position]. n3 = n3; theActions [position]. class4 = class4; theActions [position]. n4 = n4; theActions [position]. title = Melder_wcsdup_f (title); theActions [position]. depth = depth; theActions [position]. callback = callback; /* NULL for a separator. */ theActions [position]. button = NULL; theActions [position]. script = NULL; theActions [position]. hidden = hidden; theActions [position]. unhidable = unhidable; theActions [position]. attractive = attractive; } catch (MelderError) {
static void gui_drawingarea_cb_expose (I, GuiDrawingAreaExposeEvent event) { iam (RunnerMFC); Melder_assert (event -> widget == my d_drawingArea); if (my graphics == NULL) return; // Could be the case in the very beginning. ExperimentMFC experiment = (ExperimentMFC) my data; long iresponse; if (my data == NULL) return; Graphics_setGrey (my graphics, 0.8); Graphics_fillRectangle (my graphics, 0, 1, 0, 1); Graphics_setGrey (my graphics, 0.0); if (experiment -> trial == 0) { Graphics_setTextAlignment (my graphics, Graphics_CENTRE, Graphics_HALF); Graphics_setFontSize (my graphics, 24); Graphics_text (my graphics, 0.5, 0.5, experiment -> startText); } else if (experiment -> pausing) { Graphics_setTextAlignment (my graphics, Graphics_CENTRE, Graphics_HALF); Graphics_setFontSize (my graphics, 24); Graphics_text (my graphics, 0.5, 0.5, experiment -> pauseText); if (experiment -> oops_right > experiment -> oops_left && experiment -> trial > 1) { drawControlButton (me, experiment -> oops_left, experiment -> oops_right, experiment -> oops_bottom, experiment -> oops_top, experiment -> oops_label); } } else if (experiment -> trial <= experiment -> numberOfTrials) { const wchar_t *visibleText = experiment -> stimulus [experiment -> stimuli [experiment -> trial]]. visibleText; wchar_t *visibleText_dup = Melder_wcsdup_f (visibleText ? visibleText : L""), *visibleText_p = visibleText_dup; Graphics_setFont (my graphics, kGraphics_font_TIMES); Graphics_setFontSize (my graphics, 10); Graphics_setColour (my graphics, Graphics_BLACK); Graphics_setTextAlignment (my graphics, Graphics_LEFT, Graphics_TOP); Graphics_text3 (my graphics, 0, 1, Melder_integer (experiment -> trial), L" / ", Melder_integer (experiment -> numberOfTrials)); Graphics_setTextAlignment (my graphics, Graphics_CENTRE, Graphics_TOP); Graphics_setFontSize (my graphics, 24); /* * The run text. */ if (visibleText_p [0] != '\0') { wchar_t *visibleText_q = wcschr (visibleText_p, '|'); if (visibleText_q) *visibleText_q = '\0'; Graphics_text (my graphics, 0.5, 1.0, visibleText_p [0] != '\0' ? visibleText_p : experiment -> runText); if (visibleText_q) visibleText_p = visibleText_q + 1; else visibleText_p += wcslen (visibleText_p); } else { Graphics_text (my graphics, 0.5, 1.0, experiment -> runText); } Graphics_setTextAlignment (my graphics, Graphics_CENTRE, Graphics_HALF); for (iresponse = 1; iresponse <= experiment -> numberOfDifferentResponses; iresponse ++) { ResponseMFC response = & experiment -> response [iresponse]; wchar_t *textToDraw = response -> label; // can be overridden if (visibleText_p [0] != '\0') { wchar_t *visibleText_q = wcschr (visibleText_p, '|'); if (visibleText_q) *visibleText_q = '\0'; textToDraw = visibleText_p; // override if (visibleText_q) visibleText_p = visibleText_q + 1; else visibleText_p += wcslen (visibleText_p); } if (wcsnequ (textToDraw, L"\\FI", 3)) { structMelderFile file; MelderDir_relativePathToFile (& experiment -> rootDirectory, textToDraw + 3, & file); Graphics_imageFromFile (my graphics, Melder_fileToPath (& file), response -> left, response -> right, response -> bottom, response -> top); } else { Graphics_setColour (my graphics, response -> name [0] == '\0' ? Graphics_SILVER : experiment -> responses [experiment -> trial] == iresponse ? Graphics_RED : experiment -> ok_right > experiment -> ok_left || experiment -> responses [experiment -> trial] == 0 ? Graphics_YELLOW : Graphics_SILVER); Graphics_setLineWidth (my graphics, 3.0); Graphics_fillRectangle (my graphics, response -> left, response -> right, response -> bottom, response -> top); Graphics_setColour (my graphics, Graphics_MAROON); Graphics_rectangle (my graphics, response -> left, response -> right, response -> bottom, response -> top); Graphics_setFontSize (my graphics, response -> fontSize ? response -> fontSize : 24); Graphics_text (my graphics, 0.5 * (response -> left + response -> right), 0.5 * (response -> bottom + response -> top), textToDraw); } Graphics_setFontSize (my graphics, 24); } for (iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) { GoodnessMFC goodness = & experiment -> goodness [iresponse]; Graphics_setColour (my graphics, experiment -> responses [experiment -> trial] == 0 ? Graphics_SILVER : experiment -> goodnesses [experiment -> trial] == iresponse ? Graphics_RED : Graphics_YELLOW); Graphics_setLineWidth (my graphics, 3.0); Graphics_fillRectangle (my graphics, goodness -> left, goodness -> right, goodness -> bottom, goodness -> top); Graphics_setColour (my graphics, Graphics_MAROON); Graphics_rectangle (my graphics, goodness -> left, goodness -> right, goodness -> bottom, goodness -> top); Graphics_text (my graphics, 0.5 * (goodness -> left + goodness -> right), 0.5 * (goodness -> bottom + goodness -> top), goodness -> label); } if (experiment -> replay_right > experiment -> replay_left && my numberOfReplays < experiment -> maximumNumberOfReplays) { drawControlButton (me, experiment -> replay_left, experiment -> replay_right, experiment -> replay_bottom, experiment -> replay_top, experiment -> replay_label); } if (experiment -> ok_right > experiment -> ok_left && experiment -> responses [experiment -> trial] != 0 && (experiment -> numberOfGoodnessCategories == 0 || experiment -> goodnesses [experiment -> trial] != 0)) { drawControlButton (me, experiment -> ok_left, experiment -> ok_right, experiment -> ok_bottom, experiment -> ok_top, experiment -> ok_label); } if (experiment -> oops_right > experiment -> oops_left && experiment -> trial > 1) { drawControlButton (me, experiment -> oops_left, experiment -> oops_right, experiment -> oops_bottom, experiment -> oops_top, experiment -> oops_label); } Melder_free (visibleText_dup); } else { Graphics_setTextAlignment (my graphics, Graphics_CENTRE, Graphics_HALF); Graphics_setFontSize (my graphics, 24); Graphics_text (my graphics, 0.5, 0.5, experiment -> endText); if (experiment -> oops_right > experiment -> oops_left && experiment -> trial > 1) { drawControlButton (me, experiment -> oops_left, experiment -> oops_right, experiment -> oops_bottom, experiment -> oops_top, experiment -> oops_label); } } }
int HyperPage_script (I, double width_inches, double height_inches, const wchar_t *script) { iam (HyperPage); wchar_t *text = Melder_wcsdup_f (script); Interpreter interpreter = Interpreter_createFromEnvironment (NULL); double topSpacing = 0.1, bottomSpacing = 0.1, minFooterDistance = 0.0; kGraphics_font font = my font; int size = my fontSize; double true_width_inches = width_inches * ( width_inches < 0.0 ? -1.0 : size / 12.0 ); double true_height_inches = height_inches * ( height_inches < 0.0 ? -1.0 : size / 12.0 ); if (! my printing) { my d_y -= ( my previousBottomSpacing > topSpacing ? my previousBottomSpacing : topSpacing ) * size / 12.0; if (my d_y > PAGE_HEIGHT + true_height_inches || my d_y < PAGE_HEIGHT - SCREEN_HEIGHT) { my d_y -= true_height_inches; } else { my d_y -= true_height_inches; Graphics_setFont (my g, font); Graphics_setFontStyle (my g, 0); Graphics_setFontSize (my g, size); my d_x = true_width_inches > my rightMargin ? 0 : 0.5 * (my rightMargin - true_width_inches); Graphics_setWrapWidth (my g, 0); long x1DCold, x2DCold, y1DCold, y2DCold; Graphics_inqWsViewport (my g, & x1DCold, & x2DCold, & y1DCold, & y2DCold); double x1NDCold, x2NDCold, y1NDCold, y2NDCold; Graphics_inqWsWindow (my g, & x1NDCold, & x2NDCold, & y1NDCold, & y2NDCold); { if (my praatApplication == NULL) my praatApplication = Melder_calloc_f (structPraatApplication, 1); if (my praatObjects == NULL) my praatObjects = Melder_calloc_f (structPraatObjects, 1); if (my praatPicture == NULL) my praatPicture = Melder_calloc_f (structPraatPicture, 1); theCurrentPraatApplication = (PraatApplication) my praatApplication; theCurrentPraatApplication -> batch = true; // prevent creation of editor windows theCurrentPraatApplication -> topShell = theForegroundPraatApplication. topShell; // needed for UiForm_create () in dialogs theCurrentPraatObjects = (PraatObjects) my praatObjects; theCurrentPraatPicture = (PraatPicture) my praatPicture; theCurrentPraatPicture -> graphics = my g; // has to draw into HyperPage rather than Picture window theCurrentPraatPicture -> font = font; theCurrentPraatPicture -> fontSize = size; theCurrentPraatPicture -> lineType = Graphics_DRAWN; theCurrentPraatPicture -> colour = Graphics_BLACK; theCurrentPraatPicture -> lineWidth = 1.0; theCurrentPraatPicture -> arrowSize = 1.0; theCurrentPraatPicture -> x1NDC = my d_x; theCurrentPraatPicture -> x2NDC = my d_x + true_width_inches; theCurrentPraatPicture -> y1NDC = my d_y; theCurrentPraatPicture -> y2NDC = my d_y + true_height_inches; Graphics_setViewport (my g, theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC); Graphics_setWindow (my g, 0.0, 1.0, 0.0, 1.0); long x1DC, y1DC, x2DC, y2DC; Graphics_WCtoDC (my g, 0.0, 0.0, & x1DC, & y2DC); Graphics_WCtoDC (my g, 1.0, 1.0, & x2DC, & y1DC); Graphics_resetWsViewport (my g, x1DC, x2DC, y1DC, y2DC); Graphics_setWsWindow (my g, 0, width_inches, 0, height_inches); theCurrentPraatPicture -> x1NDC = 0; theCurrentPraatPicture -> x2NDC = width_inches; theCurrentPraatPicture -> y1NDC = 0; theCurrentPraatPicture -> y2NDC = height_inches; Graphics_setViewport (my g, theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC); { // scope autoMelderProgressOff progress; autoMelderWarningOff warning; autoMelderSaveDefaultDir saveDir; if (! MelderDir_isNull (& my rootDirectory)) { Melder_setDefaultDir (& my rootDirectory); } try { Interpreter_run (interpreter, text); } catch (MelderError) { if (my scriptErrorHasBeenNotified) { Melder_clearError (); } else { Melder_flushError (NULL); my scriptErrorHasBeenNotified = true; } } } Graphics_setLineType (my g, Graphics_DRAWN); Graphics_setLineWidth (my g, 1.0); Graphics_setArrowSize (my g, 1.0); Graphics_setColour (my g, Graphics_BLACK); /*Graphics_Link *paragraphLinks; long numberOfParagraphLinks = Graphics_getLinks (& paragraphLinks); if (my links) for (long ilink = 1; ilink <= numberOfParagraphLinks; ilink ++) { HyperLink link = HyperLink_create (paragraphLinks [ilink]. name, paragraphLinks [ilink]. x1, paragraphLinks [ilink]. x2, paragraphLinks [ilink]. y1, paragraphLinks [ilink]. y2); Collection_addItem (my links, link); }*/ theCurrentPraatApplication = & theForegroundPraatApplication; theCurrentPraatObjects = & theForegroundPraatObjects; theCurrentPraatPicture = & theForegroundPraatPicture; } Graphics_resetWsViewport (my g, x1DCold, x2DCold, y1DCold, y2DCold); Graphics_setWsWindow (my g, x1NDCold, x2NDCold, y1NDCold, y2NDCold); Graphics_setViewport (my g, 0, 1, 0, 1); Graphics_setWindow (my g, 0, 1, 0, 1); Graphics_setTextAlignment (my g, Graphics_LEFT, Graphics_BOTTOM); } } else { Graphics_setFont (my ps, font); Graphics_setFontStyle (my ps, 0); Graphics_setFontSize (my ps, size); my d_y -= my d_y == PAPER_TOP - TOP_MARGIN ? 0 : ( my previousBottomSpacing > topSpacing ? my previousBottomSpacing : topSpacing ) * size / 12.0; my d_y -= true_height_inches; if (my d_y < PAPER_BOTTOM + BOTTOM_MARGIN + minFooterDistance) { Graphics_nextSheetOfPaper (my ps); if (my d_printingPageNumber) my d_printingPageNumber ++; HyperPage_initSheetOfPaper (me); Graphics_setFont (my ps, font); Graphics_setFontSize (my ps, size); my d_y -= true_height_inches; } my d_x = 3.7 - 0.5 * true_width_inches; if (my d_x < 0) my d_x = 0; Graphics_setWrapWidth (my ps, 0); long x1DCold, x2DCold, y1DCold, y2DCold; Graphics_inqWsViewport (my ps, & x1DCold, & x2DCold, & y1DCold, & y2DCold); double x1NDCold, x2NDCold, y1NDCold, y2NDCold; Graphics_inqWsWindow (my ps, & x1NDCold, & x2NDCold, & y1NDCold, & y2NDCold); { if (my praatApplication == NULL) my praatApplication = Melder_calloc_f (structPraatApplication, 1); if (my praatObjects == NULL) my praatObjects = Melder_calloc_f (structPraatObjects, 1); if (my praatPicture == NULL) my praatPicture = Melder_calloc_f (structPraatPicture, 1); theCurrentPraatApplication = (PraatApplication) my praatApplication; theCurrentPraatApplication -> batch = true; theCurrentPraatApplication -> topShell = theForegroundPraatApplication. topShell; // needed for UiForm_create () in dialogs theCurrentPraatObjects = (PraatObjects) my praatObjects; theCurrentPraatPicture = (PraatPicture) my praatPicture; theCurrentPraatPicture -> graphics = my ps; theCurrentPraatPicture -> font = font; theCurrentPraatPicture -> fontSize = size; theCurrentPraatPicture -> lineType = Graphics_DRAWN; theCurrentPraatPicture -> colour = Graphics_BLACK; theCurrentPraatPicture -> lineWidth = 1.0; theCurrentPraatPicture -> arrowSize = 1.0; theCurrentPraatPicture -> x1NDC = my d_x; theCurrentPraatPicture -> x2NDC = my d_x + true_width_inches; theCurrentPraatPicture -> y1NDC = my d_y; theCurrentPraatPicture -> y2NDC = my d_y + true_height_inches; Graphics_setViewport (my ps, theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC); Graphics_setWindow (my ps, 0.0, 1.0, 0.0, 1.0); long x1DC, y1DC, x2DC, y2DC; Graphics_WCtoDC (my ps, 0.0, 0.0, & x1DC, & y2DC); Graphics_WCtoDC (my ps, 1.0, 1.0, & x2DC, & y1DC); long shift = (long) (Graphics_getResolution (my ps) * true_height_inches) + (y1DCold - y2DCold); Graphics_resetWsViewport (my ps, x1DC, x2DC, y1DC + shift, y2DC + shift); Graphics_setWsWindow (my ps, 0, width_inches, 0, height_inches); theCurrentPraatPicture -> x1NDC = 0; theCurrentPraatPicture -> x2NDC = width_inches; theCurrentPraatPicture -> y1NDC = 0; theCurrentPraatPicture -> y2NDC = height_inches; Graphics_setViewport (my ps, theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC); { // scope autoMelderProgressOff progress; autoMelderWarningOff warning; autoMelderSaveDefaultDir saveDir; if (! MelderDir_isNull (& my rootDirectory)) { Melder_setDefaultDir (& my rootDirectory); } try { Interpreter_run (interpreter, text); } catch (MelderError) { Melder_clearError (); } } Graphics_setLineType (my ps, Graphics_DRAWN); Graphics_setLineWidth (my ps, 1.0); Graphics_setArrowSize (my ps, 1.0); Graphics_setColour (my ps, Graphics_BLACK); theCurrentPraatApplication = & theForegroundPraatApplication; theCurrentPraatObjects = & theForegroundPraatObjects; theCurrentPraatPicture = & theForegroundPraatPicture; } Graphics_resetWsViewport (my ps, x1DCold, x2DCold, y1DCold, y2DCold); Graphics_setWsWindow (my ps, x1NDCold, x2NDCold, y1NDCold, y2NDCold); Graphics_setViewport (my ps, 0, 1, 0, 1); Graphics_setWindow (my ps, 0, 1, 0, 1); Graphics_setTextAlignment (my ps, Graphics_LEFT, Graphics_BOTTOM); } my previousBottomSpacing = bottomSpacing; forget (interpreter); Melder_free (text); return 1; }
void HyperPage_setEntryHint (I, const wchar_t *hint) { iam (HyperPage); Melder_free (my entryHint); my entryHint = Melder_wcsdup_f (hint); }