# HG changeset patch # User Rik # Date 1626986403 25200 # Node ID 3eca54836f97bea6a5e97c0806f55e17d99a4103 # Parent da5cc930ff106db6f10049634d989c1c8cef789d Allow 'Label' to be used as a synonym for 'Text' on uimenus (bug #60870) * NEWS: Announce change in Matlab compatibility section. * graphics.in.h (PROPERTIES(uimenu)): Add string_property "text". Change "label" property to have custom get/set routines. * graphics.in.h (get_label, set_label): New functions which intercept get/set of "label" property and forward calls to get_text()/set_text(). * Menu.cc (Menu::Menu, Menu::update): Replace instances of get_label() with get_text(). diff -r da5cc930ff10 -r 3eca54836f97 NEWS --- a/NEWS Thu Jul 22 11:39:14 2021 -0700 +++ b/NEWS Thu Jul 22 13:40:03 2021 -0700 @@ -178,6 +178,10 @@ - The function `importdata` now produces more compatible results when the file contains a 2-D text matrix. +- `uimenu` now accepts property `"Text"` which is identical to +`"Label"`. Matlab recommends using `"Text"` in new code, although there +is no announced date for deprecating `"Label"`. + - The functions `scatter` and `scatter3` now return a handle to a scatter graphics object. For compatibility, they return an `hggroup` of patch graphics objects when the `"gnuplot"` graphics toolkit is used. In diff -r da5cc930ff10 -r 3eca54836f97 libgui/graphics/Menu.cc --- a/libgui/graphics/Menu.cc Thu Jul 22 11:39:14 2021 -0700 +++ b/libgui/graphics/Menu.cc Thu Jul 22 13:40:03 2021 -0700 @@ -87,7 +87,7 @@ { uimenu::properties& up = properties (); - action->setText (Utils::fromStdString (up.get_label ())); + action->setText (Utils::fromStdString (up.get_text ())); if (up.is_checked ()) { @@ -175,8 +175,8 @@ switch (pId) { - case uimenu::properties::ID_LABEL: - action->setText (Utils::fromStdString (up.get_label ())); + case uimenu::properties::ID_TEXT: + action->setText (Utils::fromStdString (up.get_text ())); break; case uimenu::properties::ID_CHECKED: diff -r da5cc930ff10 -r 3eca54836f97 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Thu Jul 22 11:39:14 2021 -0700 +++ b/libinterp/corefcn/graphics.in.h Thu Jul 22 13:40:03 2021 -0700 @@ -5752,15 +5752,27 @@ bool_property checked , "off" bool_property enable , "on" color_property foregroundcolor , color_values (0, 0, 0) - string_property label , "" + string_property label gs , "" double_property position , 0 bool_property separator , "off" + string_property text , "" // Octave-specific properties string_property __fltk_label__ h , "" any_property __object__ h , Matrix () END_PROPERTIES + // Redirect calls from "Label" to "Text". + std::string get_label (void) const + { + return get_text (); + } + + void set_label (const octave_value& val) + { + set_text (val); + } + protected: void init (void) {