Mercurial > octave-nkf
changeset 20130:c164cfc24bdd
QtHandles: add annotations dialog
* libgui/graphics/annotation-dialog.h: new file
* libgui/graphics/annotation-dialog.cc: new file
* libgui/graphics/annotation-dialog.ui: new file
* libgui/graphics/Canvas.cc
(canvasMousePressEvent): call annotation_dialog when in TextMode.
* libgui/graphics/module.mk: add annotation-dialog to build
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 19 Apr 2015 09:54:54 -0400 |
parents | 0b83a442ff78 |
children | bb59bdbdb8ac |
files | libgui/graphics/Canvas.cc libgui/graphics/annotation-dialog.cc libgui/graphics/annotation-dialog.h libgui/graphics/annotation-dialog.ui libgui/graphics/module.mk |
diffstat | 5 files changed, 1763 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc Sat Apr 18 20:38:59 2015 -0700 +++ b/libgui/graphics/Canvas.cc Sun Apr 19 09:54:54 2015 -0400 @@ -39,6 +39,8 @@ #include "GLCanvas.h" #include "QtHandlesUtils.h" +#include "annotation-dialog.h" + #include "gl2ps-renderer.h" #include "octave-qt-link.h" @@ -574,32 +576,27 @@ if (! w) break; - bool ok; - - // FIXME: this dialog should allow multiple line text entry - // and also provide options for setting text properties of - // the text annotation. - - QString text = QInputDialog::getText (w, "Annotation", "", - QLineEdit::Normal, "", &ok); - - if (! ok || text.isEmpty ()) - break; - Matrix bb = axesObj.get_properties ().get_boundingbox (false); + Matrix position (1, 4); QPoint pos = event->pos (); - Matrix position (1, 4); - position(0) = pos.x () / bb(2); position(1) = 1.0 - (pos.y () / bb(3)); position(2) = pos.x () / bb(2); position(3) = 1.0 - (pos.y () / bb(3)); - octave_link::post_event (this, &Canvas::annotation_callback, - ovl ("textbox", position, - "string", text.toStdString ())); + octave_value_list props = ovl("textbox", position); + + annotation_dialog anno_dlg (w, props); + + if (anno_dlg.exec () == QDialog::Accepted) + { + props = anno_dlg.get_properties (); + + octave_link::post_event (this, &Canvas::annotation_callback, + props); + } } break;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/graphics/annotation-dialog.cc Sun Apr 19 09:54:54 2015 -0400 @@ -0,0 +1,261 @@ +/* + +Copyright (C) 2015 John Donoghue + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "annotation-dialog.h" +#include "ui-annotation-dialog.h" + +#include "QtHandlesUtils.h" + +#include "resource-manager.h" + +#include <QColorDialog> +#include <QPushButton> +#include <QPalette> + +using namespace QtHandles; + +annotation_dialog::annotation_dialog (QWidget *p, const octave_value_list &pr): + QDialog (p), ui (new Ui::annotation_dialog) +{ + props = pr; + + init (); +} + +void +annotation_dialog::init () +{ + ui->setupUi (this); + + QSettings *settings = resource_manager::get_settings (); + + // restore last geometry + restoreGeometry (settings->value("annotation/geometry").toByteArray ()); + + // connect signals + connect (ui->button_box, SIGNAL (clicked (QAbstractButton *)), + this, SLOT (button_clicked (QAbstractButton *))); + + + connect (ui->edit_string, SIGNAL (textChanged (const QString&)), + this, SLOT (edit_string_changed (const QString&))); + + connect (ui->btn_color, SIGNAL (clicked ()), + this, SLOT (prompt_for_color ())); + + connect (ui->btn_background_color, SIGNAL (clicked ()), + this, SLOT (prompt_for_color ())); + + connect (ui->btn_edge_color, SIGNAL (clicked ()), + this, SLOT (prompt_for_color ())); + + // set gui element to default values + ui->cb_fit_box_to_text->setChecked (true); + ui->cb_horz_align->setCurrentIndex ( ui->cb_horz_align->findText("left") ); + ui->cb_vert_align->setCurrentIndex ( ui->cb_vert_align->findText("middle") ); + + // set gui elements to any values from input properties + set_gui_props (); +} + +annotation_dialog::~annotation_dialog () +{ + delete ui; +} + +// internal slots + +void +annotation_dialog::button_clicked (QAbstractButton *button) +{ + QDialogButtonBox::ButtonRole button_role = ui->button_box->buttonRole (button); + + QSettings *settings = resource_manager::get_settings (); + + // save position + settings->setValue ("annotation/geometry",saveGeometry ()); + + if (button_role == QDialogButtonBox::ApplyRole || + button_role == QDialogButtonBox::AcceptRole) + { + get_gui_props (); + } + + if (button_role == QDialogButtonBox::RejectRole || + button_role == QDialogButtonBox::AcceptRole) + close (); +} + +octave_value_list +annotation_dialog::get_properties () const +{ + return props; +} + +void +annotation_dialog::get_gui_props () +{ + // set props to the values of the gui + props = octave_value_list (); + + Matrix position(1,4); + position(0) = ui->sb_x->value (); + position(1) = ui->sb_y->value (); + position(2) = ui->sb_width->value (); + position(3) = ui->sb_height->value (); + props.append (ovl ("textbox", position)); + + props.append (ovl ("string", ui->edit_string->text ().toStdString ())); + props.append (ovl ("fitboxtotext", ui->cb_fit_box_to_text->isChecked() ? "on" : "off" )); + props.append (ovl ("units", ui->cb_units->currentText ().toStdString () )); + props.append (ovl ("horizontalalignment", ui->cb_horz_align->currentText ().toStdString () )); + props.append (ovl ("verticalalignment", ui->cb_vert_align->currentText ().toStdString () )); + props.append (ovl ("fontname", ui->cb_font_name->currentText ().toStdString())); + props.append (ovl ("fontsize", ui->sb_font_size->value ())); + props.append (ovl ("fontweight", ui->cb_font_bold->isChecked() ? "bold" : "normal" )); + props.append (ovl ("fontangle", ui->cb_font_italic->isChecked() ? "italic" : "normal" )); + props.append (ovl ("color", Utils::toRgb (ui->btn_color->palette ().color (QPalette::Button)))); +} + +void +annotation_dialog::set_gui_props () +{ + // set the gui to the values from the props + octave_idx_type len = props.length (); + + for (int i=0; i<len/2; i++) + { + std::string name = props(i*2).string_value (); + + if (name == "textbox") + { + Matrix position = props(2*i +1).matrix_value (); + int nels = position.numel(); + if (nels >= 2) + { + ui->sb_x->setValue (position(0)); + ui->sb_y->setValue (position(1)); + } + else + { + ui->sb_x->setValue (0); + ui->sb_y->setValue (0); + } + if (nels >= 4) + { + ui->sb_width->setValue (position(2)); + ui->sb_height->setValue (position(3)); + } + else + { + ui->sb_width->setValue (position(2)); + ui->sb_height->setValue (position(3)); + } + } + else if (name == "string") + { + // FIXME: handle if is array of strings ? + ui->edit_string->setText (props(2*i +1).string_value ().c_str ()); + } + else if (name == "fitboxtotext") + { + ui->cb_fit_box_to_text->setChecked ( props(1*i +1).string_value () == "on" ); + } + else if (name == "units") + { + ui->cb_units->setCurrentIndex ( ui->cb_units->findText(props(1*i +1).string_value ().c_str ()) ); + } + else if (name == "horizontalalignment") + { + ui->cb_horz_align->setCurrentIndex ( ui->cb_horz_align->findText(props(1*i +1).string_value ().c_str ()) ); + } + else if (name == "verticalalignment") + { + ui->cb_vert_align->setCurrentIndex ( ui->cb_vert_align->findText(props(1*i +1).string_value ().c_str ()) ); + } + else if (name == "fontname") + { + ui->cb_vert_align->setCurrentIndex ( ui->cb_font_name->findText(props(1*i +1).string_value ().c_str ()) ); + } + else if (name == "fontsize") + { + ui->sb_font_size->setValue ( props(1*i +1).float_value () ); + } + else if (name == "fontweight") + { + ui->cb_font_bold->setChecked ( props(1*i +1).string_value () == "bold" ); + } + else if (name == "fontangle") + { + ui->cb_font_italic->setChecked ( props(1*i +1).string_value () == "italic" ); + } + else if (name == "color") + { + QColor color; + if (props(1*i +1).is_matrix_type ()) + color = Utils::fromRgb (props(2*i +1).matrix_value ()); + else + color.setNamedColor (props(2*i +1).string_value ().c_str ()); + + if (color.isValid ()) + ui->btn_color->setPalette (QPalette (color)); + } + + } + + edit_string_changed (ui->edit_string->text ()); +} + +void +annotation_dialog::edit_string_changed (const QString &str) +{ + ui->button_box->button (QDialogButtonBox::Ok)->setEnabled (str.length () > 0); +} + +void +annotation_dialog::prompt_for_color () +{ + QWidget *widg = dynamic_cast<QWidget*> (sender ()); + if (widg) + { + QColor color = widg->palette ().color (QPalette::Button); + + color = QColorDialog::getColor(color, this); + + if (color.isValid ()) + { + widg->setPalette (QPalette (color)); + + QString css = QString ("background-color: %1; border: 1px solid %2;") + .arg (color.name ()) + .arg ("#000000"); + + widg->setStyleSheet (css); + widg->update (); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/graphics/annotation-dialog.h Sun Apr 19 09:54:54 2015 -0400 @@ -0,0 +1,62 @@ +/* + +Copyright (C) 2015 John Donoghue + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +<http://www.gnu.org/licenses/>. + +*/ + +#ifndef ANNOTATIONDIALOG_H +#define ANNOTATIONDIALOG_H + +#include <QDialog> +#include <QLineEdit> +#include <QAbstractButton> + +#include "oct-obj.h" + +namespace Ui +{ + class annotation_dialog; +} + +class annotation_dialog : public QDialog +{ + Q_OBJECT +public: + explicit annotation_dialog (QWidget * parent, const octave_value_list &pr); + ~annotation_dialog (); + + octave_value_list get_properties() const; + +private slots: + // slots for dialog's buttons + void button_clicked (QAbstractButton *button); + void edit_string_changed (const QString &str); + void prompt_for_color (); + +private: + void init(); + + void get_gui_props (); + void set_gui_props (); + + Ui::annotation_dialog * ui; + octave_value_list props; +}; + +#endif // ANNOTATIONDIALOG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgui/graphics/annotation-dialog.ui Sun Apr 19 09:54:54 2015 -0400 @@ -0,0 +1,1412 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>annotation_dialog</class> + <widget class="QDialog" name="annotation_dialog"> + <property name="windowModality"> + <enum>Qt::WindowModal</enum> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>450</width> + <height>368</height> + </rect> + </property> + <property name="windowTitle"> + <string>Annotation</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Text</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>String</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1" colspan="6"> + <widget class="QLineEdit" name="edit_string"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Font</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QFontComboBox" name="cb_font_name"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QSpinBox" name="sb_font_size"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>2</number> + </property> + <property name="maximum"> + <number>96</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QPushButton" name="cb_font_bold"> + <property name="toolTip"> + <string>bold</string> + </property> + <property name="text"> + <string>b</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="5"> + <widget class="QPushButton" name="cb_font_italic"> + <property name="toolTip"> + <string>italic</string> + </property> + <property name="text"> + <string>i</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="6"> + <widget class="QPushButton" name="btn_color"> + <property name="palette"> + <palette> + <active> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="toolTip"> + <string>color</string> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="styleSheet"> + <string notr="true">background-color: #000000; border: 1px solid #000000;</string> + </property> + <property name="text"> + <string/> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Horz alignment</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QComboBox" name="cb_horz_align"> + <item> + <property name="text"> + <string>left</string> + </property> + </item> + <item> + <property name="text"> + <string>middle</string> + </property> + </item> + <item> + <property name="text"> + <string>right</string> + </property> + </item> + </widget> + </item> + <item row="2" column="3" colspan="2"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Vert alignment</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="5" colspan="2"> + <widget class="QComboBox" name="cb_vert_align"> + <item> + <property name="text"> + <string>top</string> + </property> + </item> + <item> + <property name="text"> + <string>middle</string> + </property> + </item> + <item> + <property name="text"> + <string>bottom</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Position</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>X</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="sb_x"/> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_22"> + <property name="text"> + <string>Y</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="sb_y"/> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="label_23"> + <property name="text"> + <string>Width</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QDoubleSpinBox" name="sb_width"/> + </item> + <item row="0" column="6"> + <widget class="QLabel" name="label_24"> + <property name="text"> + <string>Height</string> + </property> + </widget> + </item> + <item row="0" column="7"> + <widget class="QDoubleSpinBox" name="sb_height"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>units</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QComboBox" name="cb_units"> + <item> + <property name="text"> + <string>normalized</string> + </property> + </item> + </widget> + </item> + <item row="1" column="4" colspan="2"> + <widget class="QCheckBox" name="cb_fit_box_to_text"> + <property name="text"> + <string>Fit to box</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Box</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_19"> + <property name="text"> + <string>Background</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="btn_background_color"> + <property name="palette"> + <palette> + <active> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="styleSheet"> + <string notr="true">background-color: #ffffff; border: 1px solid #000000;</string> + </property> + <property name="text"> + <string/> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Edge</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="3" colspan="2"> + <widget class="QPushButton" name="btn_edge_color"> + <property name="palette"> + <palette> + <active> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="styleSheet"> + <string notr="true">background-color: #000000; border: 1px solid #000000;</string> + </property> + <property name="text"> + <string/> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="5" colspan="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>167</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Line style</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="cb_line_style"> + <item> + <property name="text"> + <string>left</string> + </property> + </item> + <item> + <property name="text"> + <string>middle</string> + </property> + </item> + <item> + <property name="text"> + <string>right</string> + </property> + </item> + </widget> + </item> + <item row="1" column="2" colspan="2"> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Line width</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="4" colspan="2"> + <widget class="QSpinBox" name="sb_line_width"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>2</number> + </property> + <property name="maximum"> + <number>96</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="6"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>137</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="button_box"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>edit_string</tabstop> + <tabstop>cb_font_name</tabstop> + <tabstop>cb_font_bold</tabstop> + <tabstop>cb_font_italic</tabstop> + <tabstop>sb_font_size</tabstop> + <tabstop>cb_horz_align</tabstop> + <tabstop>cb_vert_align</tabstop> + <tabstop>cb_units</tabstop> + <tabstop>cb_fit_box_to_text</tabstop> + <tabstop>btn_edge_color</tabstop> + <tabstop>button_box</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>button_box</sender> + <signal>accepted()</signal> + <receiver>annotation_dialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>242</x> + <y>339</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>button_box</sender> + <signal>rejected()</signal> + <receiver>annotation_dialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>310</x> + <y>339</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui>
--- a/libgui/graphics/module.mk Sat Apr 18 20:38:59 2015 -0700 +++ b/libgui/graphics/module.mk Sun Apr 19 09:54:54 2015 -0400 @@ -6,9 +6,11 @@ graphics/images/rotate.png \ graphics/images/select.png \ graphics/images/zoom-in.png \ - graphics/images/zoom-out.png + graphics/images/zoom-out.png \ + $(octave_gui_graphics_UI) octave_gui_MOC += \ + graphics/moc-annotation-dialog.cc \ graphics/moc-Backend.cc \ graphics/moc-ButtonControl.cc \ graphics/moc-ContextMenu.cc \ @@ -28,10 +30,18 @@ graphics/moc-ToggleTool.cc \ graphics/moc-ToolBar.cc +octave_gui_graphics_UI = \ + graphics/annotation-dialog.ui + +octave_gui_graphics_UI_H = $(patsubst graphics/%.ui, graphics/ui-%.h, $(octave_gui_graphics_UI)) + +BUILT_SOURCES += $(octave_gui_graphics_UI_H) + octave_gui_graphics_RC = graphics/qrc-qthandles.cc noinst_HEADERS += \ graphics/__init_qt__.h \ + graphics/annotation-dialog.h \ graphics/Backend.h \ graphics/BaseControl.h \ graphics/ButtonControl.h \ @@ -71,6 +81,7 @@ graphics_libgui_graphics_la_SOURCES = \ graphics/__init_qt__.cc \ + graphics/annotation-dialog.cc \ graphics/Backend.cc \ graphics/BaseControl.cc \ graphics/ButtonControl.cc \ @@ -137,4 +148,5 @@ CLEANFILES += \ $(octave_gui_graphics_MOC) \ - $(octave_gui_graphics_RC) + $(octave_gui_graphics_RC) \ + $(octave_gui_graphics_UI_H)