# HG changeset patch # User Rik # Date 1398646967 25200 # Node ID fe0e34be55769b965df4d268d7fcb1e8119f0dd9 # Parent 9a6646cc7c3e7f99f04470b9aff1f482ff6c9edb maint: untabify recently added code files. * Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, Canvas.h, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, Figure.h, GLCanvas.h, ListBoxControl.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, Object.h, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc, pt-jit.cc, ov-classdef.cc, ov-classdef.h: Untabify code. diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Backend.cc --- a/libgui/graphics/Backend.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Backend.cc Sun Apr 27 18:02:47 2014 -0700 @@ -53,16 +53,16 @@ if (go.isa ("figure")) return std::string ("__plot_stream__"); else if (go.isa ("uicontrol") - || go.isa ("uipanel") - || go.isa ("uimenu") - || go.isa ("uicontextmenu") - || go.isa ("uitoolbar") - || go.isa ("uipushtool") - || go.isa ("uitoggletool")) + || go.isa ("uipanel") + || go.isa ("uimenu") + || go.isa ("uicontextmenu") + || go.isa ("uitoolbar") + || go.isa ("uipushtool") + || go.isa ("uitoggletool")) return std::string ("__object__"); else qCritical ("QtHandles::Backend: no __object__ property known for object " - "of type %s", go.type ().c_str ()); + "of type %s", go.type ().c_str ()); return std::string (); } @@ -73,7 +73,7 @@ ObjectFactory* factory = ObjectFactory::instance (); connect (this, SIGNAL (createObject (double)), - factory, SLOT (createObject (double))); + factory, SLOT (createObject (double))); } Backend::~Backend (void) @@ -92,13 +92,13 @@ || go.isa ("uitoggletool")) { Logger::debug ("Backend::initialize %s from thread %08x", - go.type ().c_str (), QThread::currentThreadId ()); + go.type ().c_str (), QThread::currentThreadId ()); ObjectProxy* proxy = new ObjectProxy (); graphics_object gObj (go); gObj.get_properties ().set(toolkitObjectProperty (go), - OCTAVE_PTR_TYPE ((OCTAVE_INTPTR_TYPE) proxy)); + OCTAVE_PTR_TYPE ((OCTAVE_INTPTR_TYPE) proxy)); emit createObject (go.get_handle ().value ()); @@ -123,30 +123,30 @@ return; Logger::debug ("Backend::update %s(%d) from thread %08x", - go.type ().c_str (), pId, QThread::currentThreadId ()); + go.type ().c_str (), pId, QThread::currentThreadId ()); ObjectProxy* proxy = toolkitObjectProxy (go); if (proxy) { if (go.isa ("uicontrol") - && pId == uicontrol::properties::ID_STYLE) - { - // Special case: we need to recreate the control widget - // associated with the octave graphics_object + && pId == uicontrol::properties::ID_STYLE) + { + // Special case: we need to recreate the control widget + // associated with the octave graphics_object - finalize (go); - initialize (go); - } + finalize (go); + initialize (go); + } else - proxy->update (pId); + proxy->update (pId); } } void Backend::finalize (const graphics_object& go) { Logger::debug ("Backend::finalize %s from thread %08x", - go.type ().c_str (), QThread::currentThreadId ()); + go.type ().c_str (), QThread::currentThreadId ()); ObjectProxy* proxy = toolkitObjectProxy (go); @@ -168,7 +168,7 @@ ObjectProxy* proxy = toolkitObjectProxy (go); if (proxy) - proxy->redraw (); + proxy->redraw (); } } @@ -189,12 +189,12 @@ octave_value ov = go.get (toolkitObjectProperty (go)); if (ov.is_defined () && ! ov.is_empty ()) - { - OCTAVE_INTPTR_TYPE ptr = ov.OCTAVE_PTR_SCALAR ().value (); + { + OCTAVE_INTPTR_TYPE ptr = ov.OCTAVE_PTR_SCALAR ().value (); - if (! error_state) - return reinterpret_cast (ptr); - } + if (! error_state) + return reinterpret_cast (ptr); + } } return 0; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/BaseControl.cc --- a/libgui/graphics/BaseControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/BaseControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -45,24 +45,24 @@ || props.style_is ("popupmenu")) { p.setColor (QPalette::Base, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); + Utils::fromRgb (props.get_backgroundcolor_rgb ())); p.setColor (QPalette::Text, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); + Utils::fromRgb (props.get_foregroundcolor_rgb ())); } else if (props.style_is ("pushbutton") - || props.style_is ("togglebutton")) + || props.style_is ("togglebutton")) { p.setColor (QPalette::Button, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); + Utils::fromRgb (props.get_backgroundcolor_rgb ())); p.setColor (QPalette::ButtonText, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); + Utils::fromRgb (props.get_foregroundcolor_rgb ())); } else { p.setColor (QPalette::Window, - Utils::fromRgb (props.get_backgroundcolor_rgb ())); + Utils::fromRgb (props.get_backgroundcolor_rgb ())); p.setColor (QPalette::WindowText, - Utils::fromRgb (props.get_foregroundcolor_rgb ())); + Utils::fromRgb (props.get_foregroundcolor_rgb ())); } w->setPalette (p); @@ -83,7 +83,7 @@ Matrix bb = up.get_boundingbox (false); w->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); + xround (bb(2)), xround (bb(3))); w->setFont (Utils::computeFont (up, bb(3))); updatePalette (up, w); w->setEnabled (up.enable_is ("on")); @@ -108,11 +108,11 @@ switch (pId) { case uicontrol::properties::ID_POSITION: - { - Matrix bb = up.get_boundingbox (false); - w->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); - } + { + Matrix bb = up.get_boundingbox (false); + w->setGeometry (xround (bb(0)), xround (bb(1)), + xround (bb(2)), xround (bb(3))); + } break; case uicontrol::properties::ID_FONTNAME: case uicontrol::properties::ID_FONTSIZE: @@ -153,56 +153,56 @@ { case QEvent::Resize: if (m_normalizedFont) - { - gh_manager::auto_lock lock; + { + gh_manager::auto_lock lock; - qWidget ()->setFont (Utils::computeFont - (properties ())); - } + qWidget ()->setFont (Utils::computeFont + (properties ())); + } break; case QEvent::MouseButtonPress: - { - gh_manager::auto_lock lock; + { + gh_manager::auto_lock lock; - QMouseEvent* m = dynamic_cast (event); - graphics_object go = object (); - uicontrol::properties& up = Utils::properties (go); - graphics_object fig = go.get_ancestor ("figure"); + QMouseEvent* m = dynamic_cast (event); + graphics_object go = object (); + uicontrol::properties& up = Utils::properties (go); + graphics_object fig = go.get_ancestor ("figure"); - if (m->button () != Qt::LeftButton - || ! up.enable_is ("on")) - { - gh_manager::post_set (fig.get_handle (), "selectiontype", - Utils::figureSelectionType (m), false); - gh_manager::post_set (fig.get_handle (), "currentpoint", - Utils::figureCurrentPoint (fig, m), - false); - gh_manager::post_callback (fig.get_handle (), - "windowbuttondownfcn"); - gh_manager::post_callback (m_handle, "buttondownfcn"); + if (m->button () != Qt::LeftButton + || ! up.enable_is ("on")) + { + gh_manager::post_set (fig.get_handle (), "selectiontype", + Utils::figureSelectionType (m), false); + gh_manager::post_set (fig.get_handle (), "currentpoint", + Utils::figureCurrentPoint (fig, m), + false); + gh_manager::post_callback (fig.get_handle (), + "windowbuttondownfcn"); + gh_manager::post_callback (m_handle, "buttondownfcn"); - if (m->button () == Qt::RightButton) - ContextMenu::executeAt (up, m->globalPos ()); - } - else - { - if (up.style_is ("listbox")) - gh_manager::post_set (fig.get_handle (), "selectiontype", - Utils::figureSelectionType (m), false); - else - gh_manager::post_set (fig.get_handle (), "selectiontype", - octave_value ("normal"), false); - } - } + if (m->button () == Qt::RightButton) + ContextMenu::executeAt (up, m->globalPos ()); + } + else + { + if (up.style_is ("listbox")) + gh_manager::post_set (fig.get_handle (), "selectiontype", + Utils::figureSelectionType (m), false); + else + gh_manager::post_set (fig.get_handle (), "selectiontype", + octave_value ("normal"), false); + } + } break; case QEvent::MouseMove: if (qWidget ()->hasMouseTracking ()) { - gh_manager::auto_lock lock; + gh_manager::auto_lock lock; - QMouseEvent* m = dynamic_cast (event); - graphics_object go = object (); - graphics_object fig = go.get_ancestor ("figure"); + QMouseEvent* m = dynamic_cast (event); + graphics_object go = object (); + graphics_object fig = go.get_ancestor ("figure"); gh_manager::post_set (fig.get_handle (), "currentpoint", Utils::figureCurrentPoint (fig, m), false); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ButtonControl.cc --- a/libgui/graphics/ButtonControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ButtonControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -46,7 +46,7 @@ Matrix value = up.get_value ().matrix_value (); if (value.numel () > 0 && value(0) == up.get_max ()) - btn->setChecked (true); + btn->setChecked (true); } connect (btn, SIGNAL (clicked (void)), SLOT (clicked (void))); @@ -70,19 +70,19 @@ case uicontrol::properties::ID_VALUE: m_blockCallback = true; if (btn->isCheckable ()) - { - Matrix value = up.get_value ().matrix_value (); + { + Matrix value = up.get_value ().matrix_value (); - if (value.numel () > 0) - { - double dValue = value(0); + if (value.numel () > 0) + { + double dValue = value(0); - if (dValue == up.get_min () && btn->isChecked ()) - btn->setChecked (false); - else if (dValue == up.get_max () && ! btn->isChecked ()) - btn->setChecked (true); - } - } + if (dValue == up.get_min () && btn->isChecked ()) + btn->setChecked (false); + else if (dValue == up.get_max () && ! btn->isChecked ()) + btn->setChecked (true); + } + } m_blockCallback = false; break; default: @@ -105,8 +105,8 @@ double newValue = (checked ? up.get_max () : up.get_min ()); if (oldValue.numel() != 1 - || (newValue != oldValue(0))) - gh_manager::post_set (m_handle, "value", newValue, false); + || (newValue != oldValue(0))) + gh_manager::post_set (m_handle, "value", newValue, false); gh_manager::post_callback (m_handle, "callback"); } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Canvas.cc --- a/libgui/graphics/Canvas.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Canvas.cc Sun Apr 27 18:02:47 2014 -0700 @@ -95,7 +95,7 @@ draw (m_handle); if (m_mouseMode == ZoomMode && m_mouseAxes.ok ()) - drawZoomBox (m_mouseAnchor, m_mouseCurrent); + drawZoomBox (m_mouseAnchor, m_mouseCurrent); } } @@ -109,65 +109,65 @@ axes::properties& ap = Utils::properties (ax); switch (m_mouseMode) - { - case RotateMode: - { - Matrix bb = ap.get_boundingbox (true); - Matrix view = ap.get_view ().matrix_value (); + { + case RotateMode: + { + Matrix bb = ap.get_boundingbox (true); + Matrix view = ap.get_view ().matrix_value (); - // Compute new view angles - view(0) += ((m_mouseCurrent.x () - event->x ()) - * (180.0 / bb(2))); - view(1) += ((event->y () - m_mouseCurrent.y ()) - * (180.0 / bb(3))); + // Compute new view angles + view(0) += ((m_mouseCurrent.x () - event->x ()) + * (180.0 / bb(2))); + view(1) += ((event->y () - m_mouseCurrent.y ()) + * (180.0 / bb(3))); - // Clipping - view(1) = std::min (view(1), 90.0); - view(1) = std::max (view(1), -90.0); - if (view(0) > 180.0) - view(0) -= 360.0; - else if (view(0) < -180.0) - view(0) += 360.0; + // Clipping + view(1) = std::min (view(1), 90.0); + view(1) = std::max (view(1), -90.0); + if (view(0) > 180.0) + view(0) -= 360.0; + else if (view(0) < -180.0) + view(0) += 360.0; - // Snapping - double snapMargin = 1.0; - for (int a = -90; a <= 90; a += 90) - if ((a - snapMargin) < view(1) - && view(1) < (a + snapMargin)) - { - view(1) = a; - break; - } - for (int a = -180; a <= 180; a += 180) - if ((a - snapMargin) < view(0) - && view(0) < (a + snapMargin)) - { - if (a == 180) - view(0) = -180; - else - view(0) = a; - break; - } + // Snapping + double snapMargin = 1.0; + for (int a = -90; a <= 90; a += 90) + if ((a - snapMargin) < view(1) + && view(1) < (a + snapMargin)) + { + view(1) = a; + break; + } + for (int a = -180; a <= 180; a += 180) + if ((a - snapMargin) < view(0) + && view(0) < (a + snapMargin)) + { + if (a == 180) + view(0) = -180; + else + view(0) = a; + break; + } - // Update axes properties - ap.set_view (view); + // Update axes properties + ap.set_view (view); - // Update current mouse position - m_mouseCurrent = event->pos (); + // Update current mouse position + m_mouseCurrent = event->pos (); - // Force immediate redraw - redraw (true); - } - break; - case ZoomMode: - m_mouseCurrent = event->pos(); - redraw (true); - break; - case PanMode: - break; - default: - break; - } + // Force immediate redraw + redraw (true); + } + break; + case ZoomMode: + m_mouseCurrent = event->pos(); + redraw (true); + break; + case PanMode: + break; + default: + break; + } } else if (m_mouseMode == NoMode) { @@ -178,8 +178,8 @@ graphics_object figObj (obj.get_ancestor ("figure")); updateCurrentPoint (figObj, obj, event); - gh_manager::post_callback (figObj.get_handle (), - "windowbuttonmotionfcn"); + gh_manager::post_callback (figObj.get_handle (), + "windowbuttonmotionfcn"); } } } @@ -199,24 +199,24 @@ octave_idx_type num_children = children.numel (); for (int i = 0; i < num_children; i++) - { - graphics_object childObj (gh_manager::get_object (children(i))); + { + graphics_object childObj (gh_manager::get_object (children(i))); if (childObj.isa ("axes")) axesList.append (childObj); - else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")) - { - Matrix bb = childObj.get_properties ().get_boundingbox (false); - QRectF r (bb(0), bb(1), bb(2), bb(3)); + else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")) + { + Matrix bb = childObj.get_properties ().get_boundingbox (false); + QRectF r (bb(0), bb(1), bb(2), bb(3)); - r.adjust (-5, -5, 5, 5); - if (r.contains (event->posF ())) - { - currentObj = childObj; - break; - } - } - } + r.adjust (-5, -5, 5, 5); + if (r.contains (event->posF ())) + { + currentObj = childObj; + break; + } + } + } if (! currentObj) { @@ -269,61 +269,61 @@ MouseMode newMouseMode = NoMode; if (fig) - newMouseMode = fig->mouseMode (); + newMouseMode = fig->mouseMode (); switch (newMouseMode) - { - case NoMode: - gh_manager::post_set (figObj.get_handle (), "selectiontype", - Utils::figureSelectionType (event), false); + { + case NoMode: + gh_manager::post_set (figObj.get_handle (), "selectiontype", + Utils::figureSelectionType (event), false); updateCurrentPoint (figObj, obj, event); - gh_manager::post_callback (figObj.get_handle (), - "windowbuttondownfcn"); + gh_manager::post_callback (figObj.get_handle (), + "windowbuttondownfcn"); gh_manager::post_callback (currentObj.get_handle (), "buttondownfcn"); - if (event->button () == Qt::RightButton) - ContextMenu::executeAt (currentObj.get_properties (), - event->globalPos ()); - break; - case RotateMode: - case ZoomMode: - case PanMode: - if (axesObj) - { - if (event->buttons () == Qt::LeftButton - && event->modifiers () == Qt::NoModifier) - { - m_mouseAnchor = m_mouseCurrent = event->pos (); - m_mouseAxes = axesObj.get_handle (); - m_mouseMode = newMouseMode; - } - else if (newMouseMode == ZoomMode - && event->modifiers () == Qt::NoModifier) - { - switch (event->buttons ()) - { - case Qt::RightButton: - Utils::properties (axesObj).unzoom (); - break; - case Qt::MidButton: - { - axes::properties& ap = - Utils::properties (axesObj); + if (event->button () == Qt::RightButton) + ContextMenu::executeAt (currentObj.get_properties (), + event->globalPos ()); + break; + case RotateMode: + case ZoomMode: + case PanMode: + if (axesObj) + { + if (event->buttons () == Qt::LeftButton + && event->modifiers () == Qt::NoModifier) + { + m_mouseAnchor = m_mouseCurrent = event->pos (); + m_mouseAxes = axesObj.get_handle (); + m_mouseMode = newMouseMode; + } + else if (newMouseMode == ZoomMode + && event->modifiers () == Qt::NoModifier) + { + switch (event->buttons ()) + { + case Qt::RightButton: + Utils::properties (axesObj).unzoom (); + break; + case Qt::MidButton: + { + axes::properties& ap = + Utils::properties (axesObj); - ap.clear_zoom_stack (); - ap.set_xlimmode ("auto"); - ap.set_ylimmode ("auto"); - ap.set_zlimmode ("auto"); - } - break; - } - redraw (false); - } - } - break; - default: - break; - } + ap.clear_zoom_stack (); + ap.set_xlimmode ("auto"); + ap.set_ylimmode ("auto"); + ap.set_zlimmode ("auto"); + } + break; + } + redraw (false); + } + } + break; + default: + break; + } } } @@ -337,26 +337,26 @@ graphics_object ax = gh_manager::get_object (m_mouseAxes); if (ax.valid_object ()) - { - axes::properties& ap = Utils::properties (ax); + { + axes::properties& ap = Utils::properties (ax); - ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (), - m_mouseAnchor.y ()); - ColumnVector p1 = ap.pixel2coord (event->x (), - event->y ()); + ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (), + m_mouseAnchor.y ()); + ColumnVector p1 = ap.pixel2coord (event->x (), + event->y ()); - Matrix xl (1, 2, 0.0); - Matrix yl (1, 2, 0.0); + Matrix xl (1, 2, 0.0); + Matrix yl (1, 2, 0.0); - xl(0) = std::min (p0(0), p1(0)); - xl(1) = std::max (p0(0), p1(0)); - yl(0) = std::min (p0(1), p1(1)); - yl(1) = std::max (p0(1), p1(1)); + xl(0) = std::min (p0(0), p1(0)); + xl(1) = std::max (p0(0), p1(0)); + yl(0) = std::min (p0(1), p1(1)); + yl(1) = std::max (p0(1), p1(1)); - ap.zoom (xl, yl); + ap.zoom (xl, yl); - redraw (false); - } + redraw (false); + } } else if (m_mouseMode == NoMode) { @@ -407,7 +407,7 @@ } Canvas* Canvas::create (const std::string& /* name */, QWidget* parent, - const graphics_handle& handle) + const graphics_handle& handle) { // Only OpenGL return new GLCanvas (parent, handle); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Canvas.h --- a/libgui/graphics/Canvas.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Canvas.h Sun Apr 27 18:02:47 2014 -0700 @@ -58,7 +58,7 @@ virtual QWidget* qWidget (void) = 0; static Canvas* create (const std::string& name, QWidget* parent, - const graphics_handle& handle); + const graphics_handle& handle); protected: virtual void draw (const graphics_handle& handle) = 0; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/CheckBoxControl.cc --- a/libgui/graphics/CheckBoxControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/CheckBoxControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -41,7 +41,7 @@ Container* container = parent->innerContainer (); if (container) - return new CheckBoxControl (go, new QCheckBox (container)); + return new CheckBoxControl (go, new QCheckBox (container)); } return 0; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Container.cc --- a/libgui/graphics/Container.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Container.cc Sun Apr 27 18:02:47 2014 -0700 @@ -54,18 +54,18 @@ graphics_object go = gh_manager::get_object (handle); if (go) - { - graphics_object fig = go.get_ancestor ("figure"); + { + graphics_object fig = go.get_ancestor ("figure"); - m_canvas = Canvas::create (fig.get("renderer").string_value (), - this, handle); + m_canvas = Canvas::create (fig.get("renderer").string_value (), + this, handle); - QWidget* canvasWidget = m_canvas->qWidget (); + QWidget* canvasWidget = m_canvas->qWidget (); - canvasWidget->lower (); - canvasWidget->show (); - canvasWidget->setGeometry (0, 0, width (), height ()); - } + canvasWidget->lower (); + canvasWidget->show (); + canvasWidget->setGeometry (0, 0, width (), height ()); + } } return m_canvas; @@ -81,18 +81,18 @@ foreach (QObject* qObj, children ()) { if (qObj->isWidgetType ()) - { - Object* obj = Object::fromQObject (qObj); + { + Object* obj = Object::fromQObject (qObj); - if (obj) - { - Matrix bb = obj->properties ().get_boundingbox (false); + if (obj) + { + Matrix bb = obj->properties ().get_boundingbox (false); - obj->qWidget () - ->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); - } - } + obj->qWidget () + ->setGeometry (xround (bb(0)), xround (bb(1)), + xround (bb(2)), xround (bb(3))); + } + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ContextMenu.cc --- a/libgui/graphics/ContextMenu.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ContextMenu.cc Sun Apr 27 18:02:47 2014 -0700 @@ -71,19 +71,19 @@ { case base_properties::ID_VISIBLE: if (up.is_visible ()) - { - Matrix pos = up.get_position ().matrix_value (); - QWidget* parentW = menu->parentWidget (); - QPoint pt; + { + Matrix pos = up.get_position ().matrix_value (); + QWidget* parentW = menu->parentWidget (); + QPoint pt; - pt.rx () = xround (pos(0)); - pt.ry () = parentW->height () - xround (pos(1)); - pt = parentW->mapToGlobal (pt); + pt.rx () = xround (pos(0)); + pt.ry () = parentW->height () - xround (pos(1)); + pt = parentW->mapToGlobal (pt); - menu->popup (pt); - } + menu->popup (pt); + } else - menu->hide (); + menu->hide (); break; default: Object::update (pId); @@ -116,18 +116,18 @@ graphics_object go = gh_manager::get_object (h); if (go.valid_object ()) - { - ContextMenu* cMenu = - dynamic_cast (Backend::toolkitObject (go)); + { + ContextMenu* cMenu = + dynamic_cast (Backend::toolkitObject (go)); - if (cMenu) - { - QMenu* menu = cMenu->qWidget (); + if (cMenu) + { + QMenu* menu = cMenu->qWidget (); - if (menu) - menu->popup (pt); - } - } + if (menu) + menu->popup (pt); + } + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/EditControl.cc --- a/libgui/graphics/EditControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/EditControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -43,14 +43,14 @@ Container* container = parent->innerContainer (); if (container) - { - uicontrol::properties& up = Utils::properties (go); + { + uicontrol::properties& up = Utils::properties (go); - if ((up.get_max () - up.get_min ()) > 1) - return new EditControl (go, new TextEdit (container)); - else - return new EditControl (go, new QLineEdit (container)); - } + if ((up.get_max () - up.get_min ()) > 1) + return new EditControl (go, new TextEdit (container)); + else + return new EditControl (go, new QLineEdit (container)); + } } return 0; @@ -74,12 +74,12 @@ edit->setText (Utils::fromStdString (up.get_string_string ())); edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), - up.get_verticalalignment ())); + up.get_verticalalignment ())); connect (edit, SIGNAL (textEdited (const QString&)), - SLOT (textChanged (void))); + SLOT (textChanged (void))); connect (edit, SIGNAL (editingFinished (void)), - SLOT (editingFinished (void))); + SLOT (editingFinished (void))); } EditControl::EditControl (const graphics_object& go, TextEdit* edit) @@ -103,9 +103,9 @@ edit->setPlainText (Utils::fromStdString (up.get_string_string ())); connect (edit, SIGNAL (textChanged (void)), - SLOT (textChanged (void))); + SLOT (textChanged (void))); connect (edit, SIGNAL (editingFinished (void)), - SLOT (editingFinished (void))); + SLOT (editingFinished (void))); } EditControl::~EditControl (void) @@ -129,11 +129,11 @@ if (! handled) { switch (pId) - { - default: - BaseControl::update (pId); - break; - } + { + default: + BaseControl::update (pId); + break; + } } } @@ -150,17 +150,17 @@ case uicontrol::properties::ID_HORIZONTALALIGNMENT: case uicontrol::properties::ID_VERTICALALIGNMENT: edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), - up.get_verticalalignment ())); + up.get_verticalalignment ())); return true; case uicontrol::properties::ID_MIN: case uicontrol::properties::ID_MAX: if ((up.get_max () - up.get_min ()) > 1) - { - QWidget* container = edit->parentWidget (); + { + QWidget* container = edit->parentWidget (); - delete edit; - init (new TextEdit (container), true); - } + delete edit; + init (new TextEdit (container), true); + } return true; default: break; @@ -182,12 +182,12 @@ case uicontrol::properties::ID_MIN: case uicontrol::properties::ID_MAX: if ((up.get_max () - up.get_min ()) <= 1) - { - QWidget* container = edit->parentWidget (); + { + QWidget* container = edit->parentWidget (); - delete edit; - init (new QLineEdit (container), true); - } + delete edit; + init (new QLineEdit (container), true); + } return true; default: break; @@ -206,8 +206,8 @@ if (m_textChanged) { QString txt = (m_multiLine - ? qWidget ()->toPlainText () - : qWidget ()->text ()); + ? qWidget ()->toPlainText () + : qWidget ()->text ()); gh_manager::post_set (m_handle, "string", Utils::toStdString (txt), false); gh_manager::post_callback (m_handle, "callback"); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Figure.cc --- a/libgui/graphics/Figure.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Figure.cc Sun Apr 27 18:02:47 2014 -0700 @@ -61,8 +61,8 @@ graphics_object go (gh_manager::get_object (kids(i))); if (go && (go.isa ("uicontrol") || go.isa ("uipanel") - || go.isa ("uibuttongroup"))) - return true; + || go.isa ("uibuttongroup"))) + return true; } return false; @@ -77,7 +77,7 @@ graphics_object go (gh_manager::get_object (kids(i))); if (go && go.isa ("uimenu")) - return true; + return true; } return false; @@ -173,7 +173,7 @@ MouseModeActionGroup* mouseModeGroup = new MouseModeActionGroup (win); connect (mouseModeGroup, SIGNAL (modeChanged (MouseMode)), - SLOT (setMouseMode (MouseMode))); + SLOT (setMouseMode (MouseMode))); m_figureToolBar->addActions (mouseModeGroup->actions ()); m_menuBar = new MenuBar (win); @@ -188,23 +188,23 @@ fileMenu->addAction (tr ("Save &As"))->setEnabled (false); fileMenu->addSeparator (); fileMenu->addAction (tr ("&Close Figure"), this, - SLOT (fileCloseFigure (void)), Qt::CTRL|Qt::Key_W); + SLOT (fileCloseFigure (void)), Qt::CTRL|Qt::Key_W); QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit")); editMenu->menuAction ()->setObjectName ("builtinMenu"); editMenu->addAction (tr ("Cop&y"), this, SLOT (editCopy (void)), - Qt::CTRL|Qt::Key_C)->setEnabled (false); + Qt::CTRL|Qt::Key_C)->setEnabled (false); editMenu->addAction (tr ("Cu&t"), this, SLOT (editCut (void)), - Qt::CTRL|Qt::Key_X)->setEnabled (false); + Qt::CTRL|Qt::Key_X)->setEnabled (false); editMenu->addAction (tr ("&Paste"), this, SLOT (editPaste(void)), - Qt::CTRL|Qt::Key_V)->setEnabled (false); + Qt::CTRL|Qt::Key_V)->setEnabled (false); editMenu->addSeparator (); editMenu->addActions (mouseModeGroup->actions ()); QMenu* helpMenu = m_menuBar->addMenu (tr ("&Help")); helpMenu->menuAction ()->setObjectName ("builtinMenu"); helpMenu->addAction (tr ("&About QtHandles"), this, - SLOT (helpAboutQtHandles (void))); + SLOT (helpAboutQtHandles (void))); helpMenu->addAction (tr ("About &Qt"), qApp, SLOT (aboutQt (void))); m_menuBar->addReceiver (this); @@ -226,12 +226,12 @@ } foreach (QFrame* frame, - qWidget ()->findChildren ("UIPanel")) + qWidget ()->findChildren ("UIPanel")) { Object* obj = Object::fromQObject (frame); if (obj) - obj->slotRedraw (); + obj->slotRedraw (); } } @@ -260,20 +260,20 @@ switch (pId) { case figure::properties::ID_POSITION: - { + { m_innerRect = boundingBoxToRect (fp.get_boundingbox (true)); //qDebug () << "Figure::update(position):" << m_innerRect; - int offset = 0; + int offset = 0; foreach (QToolBar* tb, win->findChildren ()) if (! tb->isHidden ()) offset += tb->sizeHint ().height (); - if (! m_menuBar->isHidden ()) - offset += m_menuBar->sizeHint ().height () + 1; + if (! m_menuBar->isHidden ()) + offset += m_menuBar->sizeHint ().height () + 1; //qDebug () << "Figure::update(position)(adjusted):" << m_innerRect.adjusted (0, -offset, 0, 0); - win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0)); + win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0)); //qDebug () << "Figure::update(position): done"; - } + } break; case figure::properties::ID_NAME: case figure::properties::ID_NUMBERTITLE: @@ -281,17 +281,17 @@ break; case figure::properties::ID_VISIBLE: if (fp.is_visible ()) - QTimer::singleShot (0, win, SLOT (show ())); + QTimer::singleShot (0, win, SLOT (show ())); else - win->hide (); + win->hide (); break; case figure::properties::ID_TOOLBAR: if (fp.toolbar_is ("none")) - showFigureToolBar (false); + showFigureToolBar (false); else if (fp.toolbar_is ("figure")) - showFigureToolBar (true); + showFigureToolBar (true); else // "auto" - showFigureToolBar (! hasUiControlChildren (fp)); + showFigureToolBar (! hasUiControlChildren (fp)); break; case figure::properties::ID_MENUBAR: showMenuBar (fp.menubar_is ("figure")); @@ -332,9 +332,9 @@ QRect r = qWidget ()->geometry (); if (! visible) - r.adjust (0, dy, 0, 0); + r.adjust (0, dy, 0, 0); else - r.adjust (0, -dy, 0, 0); + r.adjust (0, -dy, 0, 0); m_blockUpdates = true; qWidget ()->setGeometry (r); @@ -344,12 +344,12 @@ updateBoundingBox (false); if (visible) - m_mouseMode = m_lastMouseMode; + m_mouseMode = m_lastMouseMode; else - { - m_lastMouseMode = m_mouseMode; - m_mouseMode = NoMode; - } + { + m_lastMouseMode = m_mouseMode; + m_mouseMode = NoMode; + } } } @@ -373,9 +373,9 @@ //qDebug () << "Figure::showMenuBar:" << r; if (! visible) - r.adjust (0, dy, 0, 0); + r.adjust (0, dy, 0, 0); else - r.adjust (0, -dy, 0, 0); + r.adjust (0, -dy, 0, 0); //qDebug () << "Figure::showMenuBar(adjusted):" << r; m_blockUpdates = true; @@ -498,38 +498,38 @@ if (! m_blockUpdates) { if (obj == m_container) - { + { // Do nothing... - } + } else if (obj == m_menuBar) - { - switch (event->type ()) - { - case QEvent::ActionRemoved: - { - QAction* a = dynamic_cast (event)->action (); + { + switch (event->type ()) + { + case QEvent::ActionRemoved: + { + QAction* a = dynamic_cast (event)->action (); - if (! a->isSeparator () - && a->objectName () != "builtinMenu") + if (! a->isSeparator () + && a->objectName () != "builtinMenu") updateMenuBar (); - } - break; - default: - break; - } - } + } + break; + default: + break; + } + } else - { - switch (event->type ()) - { - case QEvent::Close: - event->ignore (); - gh_manager::post_callback (m_handle, "closerequestfcn"); - return true; - default: - break; - } - } + { + switch (event->type ()) + { + case QEvent::Close: + event->ignore (); + gh_manager::post_callback (m_handle, "closerequestfcn"); + return true; + default: + break; + } + } } return false; @@ -541,55 +541,55 @@ { if (watched == m_container) { - switch (event->type ()) - { - case QEvent::Resize: - updateBoundingBox (true, UpdateBoundingBoxSize); - break; - case QEvent::ChildAdded: - if (dynamic_cast (event)->child - ()->isWidgetType()) - { - gh_manager::auto_lock lock; - const figure::properties& fp = properties
(); + switch (event->type ()) + { + case QEvent::Resize: + updateBoundingBox (true, UpdateBoundingBoxSize); + break; + case QEvent::ChildAdded: + if (dynamic_cast (event)->child + ()->isWidgetType()) + { + gh_manager::auto_lock lock; + const figure::properties& fp = properties
(); - showFigureToolBar (! hasUiControlChildren (fp)); - } - default: - break; - } + showFigureToolBar (! hasUiControlChildren (fp)); + } + default: + break; + } } else if (watched == m_menuBar) { - switch (event->type ()) - { - case QEvent::ActionAdded: - { - QAction* a = dynamic_cast (event)->action (); + switch (event->type ()) + { + case QEvent::ActionAdded: + { + QAction* a = dynamic_cast (event)->action (); - if (! a->isSeparator () + if (! a->isSeparator () && a->objectName () != "builtinMenu") updateMenuBar (); - } - break; - default: - break; - } + } + break; + default: + break; + } } else { - switch (event->type ()) - { - case QEvent::Move: - updateBoundingBox (false, UpdateBoundingBoxPosition); - updateBoundingBox (true, UpdateBoundingBoxPosition); - break; - case QEvent::Resize: - updateBoundingBox (false, UpdateBoundingBoxSize); - break; - default: - break; - } + switch (event->type ()) + { + case QEvent::Move: + updateBoundingBox (false, UpdateBoundingBoxPosition); + updateBoundingBox (true, UpdateBoundingBoxPosition); + break; + case QEvent::Resize: + updateBoundingBox (false, UpdateBoundingBoxSize); + break; + default: + break; + } } } } @@ -597,7 +597,7 @@ void Figure::helpAboutQtHandles (void) { QMessageBox::about (qWidget (), tr ("About QtHandles"), - ABOUT_TEXT); + ABOUT_TEXT); } void Figure::fileNewFigure (void) @@ -656,9 +656,9 @@ QRect r = win->geometry (); if (visible) - r.adjust (0, -sz.height (), 0, 0); + r.adjust (0, -sz.height (), 0, 0); else - r.adjust (0, sz.height (), 0, 0); + r.adjust (0, sz.height (), 0, 0); m_blockUpdates = true; win->setGeometry (r); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Figure.h --- a/libgui/graphics/Figure.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Figure.h Sun Apr 27 18:02:47 2014 -0700 @@ -37,11 +37,11 @@ enum MouseMode { - NoMode = 0, - RotateMode = 1, - ZoomMode = 2, - PanMode = 3, - SelectMode = 4 + NoMode = 0, + RotateMode = 1, + ZoomMode = 2, + PanMode = 3, + SelectMode = 4 }; class Container; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/GLCanvas.h --- a/libgui/graphics/GLCanvas.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/GLCanvas.h Sun Apr 27 18:02:47 2014 -0700 @@ -39,7 +39,7 @@ void draw (const graphics_handle& handle); void drawZoomBox (const QPoint& p1, const QPoint& p2); void resize (int /* x */, int /* y */, - int /* width */, int /* height */) { } + int /* width */, int /* height */) { } graphics_object selectFromAxes (const graphics_object& ax, const QPoint& pt); QWidget* qWidget (void) { return this; } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ListBoxControl.cc --- a/libgui/graphics/ListBoxControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ListBoxControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -69,7 +69,7 @@ Container* container = parent->innerContainer (); if (container) - return new ListBoxControl (go, new QListWidget (container)); + return new ListBoxControl (go, new QListWidget (container)); } return 0; @@ -92,25 +92,25 @@ int lc = list->count (); for (octave_idx_type i = 0; i < n; i++) - { - int idx = xround (value(i)); + { + int idx = xround (value(i)); - if (1 <= idx && idx <= lc) - { - list->item (idx-1)->setSelected (true); - if (i == 0 - && list->selectionMode () == - QAbstractItemView::SingleSelection) - break; - } - } + if (1 <= idx && idx <= lc) + { + list->item (idx-1)->setSelected (true); + if (i == 0 + && list->selectionMode () == + QAbstractItemView::SingleSelection) + break; + } + } } list->removeEventFilter (this); list->viewport ()->installEventFilter (this); connect (list, SIGNAL (itemSelectionChanged (void)), - SLOT (itemSelectionChanged (void))); + SLOT (itemSelectionChanged (void))); } ListBoxControl::~ListBoxControl (void) @@ -134,9 +134,9 @@ case uicontrol::properties::ID_MIN: case uicontrol::properties::ID_MAX: if ((up.get_max () - up.get_min ()) > 1) - list->setSelectionMode (QAbstractItemView::ExtendedSelection); + list->setSelectionMode (QAbstractItemView::ExtendedSelection); else - list->setSelectionMode (QAbstractItemView::SingleSelection); + list->setSelectionMode (QAbstractItemView::SingleSelection); break; case uicontrol::properties::ID_VALUE: m_blockCallback = true; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Menu.cc --- a/libgui/graphics/Menu.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Menu.cc Sun Apr 27 18:02:47 2014 -0700 @@ -46,11 +46,11 @@ int keyMod = Qt::CTRL; if (c >= 'A' && c <= 'Z') - keyMod |= Qt::SHIFT; + keyMod |= Qt::SHIFT; if (c >= 'a' && c <= 'z') - c -= ('a' - 'A'); + c -= ('a' - 'A'); if (c >= 'A' && c <= 'Z') - return QKeySequence (keyMod | static_cast (c)); + return QKeySequence (keyMod | static_cast (c)); } return QKeySequence (); @@ -65,7 +65,7 @@ QObject* qObj = parent->qObject (); if (qObj) - return new Menu (go, new QAction (qObj), parent); + return new Menu (go, new QAction (qObj), parent); } return 0; @@ -102,46 +102,46 @@ int pos = static_cast (up.get_position ()); if (pos <= 0) - { - if (m_separator) - m_parent->insertAction (0, m_separator); - m_parent->insertAction (0, action); + { + if (m_separator) + m_parent->insertAction (0, m_separator); + m_parent->insertAction (0, action); - int count = 0; + int count = 0; - foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") - count++; - up.get_property ("position").set - (octave_value (static_cast (count)), true, false); - } + foreach (QAction* a, m_parent->actions ()) + if (! a->isSeparator () && a->objectName () != "builtinMenu") + count++; + up.get_property ("position").set + (octave_value (static_cast (count)), true, false); + } else - { + { - int count = 0; - QAction* before = 0; + int count = 0; + QAction* before = 0; - foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") - { - count++; - if (pos <= count) - { - before = a; - break; - } - } + foreach (QAction* a, m_parent->actions ()) + if (! a->isSeparator () && a->objectName () != "builtinMenu") + { + count++; + if (pos <= count) + { + before = a; + break; + } + } - if (m_separator) - m_parent->insertAction (before, m_separator); - m_parent->insertAction (before, action); + if (m_separator) + m_parent->insertAction (before, m_separator); + m_parent->insertAction (before, action); - if (before) - updateSiblingPositions (); - else - up.get_property ("position").set - (octave_value (static_cast (count+1)), true, false); - } + if (before) + updateSiblingPositions (); + else + up.get_property ("position").set + (octave_value (static_cast (count+1)), true, false); + } } connect (action, SIGNAL (triggered (bool)), SLOT (actionTriggered (void))); @@ -163,76 +163,76 @@ break; case uimenu::properties::ID_CHECKED: if (up.is_checked ()) - { - action->setCheckable (true); - action->setChecked (up.is_checked ()); - } + { + action->setCheckable (true); + action->setChecked (up.is_checked ()); + } else - { - action->setChecked (false); - action->setCheckable (false); - } + { + action->setChecked (false); + action->setCheckable (false); + } break; case uimenu::properties::ID_ENABLE: action->setEnabled (up.is_enable ()); break; case uimenu::properties::ID_ACCELERATOR: if (! action->menu ()) - action->setShortcut (accelSequence (up)); + action->setShortcut (accelSequence (up)); break; case uimenu::properties::ID_SEPARATOR: if (up.is_separator ()) - { - if (! m_separator) - { - m_separator = new QAction (action); - m_separator->setSeparator (true); - m_separator->setVisible (up.is_visible ()); - if (m_parent) - m_parent->insertAction (action, m_separator); - } - } + { + if (! m_separator) + { + m_separator = new QAction (action); + m_separator->setSeparator (true); + m_separator->setVisible (up.is_visible ()); + if (m_parent) + m_parent->insertAction (action, m_separator); + } + } else - { - if (m_separator) - delete m_separator; - m_separator = 0; - } + { + if (m_separator) + delete m_separator; + m_separator = 0; + } break; case uimenu::properties::ID_VISIBLE: action->setVisible (up.is_visible ()); if (m_separator) - m_separator->setVisible (up.is_visible ()); + m_separator->setVisible (up.is_visible ()); break; case uimenu::properties::ID_POSITION: if (m_separator) - m_parent->removeAction (m_separator); + m_parent->removeAction (m_separator); m_parent->removeAction (action); - { - int pos = static_cast (up.get_position ()); - QAction* before = 0; + { + int pos = static_cast (up.get_position ()); + QAction* before = 0; - if (pos > 0) - { - int count = 0; + if (pos > 0) + { + int count = 0; - foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") - { - count++; - if (pos <= count) - { - before = a; - break; - } - } - } + foreach (QAction* a, m_parent->actions ()) + if (! a->isSeparator () && a->objectName () != "builtinMenu") + { + count++; + if (pos <= count) + { + before = a; + break; + } + } + } - if (m_separator) - m_parent->insertAction (before, m_separator); - m_parent->insertAction (before, action); - updateSiblingPositions (); - } + if (m_separator) + m_parent->insertAction (before, m_separator); + m_parent->insertAction (before, action); + updateSiblingPositions (); + } break; default: Object::update (pId); @@ -251,7 +251,7 @@ action->setMenu (_menu); action->setShortcut (QKeySequence ()); connect (_menu, SIGNAL (aboutToShow (void)), - this, SLOT (actionHovered (void))); + this, SLOT (actionHovered (void))); } return _menu; @@ -278,29 +278,29 @@ double count = 1.0; foreach (QAction* a, m_parent->actions ()) - { - if (! a->isSeparator () && a->objectName () != "builtinMenu") - { - Object* aObj = Object::fromQObject (a); + { + if (! a->isSeparator () && a->objectName () != "builtinMenu") + { + Object* aObj = Object::fromQObject (a); - if (aObj) - { - graphics_object go = aObj->object (); + if (aObj) + { + graphics_object go = aObj->object (); - // Probably overkill as a uimenu child can only be another - // uimenu object. - if (go.isa ("uimenu")) - { - uimenu::properties& up = Utils::properties (go); + // Probably overkill as a uimenu child can only be another + // uimenu object. + if (go.isa ("uimenu")) + { + uimenu::properties& up = Utils::properties (go); - up.get_property ("position").set - (octave_value (count), true, false); - } - } + up.get_property ("position").set + (octave_value (count), true, false); + } + } - count++; - } - } + count++; + } + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/MouseModeActionGroup.cc --- a/libgui/graphics/MouseModeActionGroup.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/MouseModeActionGroup.cc Sun Apr 27 18:02:47 2014 -0700 @@ -37,13 +37,13 @@ : QObject (parent), m_current (0) { m_actions.append (new QAction (QIcon (":/images/rotate.png"), - tr ("Rotate"), this)); + tr ("Rotate"), this)); m_actions.append (new QAction (QIcon (":/images/zoom.png"), - tr ("Zoom"), this)); + tr ("Zoom"), this)); m_actions.append (new QAction (QIcon (":/images/pan.png"), - tr ("Pan"), this)); + tr ("Pan"), this)); m_actions.append (new QAction (QIcon (":/images/select.png"), - tr ("Select"), this)); + tr ("Select"), this)); m_actions[2]->setEnabled (false); m_actions[3]->setEnabled (false); @@ -63,23 +63,23 @@ if (! checked) { if (sender () == m_current) - { - m_current = 0; - emit modeChanged (NoMode); - } + { + m_current = 0; + emit modeChanged (NoMode); + } } else { int i = m_actions.indexOf (qobject_cast (sender ())); if (i >= 0) - { - m_current = m_actions[i]; - for (int j = 0; j < m_actions.size (); j++) - if (j != i) - m_actions[j]->setChecked (false); - emit modeChanged (static_cast (i+1)); - } + { + m_current = m_actions[i]; + for (int j = 0; j < m_actions.size (); j++) + if (j != i) + m_actions[j]->setChecked (false); + emit modeChanged (static_cast (i+1)); + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Object.cc --- a/libgui/graphics/Object.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Object.cc Sun Apr 27 18:02:47 2014 -0700 @@ -40,8 +40,8 @@ if (! lock) qCritical ("QtHandles::Object::Object: " - "creating Object (h=%g) without a valid lock!!!", - m_handle.value ()); + "creating Object (h=%g) without a valid lock!!!", + m_handle.value ()); init (obj); } @@ -50,16 +50,16 @@ { if (m_qobject) qCritical ("QtHandles::Object::init: " - "resetting QObject while in invalid state"); + "resetting QObject while in invalid state"); m_qobject = obj; if (m_qobject) { m_qobject->setProperty ("QtHandles::Object", - qVariantFromValue (this)); + qVariantFromValue (this)); connect (m_qobject, SIGNAL (destroyed (QObject*)), - SLOT (objectDestroyed (QObject*))); + SLOT (objectDestroyed (QObject*))); } } @@ -73,8 +73,8 @@ if (! lock) qCritical ("QtHandles::Object::object: " - "accessing graphics object (h=%g) without a valid lock!!!", - m_handle.value ()); + "accessing graphics object (h=%g) without a valid lock!!!", + m_handle.value ()); return gh_manager::get_object (m_handle); } @@ -93,7 +93,7 @@ break; default: if (object ().valid_object ()) - update (pId); + update (pId); break; } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Object.h --- a/libgui/graphics/Object.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Object.h Sun Apr 27 18:02:47 2014 -0700 @@ -55,14 +55,14 @@ typename T::properties& properties (void) { return dynamic_cast - (object ().get_properties ()); + (object ().get_properties ()); } template const typename T::properties& properties (void) const { return dynamic_cast - (object ().get_properties ()); + (object ().get_properties ()); } graphics_object object (void) const; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ObjectFactory.cc --- a/libgui/graphics/ObjectFactory.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ObjectFactory.cc Sun Apr 27 18:02:47 2014 -0700 @@ -62,7 +62,7 @@ if (! s_instanceCreated) { if (QThread::currentThread () != QApplication::instance ()->thread ()) - s_instance.moveToThread (QApplication::instance ()->thread ()); + s_instance.moveToThread (QApplication::instance ()->thread ()); s_instanceCreated = true; } @@ -78,72 +78,72 @@ if (go.valid_object ()) { if (go.get_properties ().is_beingdeleted ()) - qWarning ("ObjectFactory::createObject: object is being deleted"); + qWarning ("ObjectFactory::createObject: object is being deleted"); else - { - ObjectProxy* proxy = Backend::toolkitObjectProxy (go); + { + ObjectProxy* proxy = Backend::toolkitObjectProxy (go); - if (proxy) - { - Logger::debug ("ObjectFactory::createObject: " - "create %s from thread %08x", - go.type ().c_str (), QThread::currentThreadId ()); + if (proxy) + { + Logger::debug ("ObjectFactory::createObject: " + "create %s from thread %08x", + go.type ().c_str (), QThread::currentThreadId ()); - Object* obj = 0; + Object* obj = 0; - if (go.isa ("figure")) - obj = Figure::create (go); - else if (go.isa ("uicontrol")) - { - uicontrol::properties& up = - Utils::properties (go); + if (go.isa ("figure")) + obj = Figure::create (go); + else if (go.isa ("uicontrol")) + { + uicontrol::properties& up = + Utils::properties (go); - if (up.style_is ("pushbutton")) - obj = PushButtonControl::create (go); - else if (up.style_is ("edit")) - obj = EditControl::create (go); - else if (up.style_is ("checkbox")) - obj = CheckBoxControl::create (go); - else if (up.style_is ("radiobutton")) - obj = RadioButtonControl::create (go); - else if (up.style_is ("togglebutton")) - obj = ToggleButtonControl::create (go); - else if (up.style_is ("text")) - obj = TextControl::create (go); - else if (up.style_is ("popupmenu")) - obj = PopupMenuControl::create (go); - else if (up.style_is ("slider")) - obj = SliderControl::create (go); - else if (up.style_is ("listbox")) - obj = ListBoxControl::create (go); - } - else if (go.isa ("uipanel")) - obj = Panel::create (go); - else if (go.isa ("uimenu")) - obj = Menu::create (go); - else if (go.isa ("uicontextmenu")) - obj = ContextMenu::create (go); - else if (go.isa ("uitoolbar")) - obj = ToolBar::create (go); - else if (go.isa ("uipushtool")) - obj = PushTool::create (go); - else if (go.isa ("uitoggletool")) - obj = ToggleTool::create (go); - else - qWarning ("ObjectFactory::createObject: unsupported type `%s'", - go.type ().c_str ()); + if (up.style_is ("pushbutton")) + obj = PushButtonControl::create (go); + else if (up.style_is ("edit")) + obj = EditControl::create (go); + else if (up.style_is ("checkbox")) + obj = CheckBoxControl::create (go); + else if (up.style_is ("radiobutton")) + obj = RadioButtonControl::create (go); + else if (up.style_is ("togglebutton")) + obj = ToggleButtonControl::create (go); + else if (up.style_is ("text")) + obj = TextControl::create (go); + else if (up.style_is ("popupmenu")) + obj = PopupMenuControl::create (go); + else if (up.style_is ("slider")) + obj = SliderControl::create (go); + else if (up.style_is ("listbox")) + obj = ListBoxControl::create (go); + } + else if (go.isa ("uipanel")) + obj = Panel::create (go); + else if (go.isa ("uimenu")) + obj = Menu::create (go); + else if (go.isa ("uicontextmenu")) + obj = ContextMenu::create (go); + else if (go.isa ("uitoolbar")) + obj = ToolBar::create (go); + else if (go.isa ("uipushtool")) + obj = PushTool::create (go); + else if (go.isa ("uitoggletool")) + obj = ToggleTool::create (go); + else + qWarning ("ObjectFactory::createObject: unsupported type `%s'", + go.type ().c_str ()); - if (obj) - proxy->setObject (obj); - } - else - qWarning ("ObjectFactory::createObject: no proxy for handle %g", - handle); - } + if (obj) + proxy->setObject (obj); + } + else + qWarning ("ObjectFactory::createObject: no proxy for handle %g", + handle); + } } else qWarning ("ObjectFactory::createObject: invalid object for handle %g", - handle); + handle); } }; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ObjectProxy.cc --- a/libgui/graphics/ObjectProxy.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ObjectProxy.cc Sun Apr 27 18:02:47 2014 -0700 @@ -43,26 +43,26 @@ if (obj != m_object) { if (m_object) - { - disconnect (this, SIGNAL (sendUpdate (int)), - m_object, SLOT (slotUpdate (int))); - disconnect (this, SIGNAL (sendFinalize (void)), - m_object, SLOT (slotFinalize (void))); - disconnect (this, SIGNAL (sendRedraw (void)), - m_object, SLOT (slotRedraw (void))); - } + { + disconnect (this, SIGNAL (sendUpdate (int)), + m_object, SLOT (slotUpdate (int))); + disconnect (this, SIGNAL (sendFinalize (void)), + m_object, SLOT (slotFinalize (void))); + disconnect (this, SIGNAL (sendRedraw (void)), + m_object, SLOT (slotRedraw (void))); + } m_object = obj; if (m_object) - { - connect (this, SIGNAL (sendUpdate (int)), - m_object, SLOT (slotUpdate (int))); - connect (this, SIGNAL (sendFinalize (void)), - m_object, SLOT (slotFinalize (void))); - connect (this, SIGNAL (sendRedraw (void)), - m_object, SLOT (slotRedraw (void))); - } + { + connect (this, SIGNAL (sendUpdate (int)), + m_object, SLOT (slotUpdate (int))); + connect (this, SIGNAL (sendFinalize (void)), + m_object, SLOT (slotFinalize (void))); + connect (this, SIGNAL (sendRedraw (void)), + m_object, SLOT (slotRedraw (void))); + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/Panel.cc --- a/libgui/graphics/Panel.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/Panel.cc Sun Apr 27 18:02:47 2014 -0700 @@ -58,13 +58,13 @@ static void setupPalette (const uipanel::properties& pp, QPalette& p) { p.setColor (QPalette::Window, - Utils::fromRgb (pp.get_backgroundcolor_rgb ())); + Utils::fromRgb (pp.get_backgroundcolor_rgb ())); p.setColor (QPalette::WindowText, - Utils::fromRgb (pp.get_foregroundcolor_rgb ())); + Utils::fromRgb (pp.get_foregroundcolor_rgb ())); p.setColor (QPalette::Light, - Utils::fromRgb (pp.get_highlightcolor_rgb ())); + Utils::fromRgb (pp.get_highlightcolor_rgb ())); p.setColor (QPalette::Dark, - Utils::fromRgb (pp.get_shadowcolor_rgb ())); + Utils::fromRgb (pp.get_shadowcolor_rgb ())); } static int borderWidthFromProperties (const uipanel::properties& pp) @@ -75,7 +75,7 @@ { bw = xround (pp.get_borderwidth ()); if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout")) - bw *= 2; + bw *= 2; } return bw; @@ -90,7 +90,7 @@ Container* container = parent->innerContainer (); if (container) - return new Panel (go, new QFrame (container)); + return new Panel (go, new QFrame (container)); } return 0; @@ -105,7 +105,7 @@ frame->setAutoFillBackground (true); Matrix bb = pp.get_boundingbox (false); frame->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); + xround (bb(2)), xround (bb(3))); frame->setFrameStyle (frameStyleFromProperties (pp)); frame->setLineWidth (xround (pp.get_borderwidth ())); QPalette pal = frame->palette (); @@ -149,66 +149,66 @@ if (! m_blockUpdates) { if (watched == qObject ()) - { - switch (event->type ()) - { - case QEvent::Resize: - { - gh_manager::auto_lock lock; - graphics_object go = object (); + { + switch (event->type ()) + { + case QEvent::Resize: + { + gh_manager::auto_lock lock; + graphics_object go = object (); - if (go.valid_object ()) - { - if (m_title) - { - const uipanel::properties& pp = - Utils::properties (go); + if (go.valid_object ()) + { + if (m_title) + { + const uipanel::properties& pp = + Utils::properties (go); - if (pp.fontunits_is ("normalized")) - { - QFrame* frame = qWidget (); + if (pp.fontunits_is ("normalized")) + { + QFrame* frame = qWidget (); - m_title->setFont (Utils::computeFont - (pp, frame->height ())); - m_title->resize (m_title->sizeHint ()); - } - } - updateLayout (); - } - } - break; - case QEvent::MouseButtonPress: - { - QMouseEvent* m = dynamic_cast (event); + m_title->setFont (Utils::computeFont + (pp, frame->height ())); + m_title->resize (m_title->sizeHint ()); + } + } + updateLayout (); + } + } + break; + case QEvent::MouseButtonPress: + { + QMouseEvent* m = dynamic_cast (event); - if (m->button () == Qt::RightButton) - { - gh_manager::auto_lock lock; + if (m->button () == Qt::RightButton) + { + gh_manager::auto_lock lock; - ContextMenu::executeAt (properties (), m->globalPos ()); - } - } - break; - default: - break; - } - } + ContextMenu::executeAt (properties (), m->globalPos ()); + } + } + break; + default: + break; + } + } else if (watched == m_container) - { - switch (event->type ()) - { - case QEvent::Resize: - if (qWidget ()->isVisible ()) - { - gh_manager::auto_lock lock; + { + switch (event->type ()) + { + case QEvent::Resize: + if (qWidget ()->isVisible ()) + { + gh_manager::auto_lock lock; - properties ().update_boundingbox (); - } - break; - default: - break; - } - } + properties ().update_boundingbox (); + } + break; + default: + break; + } + } } return false; @@ -224,13 +224,13 @@ switch (pId) { case uipanel::properties::ID_POSITION: - { - Matrix bb = pp.get_boundingbox (false); + { + Matrix bb = pp.get_boundingbox (false); - frame->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); - updateLayout (); - } + frame->setGeometry (xround (bb(0)), xround (bb(1)), + xround (bb(2)), xround (bb(3))); + updateLayout (); + } break; case uipanel::properties::ID_BORDERWIDTH: frame->setLineWidth (xround (pp.get_borderwidth ())); @@ -240,46 +240,46 @@ case uipanel::properties::ID_FOREGROUNDCOLOR: case uipanel::properties::ID_HIGHLIGHTCOLOR: case uipanel::properties::ID_SHADOWCOLOR: - { - QPalette pal = frame->palette (); + { + QPalette pal = frame->palette (); - setupPalette (pp, pal); - frame->setPalette (pal); - if (m_title) - m_title->setPalette (pal); - } + setupPalette (pp, pal); + frame->setPalette (pal); + if (m_title) + m_title->setPalette (pal); + } break; case uipanel::properties::ID_TITLE: - { - QString title = Utils::fromStdString (pp.get_title ()); + { + QString title = Utils::fromStdString (pp.get_title ()); - if (title.isEmpty ()) - { - if (m_title) - delete m_title; - m_title = 0; - } - else - { - if (! m_title) - { - QPalette pal = frame->palette (); + if (title.isEmpty ()) + { + if (m_title) + delete m_title; + m_title = 0; + } + else + { + if (! m_title) + { + QPalette pal = frame->palette (); - m_title = new QLabel (title, frame); - m_title->setAutoFillBackground (true); - m_title->setContentsMargins (4, 0, 4, 0); - m_title->setPalette (pal); - m_title->setFont (Utils::computeFont (pp)); - m_title->show (); - } - else - { - m_title->setText (title); - m_title->resize (m_title->sizeHint ()); - } - } - updateLayout (); - } + m_title = new QLabel (title, frame); + m_title->setAutoFillBackground (true); + m_title->setContentsMargins (4, 0, 4, 0); + m_title->setPalette (pal); + m_title->setFont (Utils::computeFont (pp)); + m_title->show (); + } + else + { + m_title->setText (title); + m_title->resize (m_title->sizeHint ()); + } + } + updateLayout (); + } case uipanel::properties::ID_TITLEPOSITION: updateLayout (); break; @@ -292,11 +292,11 @@ case uipanel::properties::ID_FONTWEIGHT: case uipanel::properties::ID_FONTANGLE: if (m_title) - { - m_title->setFont (Utils::computeFont (pp)); - m_title->resize (m_title->sizeHint ()); - updateLayout (); - } + { + m_title->setFont (Utils::computeFont (pp)); + m_title->resize (m_title->sizeHint ()); + updateLayout (); + } break; case uipanel::properties::ID_VISIBLE: frame->setVisible (pp.is_visible ()); @@ -326,9 +326,9 @@ int bw = borderWidthFromProperties (pp); frame->setFrameRect (QRect (xround (bb(0)) - bw, xround (bb(1)) - bw, - xround (bb(2)) + 2*bw, xround (bb(3)) + 2*bw)); + xround (bb(2)) + 2*bw, xround (bb(3)) + 2*bw)); m_container->setGeometry (xround (bb(0)), xround (bb(1)), - xround (bb(2)), xround (bb(3))); + xround (bb(2)), xround (bb(3))); if (m_blockUpdates) pp.update_boundingbox (); @@ -339,19 +339,19 @@ int offset = 5; if (pp.titleposition_is ("lefttop")) - m_title->move (bw+offset, 0); + m_title->move (bw+offset, 0); else if (pp.titleposition_is ("righttop")) - m_title->move (frame->width () - bw - offset - sz.width (), 0); + m_title->move (frame->width () - bw - offset - sz.width (), 0); else if (pp.titleposition_is ("leftbottom")) - m_title->move (bw+offset, frame->height () - sz.height ()); + m_title->move (bw+offset, frame->height () - sz.height ()); else if (pp.titleposition_is ("rightbottom")) - m_title->move (frame->width () - bw - offset - sz.width (), - frame->height () - sz.height ()); + m_title->move (frame->width () - bw - offset - sz.width (), + frame->height () - sz.height ()); else if (pp.titleposition_is ("centertop")) - m_title->move (frame->width () / 2 - sz.width () / 2, 0); + m_title->move (frame->width () / 2 - sz.width () / 2, 0); else if (pp.titleposition_is ("centerbottom")) - m_title->move (frame->width () / 2 - sz.width () / 2, - frame->height () - sz.height ()); + m_title->move (frame->width () / 2 - sz.width () / 2, + frame->height () - sz.height ()); } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/PopupMenuControl.cc --- a/libgui/graphics/PopupMenuControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/PopupMenuControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -42,7 +42,7 @@ Container* container = parent->innerContainer (); if (container) - return new PopupMenuControl (go, new QComboBox (container)); + return new PopupMenuControl (go, new QComboBox (container)); } return 0; @@ -56,7 +56,7 @@ box->addItems (Utils::fromStdString (up.get_string_string ()).split ('|')); connect (box, SIGNAL (currentIndexChanged (int)), - SLOT (currentIndexChanged (int))); + SLOT (currentIndexChanged (int))); } PopupMenuControl::~PopupMenuControl (void) @@ -72,43 +72,43 @@ { case uicontrol::properties::ID_STRING: m_blockUpdate = true; - { - int oldCurrent = box->currentIndex (); + { + int oldCurrent = box->currentIndex (); - box->clear (); - box->addItems (Utils::fromStdString - (up.get_string_string ()).split ('|')); - if (box->count() > 0 - && oldCurrent >= 0 - && oldCurrent < box->count ()) - { - box->setCurrentIndex (oldCurrent); - } - else - { - gh_manager::post_set (m_handle, "value", - octave_value (box->count () > 0 - ? 1.0 : 0.0), - false); - } - } + box->clear (); + box->addItems (Utils::fromStdString + (up.get_string_string ()).split ('|')); + if (box->count() > 0 + && oldCurrent >= 0 + && oldCurrent < box->count ()) + { + box->setCurrentIndex (oldCurrent); + } + else + { + gh_manager::post_set (m_handle, "value", + octave_value (box->count () > 0 + ? 1.0 : 0.0), + false); + } + } m_blockUpdate = false; break; case uicontrol::properties::ID_VALUE: - { - Matrix value = up.get_value ().matrix_value (); + { + Matrix value = up.get_value ().matrix_value (); - if (value.numel () > 0) - { - int newIndex = int (value(0)) - 1; + if (value.numel () > 0) + { + int newIndex = int (value(0)) - 1; - if (newIndex >= 0 && newIndex < box->count () - && newIndex != box->currentIndex ()) - { - box->setCurrentIndex (newIndex); - } - } - } + if (newIndex >= 0 && newIndex < box->count () + && newIndex != box->currentIndex ()) + { + box->setCurrentIndex (newIndex); + } + } + } break; default: BaseControl::update (pId); @@ -121,8 +121,8 @@ if (! m_blockUpdate) { gh_manager::post_set (m_handle, "value", - octave_value (double (index + 1)), - false); + octave_value (double (index + 1)), + false); gh_manager::post_callback (m_handle, "callback"); } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/PushButtonControl.cc --- a/libgui/graphics/PushButtonControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/PushButtonControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -43,7 +43,7 @@ Container* container = parent->innerContainer (); if (container) - return new PushButtonControl (go, new QPushButton (container)); + return new PushButtonControl (go, new QPushButton (container)); } return 0; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/PushTool.cc --- a/libgui/graphics/PushTool.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/PushTool.cc Sun Apr 27 18:02:47 2014 -0700 @@ -40,7 +40,7 @@ QWidget* parentWidget = parent->qWidget (); if (parentWidget) - return new PushTool (go, new QAction (parentWidget)); + return new PushTool (go, new QAction (parentWidget)); } return 0; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/QtHandlesUtils.cc --- a/libgui/graphics/QtHandlesUtils.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/QtHandlesUtils.cc Sun Apr 27 18:02:47 2014 -0700 @@ -108,9 +108,9 @@ } template QFont computeFont (const uicontrol::properties& props, - int height); + int height); template QFont computeFont (const uipanel::properties& props, - int height); + int height); QColor fromRgb (const Matrix& rgb) { @@ -142,26 +142,26 @@ Qt::KeyboardModifiers mods = event->modifiers (); if (mods == Qt::NoModifier) - { - if (buttons == Qt::LeftButton) - return std::string ("normal"); - else if (buttons == Qt::RightButton) - return std::string ("alt"); + { + if (buttons == Qt::LeftButton) + return std::string ("normal"); + else if (buttons == Qt::RightButton) + return std::string ("alt"); #if defined (Q_WS_WIN) - else if (buttons == (Qt::LeftButton|Qt::RightButton)) - return std::string ("extend"); + else if (buttons == (Qt::LeftButton|Qt::RightButton)) + return std::string ("extend"); #elif defined (Q_WS_X11) - else if (buttons == Qt::MidButton) - return std::string ("extend"); + else if (buttons == Qt::MidButton) + return std::string ("extend"); #endif - } + } else if (buttons == Qt::LeftButton) - { - if (mods == Qt::ShiftModifier) - return std::string ("extend"); - else if (mods == Qt::ControlModifier) - return std::string ("alt"); - } + { + if (mods == Qt::ShiftModifier) + return std::string ("extend"); + else if (mods == Qt::ControlModifier) + return std::string ("alt"); + } } return std::string ("normal"); @@ -176,20 +176,20 @@ Container* c = tkFig->innerContainer (); if (c) - { - QPoint qp = c->mapFromGlobal (event->globalPos ()); + { + QPoint qp = c->mapFromGlobal (event->globalPos ()); - return - tkFig->properties
().map_from_boundingbox (qp.x (), - qp.y ()); - } + return + tkFig->properties
().map_from_boundingbox (qp.x (), + qp.y ()); + } } return Matrix (1, 2, 0.0); } Qt::Alignment fromHVAlign (const caseless_str& halign, - const caseless_str& valign) + const caseless_str& valign) { Qt::Alignment flags; @@ -230,58 +230,58 @@ img.fill (qRgba (0, 0, 0, 0)); if (v.is_uint8_type ()) - { - uint8NDArray d = v.uint8_array_value (); + { + uint8NDArray d = v.uint8_array_value (); - for (int i = 0; i < w; i++) - for (int j = 0; j < h; j++) - { - int r = d(j, i, 0); - int g = d(j, i, 1); - int b = d(j, i, 2); - int a = 255; + for (int i = 0; i < w; i++) + for (int j = 0; j < h; j++) + { + int r = d(j, i, 0); + int g = d(j, i, 1); + int b = d(j, i, 2); + int a = 255; - img.setPixel (x_off + i, y_off + j, qRgba (r, g, b, a)); - } - } + img.setPixel (x_off + i, y_off + j, qRgba (r, g, b, a)); + } + } else if (v.is_single_type ()) - { - FloatNDArray f = v.float_array_value (); + { + FloatNDArray f = v.float_array_value (); - for (int i = 0; i < w; i++) - for (int j = 0; j < h; j++) - { - float r = f(j, i, 0); - float g = f(j, i, 1); - float b = f(j, i, 2); - int a = (xisnan (r) || xisnan (g) || xisnan (b) ? 0 : 255); + for (int i = 0; i < w; i++) + for (int j = 0; j < h; j++) + { + float r = f(j, i, 0); + float g = f(j, i, 1); + float b = f(j, i, 2); + int a = (xisnan (r) || xisnan (g) || xisnan (b) ? 0 : 255); - img.setPixel (x_off + i, y_off + j, - qRgba (xround (r * 255), - xround (g * 255), - xround (b * 255), - a)); - } - } + img.setPixel (x_off + i, y_off + j, + qRgba (xround (r * 255), + xround (g * 255), + xround (b * 255), + a)); + } + } else if (v.is_real_type ()) - { - NDArray d = v.array_value (); + { + NDArray d = v.array_value (); - for (int i = 0; i < w; i++) - for (int j = 0; j < h; j++) - { - double r = d(j, i, 0); - double g = d(j, i, 1); - double b = d(j, i, 2); - int a = (xisnan (r) || xisnan (g) || xisnan (b) ? 0 : 255); + for (int i = 0; i < w; i++) + for (int j = 0; j < h; j++) + { + double r = d(j, i, 0); + double g = d(j, i, 1); + double b = d(j, i, 2); + int a = (xisnan (r) || xisnan (g) || xisnan (b) ? 0 : 255); - img.setPixel (x_off + i, y_off + j, - qRgba (xround (r * 255), - xround (g * 255), - xround (b * 255), - a)); - } - } + img.setPixel (x_off + i, y_off + j, + qRgba (xround (r * 255), + xround (g * 255), + xround (b * 255), + a)); + } + } return img; } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/QtHandlesUtils.h --- a/libgui/graphics/QtHandlesUtils.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/QtHandlesUtils.h Sun Apr 27 18:02:47 2014 -0700 @@ -54,10 +54,10 @@ Matrix toRgb (const QColor& c); Qt::Alignment fromHVAlign (const caseless_str& halign, - const caseless_str& valign); + const caseless_str& valign); std::string figureSelectionType (QMouseEvent* event, - bool isDoubleClick = false); + bool isDoubleClick = false); Matrix figureCurrentPoint (const graphics_object& fig, QMouseEvent* event); @@ -72,7 +72,7 @@ { return Utils::properties (gh_manager::get_object (h)); } QImage makeImageFromCData (const octave_value& v, int width = -1, - int height = -1); + int height = -1); octave_scalar_map makeKeyEventStruct (QKeyEvent* event); }; diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/RadioButtonControl.cc --- a/libgui/graphics/RadioButtonControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/RadioButtonControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -42,14 +42,14 @@ Container* container = parent->innerContainer (); if (container) - return new RadioButtonControl (go, new QRadioButton (container)); + return new RadioButtonControl (go, new QRadioButton (container)); } return 0; } RadioButtonControl::RadioButtonControl (const graphics_object& go, - QRadioButton* radio) + QRadioButton* radio) : ButtonControl (go, radio) { radio->setAutoFillBackground (true); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/SliderControl.cc --- a/libgui/graphics/SliderControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/SliderControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -44,14 +44,14 @@ Container* container = parent->innerContainer (); if (container) - return new SliderControl (go, new QScrollBar (container)); + return new SliderControl (go, new QScrollBar (container)); } return 0; } SliderControl::SliderControl (const graphics_object& go, - QAbstractSlider* slider) + QAbstractSlider* slider) : BaseControl (go, slider), m_blockUpdates (false) { uicontrol::properties& up = properties (); @@ -70,7 +70,7 @@ double dmin = up.get_min (), dmax = up.get_max (); slider->setValue (xround (((value(0) - dmin) / (dmax - dmin)) - * RANGE_INT_MAX)); + * RANGE_INT_MAX)); } connect (slider, SIGNAL (valueChanged (int)), SLOT (valueChanged (int))); @@ -88,28 +88,28 @@ switch (pId) { case uicontrol::properties::ID_SLIDERSTEP: - { - Matrix steps = up.get_sliderstep ().matrix_value (); + { + Matrix steps = up.get_sliderstep ().matrix_value (); - slider->setSingleStep (xround (steps(0) * RANGE_INT_MAX)); - slider->setPageStep (xround (steps(1) * RANGE_INT_MAX)); - } + slider->setSingleStep (xround (steps(0) * RANGE_INT_MAX)); + slider->setPageStep (xround (steps(1) * RANGE_INT_MAX)); + } break; case uicontrol::properties::ID_VALUE: - { - Matrix value = up.get_value ().matrix_value (); - double dmax = up.get_max (), dmin = up.get_min (); + { + Matrix value = up.get_value ().matrix_value (); + double dmax = up.get_max (), dmin = up.get_min (); - if (value.numel () > 0) - { - int ival = xround (((value(0) - dmin) / (dmax - dmin)) - * RANGE_INT_MAX); + if (value.numel () > 0) + { + int ival = xround (((value(0) - dmin) / (dmax - dmin)) + * RANGE_INT_MAX); - m_blockUpdates = true; - slider->setValue (ival); - m_blockUpdates = false; - } - } + m_blockUpdates = true; + slider->setValue (ival); + m_blockUpdates = false; + } + } break; default: BaseControl::update (pId); @@ -125,25 +125,25 @@ graphics_object go = object (); if (go.valid_object ()) - { - uicontrol::properties& up = Utils::properties (go); + { + uicontrol::properties& up = Utils::properties (go); - Matrix value = up.get_value ().matrix_value (); - double dmin = up.get_min (), dmax = up.get_max (); + Matrix value = up.get_value ().matrix_value (); + double dmin = up.get_min (), dmax = up.get_max (); - int ival_tmp = (value.numel () > 0 ? - xround (((value(0) - dmin) / (dmax - dmin)) - * RANGE_INT_MAX) : - 0); + int ival_tmp = (value.numel () > 0 ? + xround (((value(0) - dmin) / (dmax - dmin)) + * RANGE_INT_MAX) : + 0); - if (ival != ival_tmp || value.numel () > 0) - { - double dval = dmin + (ival * (dmax - dmin) / RANGE_INT_MAX); + if (ival != ival_tmp || value.numel () > 0) + { + double dval = dmin + (ival * (dmax - dmin) / RANGE_INT_MAX); - gh_manager::post_set (m_handle, "value", octave_value (dval)); - gh_manager::post_callback (m_handle, "callback"); - } - } + gh_manager::post_set (m_handle, "value", octave_value (dval)); + gh_manager::post_callback (m_handle, "callback"); + } + } } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/TextControl.cc --- a/libgui/graphics/TextControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/TextControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -42,7 +42,7 @@ Container* container = parent->innerContainer (); if (container) - return new TextControl (go, new QLabel (container)); + return new TextControl (go, new QLabel (container)); } return 0; @@ -57,7 +57,7 @@ label->setTextFormat (Qt::PlainText); label->setWordWrap (false); label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), - up.get_verticalalignment ())); + up.get_verticalalignment ())); // FIXME: support string_vector label->setText (Utils::fromStdString (up.get_string_string ())); } @@ -80,7 +80,7 @@ case uicontrol::properties::ID_HORIZONTALALIGNMENT: case uicontrol::properties::ID_VERTICALALIGNMENT: label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), - up.get_verticalalignment ())); + up.get_verticalalignment ())); break; default: BaseControl::update (pId); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ToggleButtonControl.cc --- a/libgui/graphics/ToggleButtonControl.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ToggleButtonControl.cc Sun Apr 27 18:02:47 2014 -0700 @@ -42,14 +42,14 @@ Container* container = parent->innerContainer (); if (container) - return new ToggleButtonControl (go, new QPushButton (container)); + return new ToggleButtonControl (go, new QPushButton (container)); } return 0; } ToggleButtonControl::ToggleButtonControl (const graphics_object& go, - QPushButton* btn) + QPushButton* btn) : ButtonControl (go, btn) { btn->setCheckable (true); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ToggleTool.cc --- a/libgui/graphics/ToggleTool.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ToggleTool.cc Sun Apr 27 18:02:47 2014 -0700 @@ -40,7 +40,7 @@ QWidget* parentWidget = parent->qWidget (); if (parentWidget) - return new ToggleTool (go, new QAction (parentWidget)); + return new ToggleTool (go, new QAction (parentWidget)); } return 0; @@ -55,7 +55,7 @@ action->setChecked (tp.is_state ()); connect (action, SIGNAL (toggled (bool)), - this, SLOT (triggered (bool))); + this, SLOT (triggered (bool))); } ToggleTool::~ToggleTool (void) @@ -82,9 +82,9 @@ { gh_manager::post_set (m_handle, "state", checked, false); gh_manager::post_callback (m_handle, - checked - ? "oncallback" - : "offcallback"); + checked + ? "oncallback" + : "offcallback"); gh_manager::post_callback (m_handle, "clickedcallback"); } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ToolBar.cc --- a/libgui/graphics/ToolBar.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ToolBar.cc Sun Apr 27 18:02:47 2014 -0700 @@ -71,7 +71,7 @@ QWidget* parentWidget = parent->qWidget (); if (parentWidget) - return new ToolBar (go, new QToolBar (parentWidget)); + return new ToolBar (go, new QToolBar (parentWidget)); } return 0; @@ -110,7 +110,7 @@ { case base_properties::ID_VISIBLE: if (m_figure) - m_figure->showCustomToolBar (bar, tp.is_visible ()); + m_figure->showCustomToolBar (bar, tp.is_visible ()); break; default: Object::update (pId); @@ -123,31 +123,31 @@ if (watched == qObject ()) { switch (event->type ()) - { - case QEvent::ActionAdded: - case QEvent::ActionRemoved: - { - QActionEvent* ae = dynamic_cast (event); - QToolBar* bar = qWidget (); + { + case QEvent::ActionAdded: + case QEvent::ActionRemoved: + { + QActionEvent* ae = dynamic_cast (event); + QToolBar* bar = qWidget (); - if (ae->action () != m_empty) - { - if (event->type () == QEvent::ActionAdded) - { - if (bar->actions ().size () == 2) - QTimer::singleShot (0, this, SLOT (hideEmpty (void))); - } - else - { - if (bar->actions ().size () == 1) - m_empty->setVisible (true); - } - } - } - break; - default: - break; - } + if (ae->action () != m_empty) + { + if (event->type () == QEvent::ActionAdded) + { + if (bar->actions ().size () == 2) + QTimer::singleShot (0, this, SLOT (hideEmpty (void))); + } + else + { + if (bar->actions ().size () == 1) + m_empty->setVisible (true); + } + } + } + break; + default: + break; + } } return false; @@ -165,7 +165,7 @@ QToolBar* bar = qWidget (); if (bar) - m_figure->showCustomToolBar (bar, false); + m_figure->showCustomToolBar (bar, false); } } diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/ToolBarButton.cc --- a/libgui/graphics/ToolBarButton.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/ToolBarButton.cc Sun Apr 27 18:02:47 2014 -0700 @@ -74,38 +74,38 @@ case base_properties::ID_VISIBLE: action->setVisible (tp.is_visible ()); if (m_separator) - m_separator->setVisible (tp.is_visible ()); + m_separator->setVisible (tp.is_visible ()); break; case T::properties::ID_TOOLTIPSTRING: action->setToolTip (Utils::fromStdString (tp.get_tooltipstring ())); break; case T::properties::ID_CDATA: - { - QImage img = Utils::makeImageFromCData (tp.get_cdata (), 16, 16); + { + QImage img = Utils::makeImageFromCData (tp.get_cdata (), 16, 16); - action->setIcon (QIcon (QPixmap::fromImage (img))); - } + action->setIcon (QIcon (QPixmap::fromImage (img))); + } break; case T::properties::ID_SEPARATOR: if (tp.is_separator ()) - { - if (! m_separator) - { - m_separator = new QAction (action); - m_separator->setSeparator (true); - m_separator->setVisible (tp.is_visible ()); + { + if (! m_separator) + { + m_separator = new QAction (action); + m_separator->setSeparator (true); + m_separator->setVisible (tp.is_visible ()); - QWidget* w = qobject_cast (action->parent ()); + QWidget* w = qobject_cast (action->parent ()); - w->insertAction (action, m_separator); - } - } + w->insertAction (action, m_separator); + } + } else - { - if (m_separator) - delete m_separator; - m_separator = 0; - } + { + if (m_separator) + delete m_separator; + m_separator = 0; + } break; case T::properties::ID_ENABLE: action->setEnabled (tp.is_enable ()); diff -r 9a6646cc7c3e -r fe0e34be5576 libgui/graphics/__init_qt__.cc --- a/libgui/graphics/__init_qt__.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libgui/graphics/__init_qt__.cc Sun Apr 27 18:02:47 2014 -0700 @@ -48,45 +48,45 @@ if (! qtHandlesInitialized) { if (qApp) - { - qRegisterMetaType ("graphics_object"); + { + qRegisterMetaType ("graphics_object"); - gh_manager::enable_event_processing (true); + gh_manager::enable_event_processing (true); - graphics_toolkit tk (new Backend ()); + graphics_toolkit tk (new Backend ()); gtk_manager::load_toolkit (tk); - octave_add_atexit_function ("__shutdown_qt__"); + octave_add_atexit_function ("__shutdown_qt__"); - // Change some default settings to use Qt default colors - QPalette p; - graphics_object root = gh_manager::get_object (0); + // Change some default settings to use Qt default colors + QPalette p; + graphics_object root = gh_manager::get_object (0); - /* - root.set ("defaultfigurecolor", - octave_value (Utils::toRgb (p.color (QPalette::Window)))); - */ - root.set ("defaultuicontrolbackgroundcolor", - octave_value (Utils::toRgb (p.color (QPalette::Window)))); - root.set ("defaultuicontrolforegroundcolor", - octave_value (Utils::toRgb - (p.color (QPalette::WindowText)))); - root.set ("defaultuipanelbackgroundcolor", - octave_value (Utils::toRgb (p.color (QPalette::Window)))); - root.set ("defaultuipanelforegroundcolor", - octave_value (Utils::toRgb - (p.color (QPalette::WindowText)))); - root.set ("defaultuipanelhighlightcolor", - octave_value (Utils::toRgb (p.color (QPalette::Light)))); - root.set ("defaultuipanelshadowcolor", - octave_value (Utils::toRgb (p.color (QPalette::Dark)))); + /* + root.set ("defaultfigurecolor", + octave_value (Utils::toRgb (p.color (QPalette::Window)))); + */ + root.set ("defaultuicontrolbackgroundcolor", + octave_value (Utils::toRgb (p.color (QPalette::Window)))); + root.set ("defaultuicontrolforegroundcolor", + octave_value (Utils::toRgb + (p.color (QPalette::WindowText)))); + root.set ("defaultuipanelbackgroundcolor", + octave_value (Utils::toRgb (p.color (QPalette::Window)))); + root.set ("defaultuipanelforegroundcolor", + octave_value (Utils::toRgb + (p.color (QPalette::WindowText)))); + root.set ("defaultuipanelhighlightcolor", + octave_value (Utils::toRgb (p.color (QPalette::Light)))); + root.set ("defaultuipanelshadowcolor", + octave_value (Utils::toRgb (p.color (QPalette::Dark)))); - qtHandlesInitialized = true; + qtHandlesInitialized = true; - return true; - } + return true; + } else - error ("__init_qt__: QApplication object must exist."); + error ("__init_qt__: QApplication object must exist."); } return false; @@ -213,45 +213,45 @@ QString filter; QStringList files = QFileDialog::getOpenFileNames (0, caption, defaultFileName, - filterSpecs.join (";;"), &filter, 0); + filterSpecs.join (";;"), &filter, 0); if (! files.isEmpty ()) - { - Cell cFiles (1, files.length ()); - QString dirName; - int i = 0; + { + Cell cFiles (1, files.length ()); + QString dirName; + int i = 0; - foreach (const QString& s, files) - { - QFileInfo fi (s); + foreach (const QString& s, files) + { + QFileInfo fi (s); - if (dirName.isEmpty ()) - dirName = appendDirSep (fi.canonicalPath ()); - cFiles(i++) = toStdString (fi.fileName ()); - } + if (dirName.isEmpty ()) + dirName = appendDirSep (fi.canonicalPath ()); + cFiles(i++) = toStdString (fi.fileName ()); + } - retval(0) = cFiles; - retval(1) = toStdString (dirName); - if (! filter.isEmpty ()) - retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); - } + retval(0) = cFiles; + retval(1) = toStdString (dirName); + if (! filter.isEmpty ()) + retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); + } } else { QString filter; QString fileName = QFileDialog::getOpenFileName (0, caption, defaultFileName, - filterSpecs.join (";;"), &filter, 0); + filterSpecs.join (";;"), &filter, 0); if (! fileName.isNull ()) - { - QFileInfo fi (fileName); + { + QFileInfo fi (fileName); - retval(0) = toStdString (fi.fileName ()); - retval(1) = toStdString (appendDirSep (fi.canonicalPath ())); - if (! filter.isEmpty ()) - retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); - } + retval(0) = toStdString (fi.fileName ()); + retval(1) = toStdString (appendDirSep (fi.canonicalPath ())); + if (! filter.isEmpty ()) + retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); + } } return retval; @@ -289,7 +289,7 @@ QString filter; QString fileName = QFileDialog::getSaveFileName (0, caption, defaultFileName, - filterSpecs.join (";;"), &filter, 0); + filterSpecs.join (";;"), &filter, 0); if (! fileName.isNull ()) { @@ -297,11 +297,11 @@ retval(0) = toStdString (fi.fileName ()); if (fi.exists ()) - retval(1) = toStdString (appendDirSep (fi.canonicalPath ())); + retval(1) = toStdString (appendDirSep (fi.canonicalPath ())); else - retval(1) = toStdString (appendDirSep (fi.absolutePath ())); + retval(1) = toStdString (appendDirSep (fi.absolutePath ())); if (! filter.isEmpty ()) - retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); + retval(2) = static_cast (filterSpecs.indexOf (filter) + 1); } return retval; @@ -321,7 +321,7 @@ QString defaultDirectory = fromStdString (args(0).string_value ()); QString dirName = QFileDialog::getExistingDirectory (0, caption, - defaultDirectory); + defaultDirectory); if (! dirName.isNull ()) retval = toStdString (dirName); diff -r 9a6646cc7c3e -r fe0e34be5576 libinterp/corefcn/pt-jit.cc --- a/libinterp/corefcn/pt-jit.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libinterp/corefcn/pt-jit.cc Sun Apr 27 18:02:47 2014 -0700 @@ -878,7 +878,7 @@ if (! twc->is_default_case ()) { - // compare result of switch expression with actual case label + // compare result of switch expression with actual case label tree_expression *te = twc->case_label (); jit_value *label = visit (te); assert(label); diff -r 9a6646cc7c3e -r fe0e34be5576 libinterp/octave-value/ov-classdef.cc --- a/libinterp/octave-value/ov-classdef.cc Sun Apr 27 17:38:03 2014 -0700 +++ b/libinterp/octave-value/ov-classdef.cc Sun Apr 27 18:02:47 2014 -0700 @@ -57,12 +57,12 @@ acc_s = "class-restricted"; error ("%s: method `%s' has %s access and cannot be run in this context", - from.c_str (), meth.get_name ().c_str (), acc_s.c_str ()); + from.c_str (), meth.get_name ().c_str (), acc_s.c_str ()); } static void gripe_property_access (const std::string& from, const cdef_property& prop, - bool is_set = false) + bool is_set = false) { octave_value acc = prop.get (is_set ? "SetAccess" : "GetAccess"); std::string acc_s; @@ -74,10 +74,10 @@ if (is_set) error ("%s: property `%s' has %s access and cannot be set in this context", - from.c_str (), prop.get_name ().c_str (), acc_s.c_str ()); + from.c_str (), prop.get_name ().c_str (), acc_s.c_str ()); else error ("%s: property `%s' has %s access and cannot be obtained in this context", - from.c_str (), prop.get_name ().c_str (), acc_s.c_str ()); + from.c_str (), prop.get_name ().c_str (), acc_s.c_str ()); } static std::string @@ -222,7 +222,7 @@ static bool is_superclass (const cdef_class& clsa, const cdef_class& clsb, - bool allow_equal = true, int max_depth = -1) + bool allow_equal = true, int max_depth = -1) { bool retval = false; @@ -233,13 +233,13 @@ Cell c = clsb.get ("SuperClasses").cell_value (); for (int i = 0; ! error_state && ! retval && i < c.numel (); i++) - { - cdef_class cls = lookup_class (c(i)); - - if (! error_state) - retval = is_superclass (clsa, cls, true, + { + cdef_class cls = lookup_class (c(i)); + + if (! error_state) + retval = is_superclass (clsa, cls, true, max_depth < 0 ? max_depth : max_depth-1); - } + } } return retval; @@ -539,9 +539,9 @@ std::string name = args(0).string_value (); if (! error_state) - retval(0) = to_ov (lookup_class (name)); + retval(0) = to_ov (lookup_class (name)); else - error ("fromName: invalid class name, expected a string value"); + error ("fromName: invalid class name, expected a string value"); } else error ("fromName: invalid number of parameters"); @@ -559,29 +559,29 @@ cdef_class cls (to_cdef (args(0))); if (! error_state) - { - std::string meth_name = args(1).string_value (); - - if (! error_state) - { - cdef_method meth = cls.find_method (meth_name); - - if (meth.ok ()) - { + { + std::string meth_name = args(1).string_value (); + + if (! error_state) + { + cdef_method meth = cls.find_method (meth_name); + + if (meth.ok ()) + { if (meth.is_static ()) retval = meth.execute (args.splice (0, 2), nargout, true, "fevalStatic"); else error ("fevalStatic: method `%s' is not static", meth_name.c_str ()); - } - else - error ("fevalStatic: method not found: %s", - meth_name.c_str ()); - } - else - error ("fevalStatic: invalid method name, expected a string value"); - } + } + else + error ("fevalStatic: method not found: %s", + meth_name.c_str ()); + } + else + error ("fevalStatic: invalid method name, expected a string value"); + } error ("fevalStatic: invalid object, expected a meta.class object"); } else @@ -601,30 +601,30 @@ cdef_class cls = to_cdef (args(0)); if (! error_state) - { - std::string prop_name = args(1).string_value (); - - if (! error_state) - { - cdef_property prop = cls.find_property (prop_name); - - if (prop.ok ()) - { + { + std::string prop_name = args(1).string_value (); + + if (! error_state) + { + cdef_property prop = cls.find_property (prop_name); + + if (prop.ok ()) + { if (prop.is_constant ()) retval(0) = prop.get_value (true, "getConstant"); else error ("getConstant: property `%s' is not constant", prop_name.c_str ()); - } - else - error ("getConstant: property not found: %s", - prop_name.c_str ()); - } - else - error ("getConstant: invalid property name, expected a string value"); - } + } + else + error ("getConstant: property not found: %s", + prop_name.c_str ()); + } + else + error ("getConstant: invalid property name, expected a string value"); + } else - error ("getConstant: invalid object, expected a meta.class object"); + error ("getConstant: invalid object, expected a meta.class object"); } else error ("getConstant: invalid arguments"); @@ -647,9 +647,9 @@ cdef_class clsb = to_cdef (args(1)); \ \ if (! error_state) \ - retval(0) = FUN (CLSA, CLSB); \ + retval(0) = FUN (CLSA, CLSB); \ else \ - error (#OP ": invalid objects, expected meta.class objects"); \ + error (#OP ": invalid objects, expected meta.class objects"); \ } \ else \ error (#OP ": invalid arguments"); \ @@ -773,10 +773,10 @@ static cdef_property make_property (const cdef_class& cls, const std::string& name, - const octave_value& get_method = Matrix (), - const std::string& get_access = "public", - const octave_value& set_method = Matrix (), - const std::string& set_access = "public") + const octave_value& get_method = Matrix (), + const std::string& get_access = "public", + const octave_value& set_method = Matrix (), + const std::string& set_access = "public") { cdef_property prop (name); @@ -948,7 +948,7 @@ if (! error_state) { if (type.length () > skip && idx.size () > skip) - retval = retval(0).next_subsref (1, type, idx, skip); + retval = retval(0).next_subsref (1, type, idx, skip); } return retval.length () > 0 ? retval(0) : octave_value (); @@ -1345,13 +1345,13 @@ switch (type[0]) { case '.': - { - std::string name = (idx.front ())(0).string_value (); - - cdef_method meth = cls.find_method (name); - - if (meth.ok ()) - { + { + std::string name = (idx.front ())(0).string_value (); + + cdef_method meth = cls.find_method (name); + + if (meth.ok ()) + { int _nargout = (type.length () > 2 ? 1 : nargout); octave_value_list args; @@ -1375,14 +1375,14 @@ retval = meth.execute (cdef_object (this), args, _nargout, true, "subsref"); } - } - - if (skip == 0 && ! error_state) - { - cdef_property prop = cls.find_property (name); - - if (prop.ok ()) - { + } + + if (skip == 0 && ! error_state) + { + cdef_property prop = cls.find_property (name); + + if (prop.ok ()) + { if (prop.is_constant ()) retval(0) = prop.get_value (true, "subsref"); else @@ -1393,12 +1393,12 @@ } skip = 1; - } - else - error ("subsref: unknown method or property: %s", name.c_str ()); - } - break; - } + } + else + error ("subsref: unknown method or property: %s", name.c_str ()); + } + break; + } case '(': { @@ -1890,7 +1890,7 @@ // FIXME: check if method reload needed if (meth.ok ()) - return meth; + return meth; } if (! local) @@ -2101,7 +2101,7 @@ int idx = 0; for (std::map::const_iterator it = meths.begin (); - it != meths.end (); ++it, ++idx) + it != meths.end (); ++it, ++idx) c (idx, 0) = to_ov (it->second); return c; @@ -2149,9 +2149,9 @@ cdef_class cls = lookup_class (super_classes(i)); if (! error_state) - cls.get_rep ()->find_methods (meths, true); + cls.get_rep ()->find_methods (meths, true); else - break; + break; } } @@ -2165,7 +2165,7 @@ cdef_property& prop = it->second; if (prop.ok ()) - return prop; + return prop; } // Look into superclasses @@ -2177,12 +2177,12 @@ cdef_class cls = lookup_class (super_classes(i)); if (! error_state) - { - cdef_property prop = cls.find_property (nm); - - if (prop.ok ()) - return prop; - } + { + cdef_property prop = cls.find_property (nm); + + if (prop.ok ()) + return prop; + } } return cdef_property (); @@ -2210,7 +2210,7 @@ int idx = 0; for (std::map::const_iterator it = props.begin (); - it != props.end (); ++it, ++idx) + it != props.end (); ++it, ++idx) c (idx, 0) = to_ov (it->second); return c; @@ -2231,7 +2231,7 @@ std::string nm = it->second.get_name (); if (props.find (nm) == props.end ()) - { + { if (only_inherited) { octave_value acc = it->second.get ("GetAccess"); @@ -2241,8 +2241,8 @@ continue; } - props[nm] = it->second; - } + props[nm] = it->second; + } } // Look into superclasses @@ -2254,9 +2254,9 @@ cdef_class cls = lookup_class (super_classes(i)); if (! error_state) - cls.get_rep ()->find_properties (props, true); + cls.get_rep ()->find_properties (props, true); else - break; + break; } } @@ -2312,9 +2312,9 @@ cdef_class cls = lookup_class (super_classes(i)); if (! error_state) - cls.get_rep ()->find_names (names, all); + cls.get_rep ()->find_names (names, all); else - break; + break; } } @@ -2331,7 +2331,7 @@ int idx = 0; for (std::set::const_iterator it = names.begin (); - it != names.end (); ++it, ++idx) + it != names.end (); ++it, ++idx) v[idx] = *it; return v.sort (true); @@ -2367,7 +2367,7 @@ cdef_class cls = lookup_class (super_classes(i)); if (!error_state) - cls.delete_object (obj); + cls.delete_object (obj); } } @@ -2450,7 +2450,7 @@ if (! error_state) { if (type.length () > skip && idx.size () > skip && ! retval.empty ()) - retval = retval(0).next_subsref (nargout, type, idx, skip); + retval = retval(0).next_subsref (nargout, type, idx, skip); } return retval; @@ -3001,7 +3001,7 @@ args = execute_ov (get_fcn, args, 1); if (! error_state) - retval = args(0); + retval = args(0); } return retval; @@ -3153,7 +3153,7 @@ octave_value_list cdef_method::cdef_method_rep::execute (const octave_value_list& args, - int nargout, bool do_check_access, + int nargout, bool do_check_access, const std::string& who) { octave_value_list retval; @@ -3170,21 +3170,21 @@ check_method (); if (! error_state && function.is_defined ()) - { - retval = execute_ov (function, args, nargout); - } + { + retval = execute_ov (function, args, nargout); + } } else error ("%s: cannot execute abstract method", - get ("Name").string_value ().c_str ()); + get ("Name").string_value ().c_str ()); return retval; } octave_value_list cdef_method::cdef_method_rep::execute (const cdef_object& obj, - const octave_value_list& args, - int nargout, bool do_check_access, + const octave_value_list& args, + int nargout, bool do_check_access, const std::string& who) { octave_value_list retval; @@ -3201,21 +3201,21 @@ check_method (); if (! error_state && function.is_defined ()) - { + { octave_value_list new_args; - new_args.resize (args.length () + 1); - - new_args(0) = to_ov (obj); - for (int i = 0; i < args.length (); i++) - new_args(i+1) = args(i); - - retval = execute_ov (function, new_args, nargout); - } + new_args.resize (args.length () + 1); + + new_args(0) = to_ov (obj); + for (int i = 0; i < args.length (); i++) + new_args(i+1) = args(i); + + retval = execute_ov (function, new_args, nargout); + } } else error ("%s: cannot execute abstract method", - get ("Name").string_value ().c_str ()); + get ("Name").string_value ().c_str ()); return retval; } @@ -3261,7 +3261,7 @@ if (! error_state) { if (type.length () > 1 && idx.size () > 1 && ! retval.empty ()) - retval = retval(0).next_subsref (nargout, type, idx, 1); + retval = retval(0).next_subsref (nargout, type, idx, 1); } return retval; @@ -3283,9 +3283,9 @@ std::string name = args(0).string_value (); if (! error_state) - retval(0) = to_ov (lookup_package (name)); + retval(0) = to_ov (lookup_package (name)); else - error ("fromName: invalid package name, expected a string value"); + error ("fromName: invalid package name, expected a string value"); } else error ("fromName: invalid number of parameters"); @@ -3551,41 +3551,41 @@ meta_class.install_property (make_attribute (meta_class, "Hidden")); meta_class.install_property (make_property (meta_class, "InferiorClasses", - make_fcn_handle (class_get_inferiorclasses, "meta.class>get.InferiorClasses"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_inferiorclasses, "meta.class>get.InferiorClasses"), + "public", Matrix (), "private")); meta_class.install_property (make_property (meta_class, "Methods", - make_fcn_handle (class_get_methods, "meta.class>get.Methods"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_methods, "meta.class>get.Methods"), + "public", Matrix (), "private")); meta_class.install_property (make_property (meta_class, "MethodList", - make_fcn_handle (class_get_methods, "meta.class>get.MethodList"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_methods, "meta.class>get.MethodList"), + "public", Matrix (), "private")); meta_class.install_property (make_attribute (meta_class, "Name")); meta_class.install_property (make_property (meta_class, "Properties", - make_fcn_handle (class_get_properties, "meta.class>get.Properties"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_properties, "meta.class>get.Properties"), + "public", Matrix (), "private")); meta_class.install_property (make_property (meta_class, "PropertyList", - make_fcn_handle (class_get_properties, "meta.class>get.PropertyList"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_properties, "meta.class>get.PropertyList"), + "public", Matrix (), "private")); meta_class.install_property (make_attribute (meta_class, "Sealed")); meta_class.install_property (make_property (meta_class, "SuperClasses", - make_fcn_handle (class_get_superclasses, "meta.class>get.SuperClasses"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_superclasses, "meta.class>get.SuperClasses"), + "public", Matrix (), "private")); meta_class.install_property (make_property (meta_class, "SuperClassList", - make_fcn_handle (class_get_superclasses, "meta.class>get.SuperClassList"), - "public", Matrix (), "private")); + make_fcn_handle (class_get_superclasses, "meta.class>get.SuperClassList"), + "public", Matrix (), "private")); /* meta.class methods */ meta_class.install_method (make_method (meta_class, "fromName", class_fromName, - "public", true)); + "public", true)); meta_class.install_method (make_method (meta_class, "fevalStatic", class_fevalStatic, - "public", false)); + "public", false)); meta_class.install_method (make_method (meta_class, "getConstant", class_getConstant, - "public", false)); + "public", false)); meta_class.install_method (make_method (meta_class, "eq", class_eq)); meta_class.install_method (make_method (meta_class, "ne", class_ne)); meta_class.install_method (make_method (meta_class, "lt", class_lt)); @@ -3622,8 +3622,8 @@ meta_property.install_property (make_attribute (meta_property, "DefiningClass")); meta_property.install_property (make_property (meta_property, "DefaultValue", - make_fcn_handle (property_get_defaultvalue, "meta.property>get.DefaultValue"), - "public", Matrix (), "private")); + make_fcn_handle (property_get_defaultvalue, "meta.property>get.DefaultValue"), + "public", Matrix (), "private")); meta_property.install_property (make_attribute (meta_property, "HasDefault")); /* meta.property events */ // FIXME: add events @@ -3636,28 +3636,28 @@ meta_package.install_property (make_property (meta_package, "ContainingPackage")); meta_package.install_property (make_property (meta_package, "ClassList", - make_fcn_handle (package_get_classes, "meta.package>get.ClassList"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_classes, "meta.package>get.ClassList"), + "public", Matrix (), "private")); meta_package.install_property (make_property (meta_package, "Classes", - make_fcn_handle (package_get_classes, "meta.package>get.Classes"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_classes, "meta.package>get.Classes"), + "public", Matrix (), "private")); meta_package.install_property (make_property (meta_package, "FunctionList", - make_fcn_handle (package_get_functions, "meta.package>get.FunctionList"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_functions, "meta.package>get.FunctionList"), + "public", Matrix (), "private")); meta_package.install_property (make_property (meta_package, "Functions", - make_fcn_handle (package_get_functions, "meta.package>get.Functions"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_functions, "meta.package>get.Functions"), + "public", Matrix (), "private")); meta_package.install_property (make_property (meta_package, "PackageList", - make_fcn_handle (package_get_packages, "meta.package>get.PackageList"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_packages, "meta.package>get.PackageList"), + "public", Matrix (), "private")); meta_package.install_property (make_property (meta_package, "Packages", - make_fcn_handle (package_get_packages, "meta.package>get.Packages"), - "public", Matrix (), "private")); + make_fcn_handle (package_get_packages, "meta.package>get.Packages"), + "public", Matrix (), "private")); meta_package.install_method (make_method (meta_package, "fromName", package_fromName, "public", true)); meta_package.install_method (make_method (meta_package, "getAllPackages", package_getAllPackages, @@ -3734,7 +3734,7 @@ if (it == all_classes.end ()) { if (error_if_not_found) - error ("class not found: %s", name.c_str ()); + error ("class not found: %s", name.c_str ()); } else { @@ -3744,9 +3744,9 @@ cls = lookup_class (cls); if (cls.ok ()) - return cls; + return cls; else - all_classes.erase (it); + all_classes.erase (it); } return cdef_class (); @@ -3834,9 +3834,9 @@ std::string cname = args(0).string_value (); if (! error_state) - retval = to_ov (lookup_package (cname)); + retval = to_ov (lookup_package (cname)); else - error ("invalid package name, expected a string value"); + error ("invalid package name, expected a string value"); } else print_usage (); @@ -3870,9 +3870,9 @@ std::string cls = args(0).string_value (); if (! error_state) - retval = to_ov (lookup_class (cls)); + retval = to_ov (lookup_class (cls)); else - error ("invalid class name, expected a string value"); + error ("invalid class name, expected a string value"); } else print_usage (); diff -r 9a6646cc7c3e -r fe0e34be5576 libinterp/octave-value/ov-classdef.h --- a/libinterp/octave-value/ov-classdef.h Sun Apr 27 17:38:03 2014 -0700 +++ b/libinterp/octave-value/ov-classdef.h Sun Apr 27 18:02:47 2014 -0700 @@ -207,12 +207,12 @@ cdef_object& operator = (const cdef_object& obj) { if (rep != obj.rep) - { + { rep->release (); - rep = obj.rep; - rep->refcount++; - } + rep = obj.rep; + rep->refcount++; + } return *this; } @@ -411,12 +411,12 @@ Cell val = map.contents (pname); if (val.numel () > 0) - return val(0, 0); + return val(0, 0); else - { - error ("get: unknown slot: %s", pname.c_str ()); - return octave_value (); - } + { + error ("get: unknown slot: %s", pname.c_str ()); + return octave_value (); + } } octave_value_list @@ -618,7 +618,7 @@ { public: cdef_class_rep (void) - : cdef_meta_object_rep (), member_count (0), handle_class (false), + : cdef_meta_object_rep (), member_count (0), handle_class (false), object_count (0), meta (false) { } cdef_class_rep (const std::list& superclasses); @@ -781,8 +781,8 @@ { // This should never happen... if (! is_class ()) - error ("internal error: invalid assignment from %s to meta.class object", - class_name ().c_str ()); + error ("internal error: invalid assignment from %s to meta.class object", + class_name ().c_str ()); } cdef_class& operator = (const cdef_class& cls) @@ -912,7 +912,7 @@ { public: cdef_property_rep (void) - : cdef_meta_object_rep () { } + : cdef_meta_object_rep () { } cdef_object_rep* copy (void) const { return new cdef_property_rep (*this); } @@ -967,8 +967,8 @@ { // This should never happen... if (! is_property ()) - error ("internal error: invalid assignment from %s to meta.property object", - class_name ().c_str ()); + error ("internal error: invalid assignment from %s to meta.property object", + class_name ().c_str ()); } cdef_property& operator = (const cdef_property& prop) @@ -1050,7 +1050,7 @@ const std::string& who = std::string ()); octave_value_list execute (const cdef_object& obj, - const octave_value_list& args, int nargout, + const octave_value_list& args, int nargout, bool do_check_access = true, const std::string& who = std::string ()); @@ -1100,8 +1100,8 @@ { // This should never happen... if (! is_method ()) - error ("internal error: invalid assignment from %s to meta.method object", - class_name ().c_str ()); + error ("internal error: invalid assignment from %s to meta.method object", + class_name ().c_str ()); } cdef_method& operator = (const cdef_method& meth) @@ -1119,7 +1119,7 @@ /* dot-invokation: object is pushed as 1st argument */ octave_value_list execute (const cdef_object& obj, - const octave_value_list& args, int nargout, + const octave_value_list& args, int nargout, bool do_check_access = true, const std::string& who = std::string ()) { return get_rep ()->execute (obj, args, nargout, do_check_access, who); } @@ -1336,8 +1336,8 @@ { // This should never happen... if (! is_package ()) - error ("internal error: invalid assignment from %s to meta.package object", - class_name ().c_str ()); + error ("internal error: invalid assignment from %s to meta.package object", + class_name ().c_str ()); } cdef_package& operator = (const cdef_package& pack) @@ -1423,18 +1423,18 @@ bool print_padding = true); octave_value_list subsref (const std::string& type, - const std::list& idx, + const std::list& idx, int nargout); octave_value subsref (const std::string& type, - const std::list& idx) + const std::list& idx) { octave_value_list retval = subsref (type, idx, 1); return (retval.length () > 0 ? retval(0) : octave_value ()); } octave_value subsref (const std::string& type, - const std::list& idx, + const std::list& idx, bool auto_add); octave_value subsasgn (const std::string& type,