Mercurial > octave
changeset 26340:661fe14264c6
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 01 Jan 2019 08:13:41 -0800 |
parents | 4bad0d5b97b3 (current diff) b880c6426424 (diff) |
children | ddf1cfd62a86 |
files | libinterp/corefcn/ft-text-renderer.cc |
diffstat | 10 files changed, 67 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/bootstrap.conf Mon Dec 31 13:29:02 2018 -0800 +++ b/bootstrap.conf Tue Jan 01 08:13:41 2019 -0800 @@ -94,6 +94,7 @@ uname unicase/u8-tolower unicase/u8-toupper + uniconv/u32-conv-to-enc uniconv/u8-conv-from-enc uniconv/u8-conv-to-enc unictype/ctype-alnum
--- a/libgui/graphics/BaseControl.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libgui/graphics/BaseControl.cc Tue Jan 01 08:13:41 2019 -0800 @@ -52,14 +52,13 @@ else if (props.style_is ("popupmenu")) { // popumenu (QComboBox) is a listbox with a button, so needs set colors for both - p.setColor (QPalette::Base, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); - p.setColor (QPalette::Text, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); - p.setColor (QPalette::Button, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); - p.setColor (QPalette::ButtonText, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); + QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ()); + QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ()); + QString qss = QString ("background: %1 none;\n" + "color: %2;") + .arg(bcol.name ()).arg (fcol.name ()); + w->setStyleSheet(qss); + return; } else if (props.style_is ("radiobutton") || props.style_is ("checkbox")) @@ -72,10 +71,13 @@ else if (props.style_is ("pushbutton") || props.style_is ("togglebutton")) { - p.setColor (QPalette::Button, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); - p.setColor (QPalette::ButtonText, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); + QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ()); + QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ()); + QString qss = QString ("background: %1 none;\n" + "color: %2;") + .arg(bcol.name ()).arg (fcol.name ()); + w->setStyleSheet(qss); + return; } else {
--- a/libgui/graphics/Figure.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libgui/graphics/Figure.cc Tue Jan 01 08:13:41 2019 -0800 @@ -67,25 +67,6 @@ DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar); - static bool - hasUiControlChildren (const figure::properties& fp) - { - gh_manager::auto_lock lock; - - Matrix kids = fp.get_all_children (); - - for (int i = 0; i < kids.numel (); i++) - { - graphics_object go (gh_manager::get_object (kids(i))); - - if (go && (go.isa ("uicontrol") || go.isa ("uipanel") - || go.isa ("uibuttongroup"))) - return true; - } - - return false; - } - static QRect boundingBoxToRect (const Matrix& bb) { @@ -132,8 +113,7 @@ int toffset = 0; if (fp.toolbar_is ("figure") - || (fp.toolbar_is ("auto") && fp.menubar_is ("figure") - && ! hasUiControlChildren (fp))) + || (fp.toolbar_is ("auto") && fp.menubar_is ("figure"))) { toffset += m_figureToolBar->sizeHint ().height (); boffset += m_statusBar->sizeHint ().height (); @@ -496,9 +476,8 @@ showFigureToolBar (false); else if (fp.toolbar_is ("figure")) showFigureToolBar (true); - else // "auto" - showFigureToolBar (! hasUiControlChildren (fp) - && fp.menubar_is ("figure")); + else // "auto" + showFigureToolBar (fp.menubar_is ("figure")); break; case figure::properties::ID_MENUBAR:
--- a/libgui/src/m-editor/file-editor-tab.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue Jan 01 08:13:41 2019 -0800 @@ -69,6 +69,7 @@ #include "marker.h" #include "file-ops.h" +#include "uniconv-wrappers.h" #include "bp-table.h" #include "call-stack.h" @@ -2321,7 +2322,32 @@ return nullptr; } - if (! codec->canEncode (_edit_area->text ())) + QString editor_text = _edit_area->text (); + bool can_encode = codec->canEncode (editor_text); + + // We cannot rely on QTextCodec::canEncode because it uses the + // ConverterState of convertFromUnicode which isn't updated by some + // implementations. + if (can_encode) + { + std::u32string u32_str = editor_text.toStdU32String (); + const uint32_t *src = reinterpret_cast<const uint32_t *> + (u32_str.c_str ()); + + size_t length; + char *res_str = + octave_u32_conv_to_encoding_strict (_encoding.toStdString ().c_str (), + src, u32_str.length (), &length); + if (! res_str) + { + if (errno == EILSEQ) + can_encode = false; + } + else + ::free (static_cast<void *> (res_str)); + } + + if (! can_encode) { QMessageBox::critical (nullptr, tr ("Octave Editor"),
--- a/libgui/src/welcome-wizard.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libgui/src/welcome-wizard.cc Tue Jan 01 08:13:41 2019 -0800 @@ -309,11 +309,11 @@ "<style>\n" "a:link { text-decoration: underline; color: #0000ff; }\n" "</style>\n" - "<head/><body>\n" + "</head><body>\n" "<p>For more information about Octave:</p>\n" "<ul>\n" "<li>Visit <a href=\"https://octave.org\">https://octave.org</a> (opens in external browser)</li>\n" - "<li>Get the documentation online as <a href=\"https://www.gnu.org/software/octave/doc/interpreter/index.html\">html</a>- or <a href=\"https://www.gnu.org/software/octave/octave.pdf\">pdf</span></a>-document (opens in external browser)</li>\n" + "<li>Get the documentation online as <a href=\"https://www.gnu.org/software/octave/doc/interpreter/index.html\">html</a>- or <a href=\"https://www.gnu.org/software/octave/octave.pdf\">pdf</a>-document (opens in external browser)</li>\n" "<li>Open the documentation browser of the Octave GUI with the help menu</li>\n" "</ul>\n" "</body></html>"));
--- a/libinterp/corefcn/ft-text-renderer.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libinterp/corefcn/ft-text-renderer.cc Tue Jan 01 08:13:41 2019 -0800 @@ -659,7 +659,9 @@ { Matrix& bb = line_bbox.back (); bb(1) = m_ymin; - bb(3) = m_ymax - m_ymin; + // Add one pixel to the bbox height to avoid occasional text clipping. + // See bug #55328. + bb(3) = (m_ymax + 1) - m_ymin; if (m_deltax > 0) bb(2) += m_deltax; }
--- a/libinterp/corefcn/octave-link.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libinterp/corefcn/octave-link.cc Tue Jan 01 08:13:41 2019 -0800 @@ -400,7 +400,10 @@ if (args.length () >= 2) value = args(1).string_value(); - return ovl (octave_link::gui_preference (key, value)); + if (octave::application::is_gui_running ()) + return ovl (octave_link::gui_preference (key, value)); + else + return ovl (value); } DEFUN (__octave_link_file_remove__, args, ,
--- a/libinterp/parse-tree/jit-typeinfo.cc Mon Dec 31 13:29:02 2018 -0800 +++ b/libinterp/parse-tree/jit-typeinfo.cc Tue Jan 01 08:13:41 2019 -0800 @@ -2212,7 +2212,7 @@ // FIXME: Finalize what we want to store in octave_builtin, then add // functions to access these values in octave_value - octave_value ov_builtin = symtab.find (name); + octave_value ov_builtin = symtab.builtin_find (name); return dynamic_cast<octave_builtin *> (ov_builtin.internal_rep ()); }
--- a/liboctave/wrappers/uniconv-wrappers.c Mon Dec 31 13:29:02 2018 -0800 +++ b/liboctave/wrappers/uniconv-wrappers.c Tue Jan 01 08:13:41 2019 -0800 @@ -54,6 +54,14 @@ } char * +octave_u32_conv_to_encoding_strict (const char *tocode, const uint32_t *src, + size_t srclen, size_t *lengthp) +{ + return u32_conv_to_encoding (tocode, iconveh_error, + src, srclen, NULL, NULL, lengthp); +} + +char * u8_from_wchar (const wchar_t *wc) { // Convert wide char array to multibyte UTF-8 char array
--- a/liboctave/wrappers/uniconv-wrappers.h Mon Dec 31 13:29:02 2018 -0800 +++ b/liboctave/wrappers/uniconv-wrappers.h Tue Jan 01 08:13:41 2019 -0800 @@ -47,6 +47,10 @@ size_t srclen, size_t *lengthp); extern char * +octave_u32_conv_to_encoding_strict (const char *tocode, const uint32_t *src, + size_t srclen, size_t *lengthp); + +extern char * u8_from_wchar (const wchar_t *wc); extern wchar_t *