summaryrefslogtreecommitdiffstats
path: root/kivio/kiviopart/ui
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kivio/kiviopart/ui
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kivio/kiviopart/ui')
-rw-r--r--kivio/kiviopart/ui/Makefile.am21
-rw-r--r--kivio/kiviopart/ui/addstencilsetdialog.cpp48
-rw-r--r--kivio/kiviopart/ui/addstencilsetdialog.h47
-rw-r--r--kivio/kiviopart/ui/aligndialog.ui632
-rw-r--r--kivio/kiviopart/ui/export_page_dialog.cpp60
-rw-r--r--kivio/kiviopart/ui/export_page_dialog.h28
-rw-r--r--kivio/kiviopart/ui/export_page_dialog_base.ui175
-rw-r--r--kivio/kiviopart/ui/kivio_birdeye_panel.cpp280
-rw-r--r--kivio/kiviopart/ui/kivio_birdeye_panel.h71
-rw-r--r--kivio/kiviopart/ui/kivio_birdeye_panel_base.ui108
-rw-r--r--kivio/kiviopart/ui/kivio_layer_panel.cpp341
-rw-r--r--kivio/kiviopart/ui/kivio_layer_panel.h84
-rw-r--r--kivio/kiviopart/ui/kivio_layer_panel_base.ui99
-rw-r--r--kivio/kiviopart/ui/kivio_protection_panel.cpp328
-rw-r--r--kivio/kiviopart/ui/kivio_protection_panel.h49
-rw-r--r--kivio/kiviopart/ui/kivio_protection_panel_base.ui128
-rw-r--r--kivio/kiviopart/ui/kivioaddstencilsetpanel.cpp226
-rw-r--r--kivio/kiviopart/ui/kivioaddstencilsetpanel.h56
-rw-r--r--kivio/kiviopart/ui/kivioaligndialog.cpp93
-rw-r--r--kivio/kiviopart/ui/kivioaligndialog.h43
-rw-r--r--kivio/kiviopart/ui/kivioarrowheadformatdlg.cpp210
-rw-r--r--kivio/kiviopart/ui/kivioarrowheadformatdlg.h70
-rw-r--r--kivio/kiviopart/ui/kiviooptionsdialog.cpp338
-rw-r--r--kivio/kiviopart/ui/kiviooptionsdialog.h107
-rw-r--r--kivio/kiviopart/ui/kiviostencilformatdlg.cpp224
-rw-r--r--kivio/kiviopart/ui/kiviostencilformatdlg.h73
-rw-r--r--kivio/kiviopart/ui/kiviostencilsetwidget.ui165
-rw-r--r--kivio/kiviopart/ui/kiviotextformatdlg.cpp192
-rw-r--r--kivio/kiviopart/ui/kiviotextformatdlg.h69
-rw-r--r--kivio/kiviopart/ui/layerlisttooltip.cpp61
-rw-r--r--kivio/kiviopart/ui/layerlisttooltip.h44
-rw-r--r--kivio/kiviopart/ui/objectlistpalette.cpp165
-rw-r--r--kivio/kiviopart/ui/objectlistpalette.h53
33 files changed, 4688 insertions, 0 deletions
diff --git a/kivio/kiviopart/ui/Makefile.am b/kivio/kiviopart/ui/Makefile.am
new file mode 100644
index 00000000..5e08a6ae
--- /dev/null
+++ b/kivio/kiviopart/ui/Makefile.am
@@ -0,0 +1,21 @@
+noinst_LTLIBRARIES = libui.la
+
+
+INCLUDES = -I$(top_srcdir)/kivio/kiviopart -I.. \
+ -I$(top_srcdir)/kivio/kiviopart/kiviosdk \
+ -I$(top_srcdir)/kivio/kiviopart/config \
+ -I$(top_builddir)/kivio/kiviopart/config \
+ $(KOFFICE_INCLUDES) \
+ $(KOTEXT_INCLUDES) \
+ $(all_includes)
+
+libui_la_METASOURCES = AUTO
+
+libui_la_SOURCES = aligndialog.ui kivio_birdeye_panel.cpp \
+ kivio_birdeye_panel_base.ui kivio_layer_panel_base.ui kivio_layer_panel.cpp \
+ kivio_protection_panel_base.ui kivio_protection_panel.cpp kiviooptionsdialog.cpp \
+ export_page_dialog_base.ui export_page_dialog.cpp kiviotextformatdlg.cpp kiviostencilformatdlg.cpp \
+ kivioarrowheadformatdlg.cpp kivioaligndialog.cpp kivioaddstencilsetpanel.cpp \
+ kiviostencilsetwidget.ui objectlistpalette.cpp addstencilsetdialog.cpp layerlisttooltip.cpp
+noinst_HEADERS = kivioaddstencilsetpanel.h objectlistpalette.h \
+ addstencilsetdialog.h layerlisttooltip.h
diff --git a/kivio/kiviopart/ui/addstencilsetdialog.cpp b/kivio/kiviopart/ui/addstencilsetdialog.cpp
new file mode 100644
index 00000000..a6386521
--- /dev/null
+++ b/kivio/kiviopart/ui/addstencilsetdialog.cpp
@@ -0,0 +1,48 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Peter Simonsson <psn@linux.se>,
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include "addstencilsetdialog.h"
+
+#include <klocale.h>
+
+#include "kivioaddstencilsetpanel.h"
+
+namespace Kivio {
+
+AddStencilSetDialog::AddStencilSetDialog(QWidget *parent, const char *name)
+ : KDialogBase(parent, name, false, i18n("Stencil Sets"), KDialogBase::Close)
+{
+ m_mainWidget = new AddStencilSetPanel(this);
+ setMainWidget(m_mainWidget);
+ setInitialSize(QSize(600, 450));
+
+ connect(m_mainWidget, SIGNAL(addStencilSet(const QString&)), this, SIGNAL(addStencilSet(const QString&)));
+}
+
+AddStencilSetDialog::~AddStencilSetDialog()
+{
+}
+
+void AddStencilSetDialog::updateList()
+{
+ m_mainWidget->updateList();
+}
+
+}
+
+#include "addstencilsetdialog.moc"
diff --git a/kivio/kiviopart/ui/addstencilsetdialog.h b/kivio/kiviopart/ui/addstencilsetdialog.h
new file mode 100644
index 00000000..458b409b
--- /dev/null
+++ b/kivio/kiviopart/ui/addstencilsetdialog.h
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 2005 Peter Simonsson <psn@linux.se>,
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef KIVIOADDSTENCILSETDIALOG_H
+#define KIVIOADDSTENCILSETDIALOG_H
+
+#include <kdialogbase.h>
+
+namespace Kivio {
+
+class AddStencilSetPanel;
+
+class AddStencilSetDialog : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ AddStencilSetDialog(QWidget *parent = 0, const char *name = 0);
+ ~AddStencilSetDialog();
+
+ public slots:
+ void updateList();
+
+ signals:
+ void addStencilSet(const QString&);
+
+ private:
+ AddStencilSetPanel* m_mainWidget;
+};
+
+}
+
+#endif
diff --git a/kivio/kiviopart/ui/aligndialog.ui b/kivio/kiviopart/ui/aligndialog.ui
new file mode 100644
index 00000000..cb18d91c
--- /dev/null
+++ b/kivio/kiviopart/ui/aligndialog.ui
@@ -0,0 +1,632 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>KivioAlignDialogWidget</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KivioAlignDialogWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>450</width>
+ <height>240</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>align</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Align</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="1">
+ <property name="name">
+ <cstring>hAlignBox</cstring>
+ </property>
+ <property name="title">
+ <string>Horizontal</string>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>PixmapLabel3_2_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>PixmapLabel2_2_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="4">
+ <property name="name">
+ <cstring>PixmapLabel1_2_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image2</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="0" column="3">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ahleft</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Left</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ahcenter</cstring>
+ </property>
+ <property name="text">
+ <string>Ce&amp;nter</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ahnone</cstring>
+ </property>
+ <property name="text">
+ <string>N&amp;one</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="0" column="5">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton" row="1" column="4" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ahright</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Right</string>
+ </property>
+ </widget>
+ <spacer row="2" column="4" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>aCenterPage</cstring>
+ </property>
+ <property name="text">
+ <string>Center of &amp;page</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>vAlignBox</cstring>
+ </property>
+ <property name="title">
+ <string>Vertical</string>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>PixmapLabel6_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image3</pixmap>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignLeft</set>
+ </property>
+ <property name="vAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>avtop</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Top</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>PixmapLabel5_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image4</pixmap>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="1">
+ <property name="name">
+ <cstring>avcenter</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;enter</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>PixmapLabel4_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image5</pixmap>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom|AlignLeft</set>
+ </property>
+ <property name="vAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="3" column="1">
+ <property name="name">
+ <cstring>avnone</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;None</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="1">
+ <property name="name">
+ <cstring>avbottom</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Bottom</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>distribute</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Distribute</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="1" column="1">
+ <property name="name">
+ <cstring>ButtonGroup9</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <property name="layoutSpacing" stdset="0">
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>dselection</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xtent of selection</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>dpage</cstring>
+ </property>
+ <property name="text">
+ <string>Extent of pa&amp;ge</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>vDistBox</cstring>
+ </property>
+ <property name="title">
+ <string>Vertical</string>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>PixmapLabel8_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image6</pixmap>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="1">
+ <property name="name">
+ <cstring>dvtop</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Top</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="1">
+ <property name="name">
+ <cstring>dvcenter</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;enter</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>PixmapLabel8_3</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image7</pixmap>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="4" column="1">
+ <property name="name">
+ <cstring>dvnone</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;None</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="1">
+ <property name="name">
+ <cstring>dvspacing</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Spacing</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>PixmapLabel8_4</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image8</pixmap>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="3" column="1">
+ <property name="name">
+ <cstring>dvbottom</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Bottom</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>PixmapLabel8_5</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image9</pixmap>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="1">
+ <property name="name">
+ <cstring>hDistBox</cstring>
+ </property>
+ <property name="title">
+ <string>Horizontal</string>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>PixmapLabel10_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image10</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="3">
+ <property name="name">
+ <cstring>PixmapLabel7_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image11</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>PixmapLabel9_2</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image12</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>PixmapLabel8_6</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image13</pixmap>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>dhleft</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Left</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="2">
+ <property name="name">
+ <cstring>dhspacing</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;pacing</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="3">
+ <property name="name">
+ <cstring>dhright</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Right</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="1">
+ <property name="name">
+ <cstring>dhcenter</cstring>
+ </property>
+ <property name="text">
+ <string>Ce&amp;nter</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>dhnone</cstring>
+ </property>
+ <property name="text">
+ <string>N&amp;one</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e2565856405bffcbc54103b11c85636000310570fc4b530b630b4300673955101582c110e90c4602aa82586c50e6c6e816a842a4388810520a25031981230036a079269898938d561370fbbbdc8eeabb5e60200b9f04d62</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006ab840265280d154b04016530891083aba39218163bb0b905ac4b39114d0ca849194420bb19aa176e1e441a6a5e62224e75d8cdc36e2fb2fb6aadb9001318544a</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006ab4405ca70b1443840128329a39618163bb0b905ac12c37d300226969808570c134b44322e118f3aace661b717d97db5d65c000f8a544a</data>
+ </image>
+ <image name="image3">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e2565856405bffcbc54103b11c85636000310570fc4b530b630b4300673d10058371024820930504615831050b144309fa01854809018980dd54faa18dc3c6437c31d020628ee232c862c845dacd69a0b0077074d62</data>
+ </image>
+ <image name="image4">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c4b530b630b43006ab4400651081534c190cc042ca703198122c6210618262ca506bc04e4303b8d4116f07163723790d538c4018a001a55a6b2e00270d4ba8</data>
+ </image>
+ <image name="image5">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c4b530b630b43006ab4400651041584c192c48504c1982c162ca60802686d007a2c911c3661e563164f7e11543f22fcccd4862896840a9d69a0b00536e4b7c</data>
+ </image>
+ <image name="image6">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e2565856405bffcbc54103b11c85636000310570fc4b530b630b4300673d1005837082482008856564688413048025d4c2f510f430c552f16f3a000452f14a0d8011784e8c5e66698f1300016833a832c312ce629a301a55a6b2e0058404bd2</data>
+ </image>
+ <image name="image7">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c4b530b630b43006ab44037031651040178362a85822082843311060a853c6340f44a0db0bd48f2186a2178f184c2f9273e176203917ae17c9b97037a3a883fa0dd93c94304016abb5e6020051784f1a</data>
+ </image>
+ <image name="image8">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c4b530b630b43006ab4406ca7a7a703165104017436074b144e5440c319001b8cc4b4403186ed143b2034d0c9b5e98f1c8fe8039176a3d8618cccdc86270bd58ccc308ab5a6b2e00ba5e4fba</data>
+ </image>
+ <image name="image9">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c4b530b630b43006ab4403601d20802e06a4c916c3625e221ac0708b32441d8a10d01474b144e5448418cc2264bdca088c2e86aa178251ec40330fc3cdb5d65c0045eb4fe6</data>
+ </image>
+ <image name="image10">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006ab54d6830208032a9608e42927a288254201217558cdc32206360c5d0cc8225b0c8b79707bc192e8622043c815039b576bcd05008a6f51d6</data>
+ </image>
+ <image name="image11">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006ab0401653d2850d643124b040a2b27a288254201217558cdc32e86691e500c84c91543980765a2d80bd5429e18ba79b5d65c0093cf51d6</data>
+ </image>
+ <image name="image12">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006abd4d353d6830210032e9608e42927a288254201217558cd4317039b842e06328f5c312ce6c1ed8548a289810d21530c625ead351700a0bd5202</data>
+ </image>
+ <image name="image13">
+ <data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c4b530b630b43006ab040365300201a8987222442c51192a9608062031080b973a1ce6618ac1cd43160332c816c3621edc5eb024ba18c81072c520e6d55a730100685452a2</data>
+ </image>
+</images>
+ <includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ </includes>
+
+ <layoutdefaults spacing="6" margin="11"/>
+ <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/kivio/kiviopart/ui/export_page_dialog.cpp b/kivio/kiviopart/ui/export_page_dialog.cpp
new file mode 100644
index 00000000..941bd87a
--- /dev/null
+++ b/kivio/kiviopart/ui/export_page_dialog.cpp
@@ -0,0 +1,60 @@
+#include "export_page_dialog.h"
+
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+
+#include <klocale.h>
+
+#include "export_page_dialog_base.h"
+#include "kivio_config.h"
+
+ExportPageDialog::ExportPageDialog( QWidget *parent, const char *name )
+ : KDialogBase(parent, name, true, i18n("Export Page"), Ok|Cancel, Ok)
+{
+ m_view = new ExportPageDialogBase(this);
+ setMainWidget(m_view);
+
+ m_view->m_checkCrop->setChecked(Kivio::Config::crop());
+ m_view->m_radioFullPage->setChecked(!Kivio::Config::selectedStencils());
+ m_view->m_radioSelectedStencils->setChecked(Kivio::Config::selectedStencils());
+ m_view->m_spinBorder->setValue(Kivio::Config::border());
+ m_view->m_spinQuality->setValue(Kivio::Config::quality());
+}
+
+int ExportPageDialog::quality()
+{
+ return m_view->m_spinQuality->value();
+}
+
+int ExportPageDialog::border()
+{
+ return m_view->m_spinBorder->value();
+}
+
+bool ExportPageDialog::crop()
+{
+ return m_view->m_checkCrop->isChecked();
+}
+
+bool ExportPageDialog::fullPage()
+{
+ return m_view->m_radioFullPage->isChecked();
+}
+
+bool ExportPageDialog::selectedStencils()
+{
+ return m_view->m_radioSelectedStencils->isChecked();
+}
+
+void ExportPageDialog::slotOk()
+{
+ Kivio::Config::setCrop(m_view->m_checkCrop->isChecked());
+ Kivio::Config::setSelectedStencils(m_view->m_radioSelectedStencils->isChecked());
+ Kivio::Config::setBorder(m_view->m_spinBorder->value());
+ Kivio::Config::setQuality(m_view->m_spinQuality->value());
+
+ accept();
+}
+
+#include "export_page_dialog.moc"
diff --git a/kivio/kiviopart/ui/export_page_dialog.h b/kivio/kiviopart/ui/export_page_dialog.h
new file mode 100644
index 00000000..9584950e
--- /dev/null
+++ b/kivio/kiviopart/ui/export_page_dialog.h
@@ -0,0 +1,28 @@
+#ifndef EXPORT_PAGE_DIALOG_H
+#define EXPORT_PAGE_DIALOG_H
+
+#include <kdialogbase.h>
+
+class ExportPageDialogBase;
+
+class ExportPageDialog : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ ExportPageDialog(QWidget* parent=0, const char* name=0);
+
+ int quality();
+ int border();
+
+ bool crop();
+ bool fullPage();
+ bool selectedStencils();
+
+ protected slots:
+ void slotOk();
+
+ private:
+ ExportPageDialogBase* m_view;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/export_page_dialog_base.ui b/kivio/kiviopart/ui/export_page_dialog_base.ui
new file mode 100644
index 00000000..da964922
--- /dev/null
+++ b/kivio/kiviopart/ui/export_page_dialog_base.ui
@@ -0,0 +1,175 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>ExportPageDialogBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ExportPageDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>290</width>
+ <height>210</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Export</string>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioSelectedStencils</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>48</y>
+ <width>249</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;Selected stencils</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Export the selected stencils on the current page</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;Selected Stencils&lt;/b&gt;&lt;br&gt;
+Export only the selected stencils to file.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>m_radioFullPage</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>246</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;All stencils</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Export all stencils on the current page</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;All Stencils&lt;/b&gt;&lt;br&gt;
+This will cause the entire page to be exported to the file. This means that &lt;i&gt;all&lt;/i&gt; stencils will be exported.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkCrop</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>82</y>
+ <width>242</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>C&amp;rop picture to edges</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Don't export extra blank space to file</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;Crop picture to edges&lt;/b&gt;&lt;br&gt;
+This will eliminate all blank portions of the drawing. The picture will only be as large as the stencils it contains. If your stencils are located in the upper right corner of the page, then only the upper right corner will be exported.</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quality:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_spinQuality</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>m_spinQuality</cstring>
+ </property>
+ <property name="maxValue">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The higher the quality, the more space the file takes up.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;Quality&lt;/b&gt;&lt;br&gt;
+Not all file formats use this. But for those that do, this affects the quality of the image that gets exported. 100 is the maximum quality. The higher the number, the better the picture looks. The downside is the higher the number, the larger the filesize.</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>m_spinBorder</cstring>
+ </property>
+ <property name="maxValue">
+ <number>10000</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>An optional border of whitespace around the page, in pixels</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;Border&lt;/b&gt;&lt;br&gt;
+Places a blank border around the edges of the image. This can be used if for one reason or another, the stencils don't fit into the export page with a 0-pixel border (default).</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Border:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_spinBorder</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/kivio/kiviopart/ui/kivio_birdeye_panel.cpp b/kivio/kiviopart/ui/kivio_birdeye_panel.cpp
new file mode 100644
index 00000000..6d8b8355
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_birdeye_panel.cpp
@@ -0,0 +1,280 @@
+#include "kivio_birdeye_panel.h"
+
+#include "kivio_screen_painter.h"
+
+#include "kivio_view.h"
+#include "kivio_doc.h"
+#include "kivio_page.h"
+#include "kivio_canvas.h"
+#include "kivio_common.h"
+#include "kivio_factory.h"
+
+#include <ktoolbar.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <KoGlobal.h>
+#include <KoZoomHandler.h>
+#include <kdeversion.h>
+#include <kiconloader.h>
+#include <kapplication.h>
+
+#include <qpixmap.h>
+#include <qslider.h>
+#include <qspinbox.h>
+#include <qframe.h>
+#include <qcursor.h>
+#include <qtoolbutton.h>
+
+#define TOGGLE_ACTION(X) ((KToggleAction*)child(X))
+
+KivioBirdEyePanel::KivioBirdEyePanel(KivioView* view, QWidget* parent, const char* name)
+: KivioBirdEyePanelBase(parent, name), m_pView(view), m_pCanvas(view->canvasWidget()), m_pDoc(view->doc())
+{
+ handlePress = false;
+ m_buffer = new QPixmap();
+ canvas->installEventFilter(this);
+ m_zoomHandler = new KoZoomHandler;
+
+ connect( m_pDoc, SIGNAL( sig_updateView(KivioPage*)), SLOT(slotUpdateView(KivioPage*)) );
+ connect( m_pView, SIGNAL(zoomChanged(int)), SLOT(canvasZoomChanged(int)));
+ connect( m_pCanvas, SIGNAL(visibleAreaChanged()), SLOT(updateView()));
+
+ m_zoomOutButton->setIconSet(SmallIconSet("viewmag-", 16));
+ m_zoomInButton->setIconSet(SmallIconSet("viewmag+", 16));
+ connect(m_zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomMinus()));
+ connect(m_zoomInButton, SIGNAL(clicked()), this, SLOT(zoomPlus()));
+ connect(m_zoomSlider, SIGNAL(valueChanged(int)), m_pView, SLOT(viewZoom(int)));
+
+ canvasZoomChanged(m_pView->zoomHandler()->zoom());
+}
+
+KivioBirdEyePanel::~KivioBirdEyePanel()
+{
+ delete m_buffer;
+ delete m_zoomHandler;
+}
+
+void KivioBirdEyePanel::zoomMinus()
+{
+ m_pCanvas->zoomOut(QPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2));
+}
+
+void KivioBirdEyePanel::zoomPlus()
+{
+ m_pCanvas->zoomIn(QPoint(m_pCanvas->width() / 2, m_pCanvas->height() / 2));
+}
+
+void KivioBirdEyePanel::canvasZoomChanged(int zoom)
+{
+ m_zoomSlider->blockSignals(true);
+ m_zoomSlider->setValue(zoom);
+ m_zoomSlider->blockSignals(false);
+ m_zoomOutButton->setEnabled(zoom > 25);
+ m_zoomInButton->setEnabled(zoom < 2000);
+ slotUpdateView(m_pView->activePage());
+}
+
+void KivioBirdEyePanel::slotUpdateView(KivioPage* page)
+{
+ if (!isVisible() || !page || m_pView->activePage() != page)
+ return;
+
+ updateView();
+}
+
+bool KivioBirdEyePanel::eventFilter(QObject* o, QEvent* ev)
+{
+ if (o == canvas && ev->type() == QEvent::Show) {
+ updateView();
+ }
+
+ if (o == canvas && ev->type() == QEvent::Resize) {
+ m_buffer->resize(canvas->size());
+ slotUpdateView(m_pView->activePage());
+ }
+
+ if (o == canvas && ev->type() == QEvent::Paint) {
+ updateView();
+ return true;
+ }
+
+ if (o == canvas && ev->type() == QEvent::MouseMove) {
+ QMouseEvent* me = (QMouseEvent*)ev;
+ if (me->state() == LeftButton)
+ handleMouseMoveAction(me->pos());
+ else
+ handleMouseMove(me->pos());
+
+ lastPos = me->pos();
+ return true;
+ }
+
+ if (o == canvas && ev->type() == QEvent::MouseButtonPress) {
+ QMouseEvent* me = (QMouseEvent*)ev;
+ if (me->button() == LeftButton)
+ handleMousePress(me->pos());
+
+ return true;
+ }
+
+ return KivioBirdEyePanelBase::eventFilter(o, ev);
+}
+
+void KivioBirdEyePanel::updateView()
+{
+ if (!m_pView || !m_pView->activePage()) return;
+
+ KoPageLayout pl = m_pView->activePage()->paperLayout();
+ m_zoomHandler->setZoomAndResolution(100, KoGlobal::dpiX(),
+ KoGlobal::dpiY());
+
+ int pw = m_zoomHandler->zoomItX(pl.ptWidth);
+ int ph = m_zoomHandler->zoomItY(pl.ptHeight);
+ QSize s2 = QSize(pw,ph);
+ QSize s1 = canvas->size();
+
+ double zx = (double)s1.width()/(double)s2.width();
+ double zy = (double)s1.height()/(double)s2.height();
+ double zxy = QMIN(zx,zy);
+
+ m_zoomHandler->setZoomAndResolution(qRound(zxy * 100), KoGlobal::dpiX(),
+ KoGlobal::dpiY());
+
+ pw = m_zoomHandler->zoomItX(pl.ptWidth);
+ ph = m_zoomHandler->zoomItY(pl.ptHeight);
+ int px0 = (s1.width()-pw)/2;
+ int py0 = (s1.height()-ph)/2;
+
+ QPoint p0 = QPoint(px0,py0);
+
+ QRect rect(QPoint(0,0),s1);
+
+ KivioScreenPainter kpainter;
+ kpainter.start(m_buffer);
+ kpainter.painter()->fillRect(rect, KApplication::palette().active().brush(QColorGroup::Mid));
+
+ kpainter.painter()->fillRect(px0, py0, pw, ph, white);
+
+ kpainter.painter()->translate(px0, py0);
+ m_pDoc->paintContent(kpainter, rect, false, m_pView->activePage(), p0, m_zoomHandler, false, false);
+
+ KoRect vr = m_pCanvas->visibleArea();
+
+ int x = m_zoomHandler->zoomItX(vr.x());
+ int y = m_zoomHandler->zoomItY(vr.y());
+ int w = m_zoomHandler->zoomItX(vr.width());
+ int h = m_zoomHandler->zoomItX(vr.height());
+
+ kpainter.setFGColor(red);
+ kpainter.drawRect(x, y, w, h);
+ kpainter.setFGColor(red.light());
+ kpainter.drawRect(x-1, y-1, w+2, h+2);
+ kpainter.stop();
+
+ varea.setRect(x + px0,y + py0,w,h);
+
+ bitBlt(canvas,0,0,m_buffer);
+}
+
+void KivioBirdEyePanel::handleMouseMove(QPoint p)
+{
+ handlePress = true;
+
+ QRect r1 = QRect(varea.x()-1, varea.y()-1, 3, varea.height()+2);
+ if (r1.contains(p)) {
+ canvas->setCursor(sizeHorCursor);
+ apos = AlignLeft;
+ return;
+ }
+
+ r1.moveBy(varea.width(),0);
+ if (r1.contains(p)) {
+ canvas->setCursor(sizeHorCursor);
+ apos = AlignRight;
+ return;
+ }
+
+ QRect r2 = QRect(varea.x()-1, varea.y()-1, varea.width()+2, 3);
+ if (r2.contains(p)) {
+ canvas->setCursor(sizeVerCursor);
+ apos = AlignTop;
+ return;
+ }
+
+ r2.moveBy(0, varea.height());
+ if (r2.contains(p)) {
+ canvas->setCursor(sizeVerCursor);
+ apos = AlignBottom;
+ return;
+ }
+
+ if (varea.contains(p)) {
+ canvas->setCursor(sizeAllCursor);
+ apos = AlignCenter;
+ return;
+ }
+
+ canvas->unsetCursor();
+ handlePress = false;
+}
+
+void KivioBirdEyePanel::handleMouseMoveAction(QPoint p)
+{
+ if (!handlePress)
+ return;
+
+ p -= lastPos;
+
+ if (apos == AlignCenter) {
+ double zy = m_pView->zoomHandler()->zoomedResolutionY() / m_zoomHandler->zoomedResolutionY();
+ double zx = m_pView->zoomHandler()->zoomedResolutionX() / m_zoomHandler->zoomedResolutionX();
+ m_pCanvas->setUpdatesEnabled(false);
+ m_pCanvas->scrollDx(-(int)(p.x()*zx));
+ m_pCanvas->scrollDy(-(int)(p.y()*zy));
+ m_pCanvas->setUpdatesEnabled(true);
+ return;
+ }
+
+ double dx = m_zoomHandler->unzoomItX(p.x());
+ double dy = m_zoomHandler->unzoomItY(p.y());
+
+ KoRect vr = m_pCanvas->visibleArea();
+ if (apos == AlignRight) {
+ vr.setWidth(QMAX(10.0, vr.width() + dx));
+ m_pCanvas->setVisibleAreaByWidth(vr);
+ }
+ else if (apos == AlignLeft) {
+ vr.setX(vr.x() + dx);
+ vr.setWidth(QMAX(10.0, vr.width() - dx));
+ m_pCanvas->setVisibleAreaByWidth(vr);
+ }
+ else if (apos == AlignTop) {
+ vr.setY(vr.y() + dy);
+ vr.setHeight(QMAX(10.0 ,vr.height() - dy));
+ m_pCanvas->setVisibleAreaByHeight(vr);
+ }
+ else if (apos == AlignBottom) {
+ vr.setHeight(QMAX(10.0 ,vr.height() + dy));
+ m_pCanvas->setVisibleAreaByHeight(vr);
+ }
+}
+
+void KivioBirdEyePanel::handleMousePress(QPoint p)
+{
+ if (handlePress)
+ return;
+
+ QSize s1 = canvas->size();
+ KoPageLayout pl = m_pView->activePage()->paperLayout();
+ int pw = m_zoomHandler->zoomItX(pl.ptWidth);
+ int ph = m_zoomHandler->zoomItY(pl.ptHeight);
+ int px0 = (s1.width()-pw)/2;
+ int py0 = (s1.height()-ph)/2;
+
+ double x = m_zoomHandler->unzoomItX(p.x() - px0);
+ double y = m_zoomHandler->unzoomItY(p.y() - py0);
+
+ m_pCanvas->setViewCenterPoint(KoPoint(x,y));
+}
+
+#include "kivio_birdeye_panel.moc"
diff --git a/kivio/kiviopart/ui/kivio_birdeye_panel.h b/kivio/kiviopart/ui/kivio_birdeye_panel.h
new file mode 100644
index 00000000..6a17fd85
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_birdeye_panel.h
@@ -0,0 +1,71 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
+ * Copyright (C) 2005 Peter Simonsson <psn@linux.se>
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIVIOBIRDEYEPANEL_H
+#define KIVIOBIRDEYEPANEL_H
+#include "kivio_birdeye_panel_base.h"
+
+class QPixmap;
+
+class KivioView;
+class KivioCanvas;
+class KivioDoc;
+class KivioPage;
+class KAction;
+class KoZoomHandler;
+
+class KivioBirdEyePanel : public KivioBirdEyePanelBase
+{ Q_OBJECT
+public:
+ KivioBirdEyePanel(KivioView* view, QWidget* parent=0, const char* name=0);
+ ~KivioBirdEyePanel();
+
+ bool eventFilter(QObject*, QEvent*);
+
+public slots:
+ void zoomMinus();
+ void zoomPlus();
+
+protected slots:
+ void updateView();
+ void canvasZoomChanged(int zoom);
+ void slotUpdateView(KivioPage*);
+
+protected:
+ void handleMouseMove(QPoint);
+ void handleMouseMoveAction(QPoint);
+ void handleMousePress(QPoint);
+
+private:
+ KivioView* m_pView;
+ KivioCanvas* m_pCanvas;
+ KivioDoc* m_pDoc;
+
+ KAction* zoomIn;
+ KAction* zoomOut;
+ QPixmap* m_buffer;
+
+ QRect varea;
+ AlignmentFlags apos;
+ bool handlePress;
+ QPoint lastPos;
+ KoZoomHandler* m_zoomHandler;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kivio_birdeye_panel_base.ui b/kivio/kiviopart/ui/kivio_birdeye_panel_base.ui
new file mode 100644
index 00000000..e3e22772
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_birdeye_panel_base.ui
@@ -0,0 +1,108 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KivioBirdEyePanelBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KivioBirdEyePanelBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>281</width>
+ <height>302</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <property name="layoutSpacing" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <widget class="QFrame" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>canvas</cstring>
+ </property>
+ <property name="mouseTracking">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="1" column="2">
+ <property name="name">
+ <cstring>m_zoomInButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Zoom In 25%</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="1" column="0">
+ <property name="name">
+ <cstring>m_zoomOutButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Zoom Out 25%</string>
+ </property>
+ </widget>
+ <widget class="QSlider" row="1" column="1">
+ <property name="name">
+ <cstring>m_zoomSlider</cstring>
+ </property>
+ <property name="minValue">
+ <number>25</number>
+ </property>
+ <property name="maxValue">
+ <number>2000</number>
+ </property>
+ <property name="pageStep">
+ <number>25</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Zoom</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="local" impldecl="in declaration">kiconloader.h</include>
+</includes>
+<slots>
+ <slot>zoomChanged(int)</slot>
+ <slot>zoomMinus()</slot>
+ <slot>zoomPlus()</slot>
+</slots>
+<pixmapfunction>BarIcon</pixmapfunction>
+<layoutdefaults spacing="2" margin="0"/>
+</UI>
diff --git a/kivio/kiviopart/ui/kivio_layer_panel.cpp b/kivio/kiviopart/ui/kivio_layer_panel.cpp
new file mode 100644
index 00000000..481a5644
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_layer_panel.cpp
@@ -0,0 +1,341 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kivio_layer_panel.h"
+
+#include "kivio_view.h"
+#include "kivio_doc.h"
+#include "kivio_page.h"
+#include "kivio_layer.h"
+#include "kivio_factory.h"
+#include "kivio_command.h"
+#include "layerlisttooltip.h"
+
+#include <qheader.h>
+#include <qlayout.h>
+
+#include <ktoolbar.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kiconloader.h>
+#include <kinputdialog.h>
+
+KivioLayerItem::KivioLayerItem(QListView* parent, KivioLayer* d, int id)
+: QListViewItem(parent), data(d)
+{
+ QString ids;
+ QString space;
+ ids.setNum(id);
+ space.fill(' ',10-ids.length());
+ ids.prepend(space);
+ setText(5,ids);
+
+ update();
+}
+
+KivioLayerItem::~KivioLayerItem()
+{
+}
+
+void KivioLayerItem::update()
+{
+ setPixmap(0, data->visible() ? SmallIcon("layer_visible",KivioFactory::global()):SmallIcon("layer_novisible",KivioFactory::global()));
+ setPixmap(1, data->printable() ? SmallIcon("layer_print",KivioFactory::global()):SmallIcon("layer_noprint",KivioFactory::global()));
+ setPixmap(2, data->editable() ? SmallIcon("layer_editable",KivioFactory::global()):SmallIcon("layer_noeditable",KivioFactory::global()));
+ setPixmap(3, data->connectable() ? SmallIcon("layer_connect",KivioFactory::global()):SmallIcon("layer_noconnect",KivioFactory::global()));
+ setText(4,data->name());
+}
+
+
+/*********************************************************/
+KivioLayerPanel::KivioLayerPanel(KivioView* view, QWidget* parent, const char* name)
+: KivioLayerPanelBase(parent, name), m_pView(view)
+{
+ list->header()->hide();
+ list->addColumn(i18n("View"),15);
+ list->addColumn(i18n("Print"),15);
+ list->addColumn(i18n("Editable"),15);
+ list->addColumn(i18n("Connect"),15);
+ list->addColumn(i18n("Name"),-1);
+ list->setSorting(5, false);
+ list->installEventFilter(this);
+
+ actNew = new KAction( i18n("New Layer"), BarIcon("layer_add",KivioFactory::global()), 0, this, SLOT(addItem()), this);
+ actDel = new KAction( i18n("Remove Layer"), BarIcon("layer_remove",KivioFactory::global()), 0, this, SLOT(removeItem()), this);
+ actRename = new KAction( i18n("Rename Layer"), BarIcon("item_rename",KivioFactory::global()), 0, this, SLOT(renameItem()), this);
+ actUp = new KAction( i18n("Move Layer Up"), "up", 0, this, SLOT(upItem()), this);
+ actDown = new KAction( i18n("Move Layer Down"), "down", 0, this, SLOT(downItem()), this);
+
+ actNew->plug(bar);
+ actDel->plug(bar);
+ bar->insertSeparator();
+ actRename->plug(bar);
+ bar->insertSeparator();
+ actUp->plug(bar);
+ actDown->plug(bar);
+
+ new Kivio::LayerListToolTip(list->viewport(), list);
+}
+
+KivioLayerPanel::~KivioLayerPanel()
+{
+}
+
+bool KivioLayerPanel::eventFilter(QObject* o, QEvent* ev)
+{
+ if (o == list && (ev->type() == QEvent::LayoutHint || ev->type() == QEvent::Resize)) {
+ int s = list->width() - 2*(list->margin() + list->lineWidth());
+ s -= list->header()->sectionSize(0);
+ s -= list->header()->sectionSize(1);
+ s -= list->header()->sectionSize(2);
+ s -= list->header()->sectionSize(3);
+ list->header()->resizeSection(4,s);
+ list->triggerUpdate();
+ }
+
+ return QWidget::eventFilter(o, ev);
+}
+
+void KivioLayerPanel::addItem()
+{
+ KivioPage* page = m_pView->activePage();
+ KivioLayer* layer = new KivioLayer(page);
+
+ // Set the layer name to something a bit different. This isn't
+ // guaranteed to be unique, but it's better than "Untitled"
+ layer->setName(i18n("Layer %1").arg(id));
+ page->addLayer(layer);
+ page->setCurLayer(layer);
+
+ m_pView->doc()->updateView(page);
+
+ KivioAddLayerCommand * cmd = new KivioAddLayerCommand( i18n("Add Layer"), page, layer, id );
+ m_pView->doc()->addCommand(cmd );
+
+ KivioLayerItem* item = new KivioLayerItem(list, layer, id++);
+ list->sort();
+ list->setCurrentItem(item);
+}
+
+void KivioLayerPanel::removeItem()
+{
+ KivioLayerItem* item = (KivioLayerItem*)list->currentItem();
+ if (!item || (m_pView->activePage()->layers()->count() <= 1))
+ return;
+
+ itemActivated(item);
+
+ m_pView->activePage()->removeCurrentLayer();
+ m_pView->doc()->updateView(m_pView->activePage());
+
+ delete item;
+}
+
+void KivioLayerPanel::renameItem()
+{
+ KivioLayerItem* i = (KivioLayerItem*)list->currentItem();
+ if (!i)
+ return;
+
+ KivioLayer* layer = i->data;
+ QString oldText = layer->name();
+
+ bool ok=false;
+ QString newName = KInputDialog::getText(i18n("Rename Layer"),
+ i18n("Layer name:"), oldText, &ok, this);
+
+ if (ok) {
+ layer->setName(newName);
+ KivioRenameLayerCommand *cmd = new KivioRenameLayerCommand( i18n("Rename Layer"), layer, oldText, newName);
+ m_pView->doc()->addCommand( cmd );
+ }
+
+ i->update();
+}
+
+void KivioLayerPanel::upItem()
+{
+ KivioLayerItem* item = (KivioLayerItem*)list->currentItem();
+ if (!item)
+ return;
+
+ QListViewItem* above = item->itemAbove();
+ if (!above)
+ return;
+
+ KivioPage* page = m_pView->activePage();
+ KivioLayer* layer = item->data;
+
+ int pos = page->layers()->find(layer);
+ // It's already the top layer... return
+ if(pos == (static_cast<int>(page->layers()->count()) - 1))
+ return;
+
+ layer = page->layers()->take();
+ if( !layer )
+ return;
+
+ page->layers()->insert(pos + 1, layer);
+
+ QString t = above->text(5);
+ above->setText(5,item->text(5));
+ item->setText(5,t);
+
+ list->sort();
+
+ updateButtons(item);
+
+ page->setCurLayer(layer);
+ m_pView->doc()->updateView(page);
+}
+
+void KivioLayerPanel::downItem()
+{
+ KivioLayerItem* item = (KivioLayerItem*)list->currentItem();
+ if (!item)
+ return;
+
+ QListViewItem* below = item->itemBelow();
+ if (!below)
+ return;
+
+ KivioPage* page = m_pView->activePage();
+ KivioLayer* layer = item->data;
+
+ int pos = page->layers()->find(layer);
+ // It's already the bottom layer... return
+ if (pos == 0)
+ return;
+
+ layer = page->layers()->take();
+ if( !layer )
+ return;
+
+ page->layers()->insert(pos - 1, layer);
+
+ QString t = below->text(5);
+ below->setText(5,item->text(5));
+ item->setText(5,t);
+
+ list->sort();
+
+ updateButtons(item);
+
+ page->setCurLayer(layer);
+ m_pView->doc()->updateView(page);
+}
+
+void KivioLayerPanel::updateButtons(QListViewItem* i)
+{
+ if (!i) {
+ actDel->setEnabled(false);
+ actRename->setEnabled(false);
+ actUp->setEnabled(false);
+ actDown->setEnabled(false);
+ } else {
+ if(m_pView->activePage()->layers()->count() > 1) {
+ actDel->setEnabled(true);
+ } else {
+ actDel->setEnabled(false);
+ }
+
+ actRename->setEnabled(true);
+ actUp->setEnabled(i->itemAbove());
+ actDown->setEnabled(i->itemBelow());
+ }
+}
+
+void KivioLayerPanel::itemClicked(QListViewItem* i, const QPoint&, int c)
+{
+ if(!i) {
+ return;
+ }
+
+ KivioLayerItem* vi = static_cast<KivioLayerItem*>(i);
+ KivioLayer* layer = vi->data;
+
+ switch(c)
+ {
+ case 0:
+ layer->setVisible(!layer->visible());
+ break;
+ case 1:
+ layer->setPrintable(!layer->printable());
+ break;
+ case 2:
+ layer->setEditable(!layer->editable());
+ break;
+ case 3:
+ layer->setConnectable(!layer->connectable());
+ break;
+ default:
+ break;
+ }
+
+ vi->update();
+ m_pView->doc()->updateView(m_pView->activePage());
+}
+
+void KivioLayerPanel::itemActivated(QListViewItem* i)
+{
+ if (!i)
+ return;
+
+ KivioLayerItem* vi = (KivioLayerItem*)i;
+
+ KivioPage* page = m_pView->activePage();
+ page->setCurLayer(vi->data);
+
+ // Switching layers unselects all stencils. We REALLY don't want multiple
+ // selections between layers. If you don't do this, and multiple stencils
+ // on various layers do occur and a group operation occurs, I have NO idea
+ // what will happen since I didn't code it with multi-layer-group in mind...
+ // or did I? Anyway, if you get rid of this, you have to go check all the
+ // multi-select operations.
+ page->unselectAllStencils();
+ m_pView->doc()->updateView(page);
+
+ updateButtons(i);
+}
+
+void KivioLayerPanel::reset()
+{
+ id = 1;
+ list->clear();
+
+ KivioPage* page = m_pView->activePage();
+ KivioLayer* layer = page->firstLayer();
+ QListViewItem* ci = 0;
+
+ while (layer) {
+ KivioLayerItem* i = new KivioLayerItem(list, layer, id++);
+ if (layer == page->curLayer())
+ ci = i;
+ layer = page->nextLayer();
+ }
+
+ if(!ci) {
+ ci = list->firstChild();
+ }
+
+ list->setSelected(ci, true);
+ list->sort();
+ updateButtons(list->currentItem());
+}
+
+#include "kivio_layer_panel.moc"
diff --git a/kivio/kiviopart/ui/kivio_layer_panel.h b/kivio/kiviopart/ui/kivio_layer_panel.h
new file mode 100644
index 00000000..4f781313
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_layer_panel.h
@@ -0,0 +1,84 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIVIOLAYERPANEL_H
+#define KIVIOLAYERPANEL_H
+
+class KAction;
+
+class KivioView;
+class KivioLayer;
+
+#include <qlistview.h>
+
+#include "kivio_layer_panel_base.h"
+
+class KivioLayerItem: public QListViewItem
+{
+ friend class KivioLayerPanel;
+ public:
+ KivioLayerItem(QListView* parent, KivioLayer*, int id);
+ ~KivioLayerItem();
+
+ KivioLayer* layer() const { return data; }
+
+ protected:
+ void update();
+
+ private:
+ KivioLayer* data;
+};
+
+
+/*********************************************************/
+class KivioLayerPanel : public KivioLayerPanelBase
+{
+ Q_OBJECT
+ public:
+ KivioLayerPanel(KivioView* view, QWidget* parent=0, const char* name=0);
+ ~KivioLayerPanel();
+
+ bool eventFilter(QObject*, QEvent*);
+
+ public slots:
+ void reset();
+
+ protected slots:
+ void addItem();
+ void removeItem();
+ void renameItem();
+ void upItem();
+ void downItem();
+
+ void itemClicked(QListViewItem*, const QPoint&, int);
+ void itemActivated(QListViewItem*);
+ void updateButtons(QListViewItem*);
+
+ private:
+ KivioView* m_pView;
+
+ KAction* actNew;
+ KAction* actDel;
+ KAction* actRename;
+ KAction* actUp;
+ KAction* actDown;
+
+ int id;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kivio_layer_panel_base.ui b/kivio/kiviopart/ui/kivio_layer_panel_base.ui
new file mode 100644
index 00000000..86733819
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_layer_panel_base.ui
@@ -0,0 +1,99 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KivioLayerPanelBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KivioLayerPanelBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>177</width>
+ <height>268</height>
+ </rect>
+ </property>
+ <property name="layoutMargin" stdset="0">
+ </property>
+ <property name="layoutSpacing" stdset="0">
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="KToolBar">
+ <property name="name">
+ <cstring>bar</cstring>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <property name="name">
+ <cstring>list</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showToolTips">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>KToolBar</class>
+ <header location="local">ktoolbar.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XBM.GZ" length="79">789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>list</sender>
+ <signal>currentChanged(QListViewItem*)</signal>
+ <receiver>KivioLayerPanelBase</receiver>
+ <slot>updateButtons(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>list</sender>
+ <signal>currentChanged(QListViewItem*)</signal>
+ <receiver>KivioLayerPanelBase</receiver>
+ <slot>itemActivated(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>list</sender>
+ <signal>clicked(QListViewItem*,const QPoint&amp;,int)</signal>
+ <receiver>KivioLayerPanelBase</receiver>
+ <slot>itemClicked(QListViewItem*,const QPoint&amp;,int)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot access="protected">itemActivated(QListViewItem*)</slot>
+ <slot access="protected">itemClicked(QListViewItem*,const QPoint&amp;,int)</slot>
+ <slot access="protected">updateButtons(QListViewItem*)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>ktoolbar.h</includehint>
+</includehints>
+</UI>
diff --git a/kivio/kiviopart/ui/kivio_protection_panel.cpp b/kivio/kiviopart/ui/kivio_protection_panel.cpp
new file mode 100644
index 00000000..29ac5794
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_protection_panel.cpp
@@ -0,0 +1,328 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kivio_protection_panel.h"
+#include "kivio_protection_panel.moc"
+
+#include "kivio_doc.h"
+#include "kivio_layer.h"
+#include "kivio_page.h"
+#include "kivio_stencil.h"
+#include "kivio_view.h"
+#include "kivio_command.h"
+
+#include <qbitarray.h>
+#include <qcheckbox.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+KivioProtectionPanel::KivioProtectionPanel( KivioView *view, QWidget *parent, const char *name )
+ : KivioProtectionPanelBase(parent, name), m_pView(view)
+{
+ QObject::connect( m_checkWidth, SIGNAL(toggled(bool)), this, SLOT(togWidth(bool)) );
+ QObject::connect( m_checkHeight, SIGNAL(toggled(bool)), this, SLOT(togHeight(bool)) );
+ QObject::connect( m_checkAspect, SIGNAL(toggled(bool)), this, SLOT(togAspect(bool)) );
+ QObject::connect( m_checkDeletion, SIGNAL(toggled(bool)), this, SLOT(togDelete(bool)) );
+ QObject::connect( m_checkXPosition, SIGNAL(toggled(bool)), this, SLOT(togX(bool)) );
+ QObject::connect( m_checkYPosition, SIGNAL(toggled(bool)), this, SLOT(togY(bool)) );
+}
+
+KivioProtectionPanel::~KivioProtectionPanel()
+{
+}
+
+void KivioProtectionPanel::togWidth(bool on)
+{
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+ KMacroCommand * macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro = false;
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpWidth) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_WIDTH);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set width-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+void KivioProtectionPanel::togHeight(bool on)
+{
+ KMacroCommand* macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro = false;
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpHeight) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_HEIGHT);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set height-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+void KivioProtectionPanel::togAspect(bool on)
+{
+ KMacroCommand* macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro = false;
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpAspect) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_ASPECT);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set height-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+void KivioProtectionPanel::togDelete(bool on)
+{
+ KMacroCommand * macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro=false;
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpDeletion) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_DELETE);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set delete-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+void KivioProtectionPanel::togX(bool on)
+{
+ KMacroCommand * macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro=false;
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpX) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_POSX);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set X-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+
+void KivioProtectionPanel::togY(bool on)
+{
+ KMacroCommand * macro = new KMacroCommand(i18n("Change Protection Attribute"));
+ bool createMacro=false;
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ if(pStencil->canProtect()->at(kpY) == true) {
+ KivioChangeStencilProtectCommand* cmd = new KivioChangeStencilProtectCommand(i18n("Change Protection Attribute"),
+ m_pView->activePage(), pStencil, on, KivioChangeStencilProtectCommand::KV_POSY);
+ macro->addCommand(cmd);
+ createMacro = true;
+ } else {
+ kdDebug(43000) << "Attempt to set Y-protection of a stencil which does not support it.\n";
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ if(createMacro) {
+ macro->execute();
+ m_pView->doc()->addCommand(macro);
+ } else {
+ delete macro;
+ }
+}
+
+void KivioProtectionPanel::updateCheckBoxes()
+{
+ // If there are no selected stencils, then disable all checkboxes,
+ // and uncheck them
+ if(m_pView->activePage()->selectedStencils()->count() == 0)
+ {
+ m_checkAspect->setEnabled(false);
+ m_checkXPosition->setEnabled(false);
+ m_checkYPosition->setEnabled(false);
+ m_checkDeletion->setEnabled(false);
+ m_checkHeight->setEnabled(false);
+ m_checkWidth->setEnabled(false);
+
+ m_checkAspect->setChecked(false);
+ m_checkXPosition->setChecked(false);
+ m_checkYPosition->setChecked(false);
+ m_checkDeletion->setChecked(false);
+ m_checkHeight->setChecked(false);
+ m_checkWidth->setChecked(false);
+
+ return;
+ }
+
+ QBitArray bits( NUM_PROTECTIONS );
+ int i;
+
+ // Assume all protections are valid by default
+ for(i = 0; i < NUM_PROTECTIONS; i++) {
+ bits.setBit(i);
+ }
+
+
+ KivioStencil* pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ while(pStencil) {
+ // Now build an array representing which protection fields are valid
+ // since there could be multiple types of stencils selected with varying
+ // protection abilities
+ for(i = 0; i < NUM_PROTECTIONS; i++) {
+ if(pStencil->canProtect()->at(i) == false) {
+ bits.clearBit(i);
+ }
+ }
+
+ pStencil = m_pView->activePage()->selectedStencils()->next();
+ }
+
+ QObject::disconnect(m_checkWidth, SIGNAL(toggled(bool)), this, SLOT(togWidth(bool)));
+ QObject::disconnect(m_checkHeight, SIGNAL(toggled(bool)), this, SLOT(togHeight(bool)));
+ QObject::disconnect(m_checkAspect, SIGNAL(toggled(bool)), this, SLOT(togAspect(bool)));
+ QObject::disconnect(m_checkDeletion, SIGNAL(toggled(bool)), this, SLOT(togDelete(bool)));
+ QObject::disconnect(m_checkXPosition, SIGNAL(toggled(bool)), this, SLOT(togX(bool)));
+ QObject::disconnect(m_checkYPosition, SIGNAL(toggled(bool)), this, SLOT(togY(bool)));
+
+ // Enable and disable the check boxes based on what protections are available
+ for(i = 0; i < NUM_PROTECTIONS; i++) {
+ bool on = bits.at(i);
+
+ switch(i) {
+ case kpX:
+ m_checkXPosition->setEnabled(on);
+ break;
+
+ case kpY:
+ m_checkYPosition->setEnabled(on);
+ break;
+
+ case kpWidth:
+ m_checkWidth->setEnabled(on);
+ break;
+
+ case kpHeight:
+ m_checkHeight->setEnabled(on);
+ break;
+
+ case kpDeletion:
+ m_checkDeletion->setEnabled(on);
+ break;
+
+ case kpAspect:
+ m_checkAspect->setEnabled(on);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+
+ // If we have more than one stencil selected, then clear all checkboxes
+ if(m_pView->activePage()->selectedStencils()->count() > 1) {
+ m_checkAspect->setChecked(false);
+ m_checkXPosition->setChecked(false);
+ m_checkYPosition->setChecked(false);
+ m_checkDeletion->setChecked(false);
+ m_checkHeight->setChecked(false);
+ m_checkWidth->setChecked(false);
+ } else { // Otherwise fill in the checkboxes with the single selection
+ pStencil = m_pView->activePage()->selectedStencils()->first();
+
+ m_checkAspect->setChecked( pStencil->protection()->at(kpAspect) );
+ m_checkDeletion->setChecked( pStencil->protection()->at(kpDeletion) );
+ m_checkXPosition->setChecked( pStencil->protection()->at(kpX) );
+ m_checkYPosition->setChecked( pStencil->protection()->at(kpY) );
+ m_checkWidth->setChecked( pStencil->protection()->at(kpWidth) );
+ m_checkHeight->setChecked( pStencil->protection()->at(kpHeight) );
+ }
+
+ QObject::connect(m_checkWidth, SIGNAL(toggled(bool)), this, SLOT(togWidth(bool)));
+ QObject::connect(m_checkHeight, SIGNAL(toggled(bool)), this, SLOT(togHeight(bool)));
+ QObject::connect(m_checkAspect, SIGNAL(toggled(bool)), this, SLOT(togAspect(bool)));
+ QObject::connect(m_checkDeletion, SIGNAL(toggled(bool)), this, SLOT(togDelete(bool)));
+ QObject::connect(m_checkXPosition, SIGNAL(toggled(bool)), this, SLOT(togX(bool)));
+ QObject::connect(m_checkYPosition, SIGNAL(toggled(bool)), this, SLOT(togY(bool)));
+}
diff --git a/kivio/kiviopart/ui/kivio_protection_panel.h b/kivio/kiviopart/ui/kivio_protection_panel.h
new file mode 100644
index 00000000..b8ea9d00
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_protection_panel.h
@@ -0,0 +1,49 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef _KIVIO_PROTECTION_PANEL_H
+#define _KIVIO_PROTECTION_PANEL_H
+
+class KAction;
+class KivioView;
+class KivioLayer;
+
+#include "kivio_protection_panel_base.h"
+
+class KivioProtectionPanel : public KivioProtectionPanelBase
+{
+Q_OBJECT
+
+public:
+ KivioProtectionPanel( KivioView *view, QWidget *parent=0, const char *name=0 );
+ virtual ~KivioProtectionPanel();
+
+public slots:
+ void updateCheckBoxes();
+ void togWidth(bool);
+ void togHeight(bool);
+ void togAspect(bool);
+ void togDelete(bool);
+ void togX(bool);
+ void togY(bool);
+
+protected:
+ KivioView *m_pView;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kivio_protection_panel_base.ui b/kivio/kiviopart/ui/kivio_protection_panel_base.ui
new file mode 100644
index 00000000..6d15aa7e
--- /dev/null
+++ b/kivio/kiviopart/ui/kivio_protection_panel_base.ui
@@ -0,0 +1,128 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KivioProtectionPanelBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KivioProtectionPanelBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>124</width>
+ <height>147</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Protection</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkWidth</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Width</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to change the width of the selected stencils</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkHeight</cstring>
+ </property>
+ <property name="text">
+ <string>Hei&amp;ght</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to change the height of the selected stencils</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkAspect</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Aspect ratio</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to change the aspect ratio of the selected stencils</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkXPosition</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;X position</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to protect the x position of the selected stencils</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkYPosition</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Y position</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to protect the y position of the selected stencils</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_checkDeletion</cstring>
+ </property>
+ <property name="text">
+ <string>Deletio&amp;n</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggles the ability to delete the selected stencils</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>281</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<tabstops>
+ <tabstop>m_checkWidth</tabstop>
+ <tabstop>m_checkHeight</tabstop>
+ <tabstop>m_checkAspect</tabstop>
+ <tabstop>m_checkXPosition</tabstop>
+ <tabstop>m_checkYPosition</tabstop>
+ <tabstop>m_checkDeletion</tabstop>
+</tabstops>
+<layoutdefaults spacing="2" margin="0"/>
+</UI>
diff --git a/kivio/kiviopart/ui/kivioaddstencilsetpanel.cpp b/kivio/kiviopart/ui/kivioaddstencilsetpanel.cpp
new file mode 100644
index 00000000..da7e6685
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioaddstencilsetpanel.cpp
@@ -0,0 +1,226 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004-2005 Peter Simonsson <psn@linux.se>,
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include "kivioaddstencilsetpanel.h"
+
+#include <qfile.h>
+#include <qdir.h>
+#include <qstringlist.h>
+#include <qiconview.h>
+#include <qgroupbox.h>
+#include <qpushbutton.h>
+#include <qtextbrowser.h>
+#include <qsplitter.h>
+
+#include <kstandarddirs.h>
+#include <kglobal.h>
+#include <klistview.h>
+
+#include "kivio_stencil_spawner_set.h"
+#include "kivio_stencil_spawner.h"
+#include "kivio_stencil_spawner_info.h"
+#include "kivio_stencil.h"
+#include "kivioglobal.h"
+
+namespace Kivio {
+ AddStencilSetPanel::AddStencilSetPanel(QWidget *parent, const char *name)
+ : KivioStencilSetWidget(parent, name)
+ {
+ int height = m_stencilsetGBox->height() / 2;
+ QValueList<int> sizes;
+ sizes << height << height;
+ m_stencilSetSplitter->setSizes(sizes);
+ updateList();
+
+ connect(m_stencilSetLView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(changeStencilSet(QListViewItem*)));
+ connect(m_addToDocBtn, SIGNAL(clicked()), this, SLOT(addToDocument()));
+
+ QListViewItem* tmp = m_stencilSetLView->firstChild();
+
+ if(tmp) {
+ tmp = tmp->firstChild();
+
+ if(tmp) {
+ m_stencilSetLView->setSelected(tmp, true);
+ m_stencilSetLView->ensureItemVisible(tmp);
+ }
+ }
+#if KDE_IS_VERSION(3,4,0)
+ m_stencilSetLView-> setShadeSortColumn(false);
+#endif
+ }
+
+
+ AddStencilSetPanel::~AddStencilSetPanel()
+ {
+ }
+
+ void AddStencilSetPanel::updateList()
+ {
+ KStandardDirs *dirs = KGlobal::dirs();
+ QStringList dirList = dirs->findDirs("data", "kivio/stencils");
+ dirList.sort();
+ m_stencilSetLView->clear();
+
+ for(QStringList::Iterator it = dirList.begin(); it != dirList.end(); ++it)
+ {
+ QString dir = (*it);
+ loadCollections(dir);
+ }
+ }
+
+ void AddStencilSetPanel::loadCollections(const QString& dir)
+ {
+ QDir rootDir( dir );
+
+ rootDir.setFilter( QDir::Dirs );
+ rootDir.setSorting( QDir::Name );
+
+ const QFileInfoList *colList = rootDir.entryInfoList();
+ QFileInfoListIterator colIt( *colList );
+ QFileInfo *colFInfo;
+ QString cId;
+
+ while((colFInfo = colIt.current()))
+ {
+ if((colFInfo->fileName() != "..") && (colFInfo->fileName() != "."))
+ {
+ cId = KivioStencilSpawnerSet::readId(colFInfo->absFilePath());
+ QListViewItem* li = m_stencilSetLView->firstChild();
+
+ while(li) {
+ if(li->text(1) == cId) {
+ break;
+ }
+
+ li = li->nextSibling();
+ }
+
+ if(!li) {
+ li = new KListViewItem(m_stencilSetLView,
+ KivioStencilSpawnerSet::readTitle(colFInfo->absFilePath()),
+ KivioStencilSpawnerSet::readId(colFInfo->absFilePath()));
+ li->setPixmap(0, loadIcon("icon", colFInfo->absFilePath()));
+ }
+
+ loadStencilSet(li, dir + "/" + colFInfo->fileName());
+ }
+
+ ++colIt;
+ }
+ }
+
+ void AddStencilSetPanel::loadStencilSet(QListViewItem* li, const QString& dir)
+ {
+ QDir rootDir( dir );
+
+ rootDir.setFilter( QDir::Dirs );
+ rootDir.setSorting( QDir::Name );
+
+ const QFileInfoList *setList = rootDir.entryInfoList();
+ QFileInfoListIterator setIt( *setList );
+ QFileInfo *setFInfo;
+
+ while( (setFInfo = setIt.current()) )
+ {
+ if( setFInfo->fileName() != ".." && setFInfo->fileName() != "." )
+ {
+ KListViewItem* tmp = new KListViewItem(li, KivioStencilSpawnerSet::readTitle(setFInfo->absFilePath()),
+ dir + "/" + setFInfo->fileName());
+ tmp->setPixmap(0, loadIcon("icon", setFInfo->absFilePath()));
+
+ if(m_currentDir == setFInfo->absFilePath()) {
+ tmp->setSelected(true);
+ m_stencilSetLView->ensureItemVisible(tmp);
+ }
+ }
+
+ ++setIt;
+ }
+ }
+
+ QPixmap AddStencilSetPanel::loadIcon(const QString& name, const QString& dir)
+ {
+ QString fs;
+
+ if( QFile::exists(dir + "/" + name + ".xpm") ) {
+ fs = dir + "/" + name + ".xpm";
+ } else if( QFile::exists(dir + "/" + name + ".png") ) {
+ fs = dir + "/" + name + ".png";
+ } else {
+ return QPixmap();
+ }
+
+ return QPixmap( fs );
+ }
+
+ void AddStencilSetPanel::changeStencilSet(QListViewItem* li)
+ {
+ if(!li || !li->parent()) {
+ return;
+ }
+
+ m_stencilsetGBox->setTitle(li->text(0));
+ m_addToDocBtn->setEnabled(true);
+ KivioStencilSpawnerSet* spawnerSet = new KivioStencilSpawnerSet(li->text(0));
+ // Load the stencil icons
+ m_currentDir = li->text(1);
+ spawnerSet->loadDir(m_currentDir);
+ QStringList files = spawnerSet->files();
+
+ // Remove the old icons
+ m_stencilIView->clear();
+ KivioStencilSpawner* spawner = 0;
+ KivioStencil* stencil = 0;
+ int count = 0;
+
+ for(QStringList::Iterator it = files.begin(); it != files.end(); ++it)
+ {
+ spawner = spawnerSet->loadFile(m_currentDir + "/" + (*it));
+
+ if(spawner) {
+ stencil = spawner->newStencil();
+
+ if(stencil) {
+ (void) new QIconViewItem(m_stencilIView, spawner->info()->title(), Kivio::generatePixmapFromStencil(32, 32, stencil));
+ delete stencil;
+ count++;
+ }
+ }
+
+ if(count == 10) { // Limit to max 10 stencils
+ break;
+ }
+ }
+
+ m_descriptionBrowser->setText(KivioStencilSpawnerSet::readDescription(m_currentDir));
+
+ delete spawnerSet;
+ }
+
+ void AddStencilSetPanel::addToDocument()
+ {
+ if(m_currentDir.isEmpty()) {
+ return;
+ }
+
+ emit addStencilSet(m_currentDir);
+ }
+}
+
+#include "kivioaddstencilsetpanel.moc"
diff --git a/kivio/kiviopart/ui/kivioaddstencilsetpanel.h b/kivio/kiviopart/ui/kivioaddstencilsetpanel.h
new file mode 100644
index 00000000..c4e1cf10
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioaddstencilsetpanel.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Peter Simonsson <psn@linux.se>,
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef KIVIOKIVIOADDSTENCILSETPANEL_H
+#define KIVIOKIVIOADDSTENCILSETPANEL_H
+
+#include "kiviostencilsetwidget.h"
+
+#include <qpixmap.h>
+
+class QListViewItem;
+
+namespace Kivio {
+ class AddStencilSetPanel : public KivioStencilSetWidget
+ {
+ Q_OBJECT
+ public:
+ AddStencilSetPanel(QWidget *parent = 0, const char *name = 0);
+ ~AddStencilSetPanel();
+
+ public slots:
+ void updateList();
+
+ signals:
+ void addStencilSet(const QString&);
+
+ protected slots:
+ void changeStencilSet(QListViewItem* li);
+ void addToDocument();
+
+ protected:
+ void loadCollections(const QString& dir);
+ void loadStencilSet(QListViewItem* li, const QString& dir);
+ QPixmap loadIcon(const QString& name, const QString& dir);
+
+ private:
+ QString m_currentDir;
+ };
+}
+
+#endif
diff --git a/kivio/kiviopart/ui/kivioaligndialog.cpp b/kivio/kiviopart/ui/kivioaligndialog.cpp
new file mode 100644
index 00000000..f7224074
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioaligndialog.cpp
@@ -0,0 +1,93 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kivioaligndialog.h"
+#include "kivioaligndialog.moc"
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+
+#include <klocale.h>
+
+#include "kivio_page.h"
+#include "aligndialog.h"
+
+KivioAlignDialog::KivioAlignDialog(QWidget* parent, const char* name)
+ : KDialogBase(parent, name, true, i18n("Align & Distribute"), Ok|Cancel, Ok)
+{
+ m_view = new KivioAlignDialogWidget(this);
+ setMainWidget(m_view);
+}
+
+AlignData KivioAlignDialog::align()
+{
+ AlignData ad;
+
+ ad.centerOfPage = m_view->aCenterPage->isChecked();
+ ad.v = AlignData::None;
+
+ if (m_view->avtop->isChecked())
+ ad.v = AlignData::Top;
+ if (m_view->avcenter->isChecked())
+ ad.v = AlignData::Center;
+ if (m_view->avbottom->isChecked())
+ ad.v = AlignData::Bottom;
+
+ ad.h = AlignData::None;
+ if (m_view->ahleft->isChecked())
+ ad.h = AlignData::Left;
+ if (m_view->ahcenter->isChecked())
+ ad.h = AlignData::Center;
+ if (m_view->ahright->isChecked())
+ ad.h = AlignData::Right;
+
+ return ad;
+}
+
+DistributeData KivioAlignDialog::distribute()
+{
+ DistributeData dd;
+
+ if (m_view->dselection->isChecked())
+ dd.extent = DistributeData::Selection;
+ if (m_view->dpage->isChecked())
+ dd.extent = DistributeData::Page;
+
+ dd.v = DistributeData::None;
+ if (m_view->dvtop->isChecked())
+ dd.v = DistributeData::Top;
+ if (m_view->dvcenter->isChecked())
+ dd.v = DistributeData::Center;
+ if (m_view->dvbottom->isChecked())
+ dd.v = DistributeData::Bottom;
+ if (m_view->dvspacing->isChecked())
+ dd.v = DistributeData::Spacing;
+
+ dd.h = DistributeData::None;
+ if (m_view->dhleft->isChecked())
+ dd.h = DistributeData::Left;
+ if (m_view->dhcenter->isChecked())
+ dd.h = DistributeData::Center;
+ if (m_view->dhright->isChecked())
+ dd.h = DistributeData::Right;
+ if (m_view->dhspacing->isChecked())
+ dd.h = DistributeData::Spacing;
+
+ return dd;
+}
diff --git a/kivio/kiviopart/ui/kivioaligndialog.h b/kivio/kiviopart/ui/kivioaligndialog.h
new file mode 100644
index 00000000..f15a017e
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioaligndialog.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIVIOALIGNDIALOG_H
+#define KIVIOALIGNDIALOG_H
+
+#include <kdialogbase.h>
+
+class KivioAlignDialogWidget;
+struct AlignData;
+struct DistributeData;
+
+class KivioAlignDialog : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ KivioAlignDialog(QWidget* parent = 0, const char* name = 0);
+
+ AlignData align();
+
+ DistributeData distribute();
+
+ protected:
+ KivioAlignDialogWidget* m_view;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kivioarrowheadformatdlg.cpp b/kivio/kiviopart/ui/kivioarrowheadformatdlg.cpp
new file mode 100644
index 00000000..04429587
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioarrowheadformatdlg.cpp
@@ -0,0 +1,210 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kivioarrowheadformatdlg.h"
+
+#include <qlabel.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qbitmap.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qframe.h>
+
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kiconloader.h>
+
+#include <KoUnitWidgets.h>
+
+#include "kivio_view.h"
+#include "kivioglobal.h"
+
+KivioArrowHeadFormatDlg::KivioArrowHeadFormatDlg(KivioView* parent, const char* name)
+ : KDialogBase(parent, name, true, i18n("Arrowhead Format"), Ok|Cancel|Default, Ok)
+{
+ m_unit = KoUnit::U_PT;
+ init();
+}
+
+void KivioArrowHeadFormatDlg::init()
+{
+ QWidget* mainWidget = new QWidget(this);
+ setMainWidget(mainWidget);
+ QGridLayout* gl = new QGridLayout(mainWidget, 2, 1, 0, KDialog::spacingHint());
+
+ QLabel* startAHHeaderIcon = new QLabel(mainWidget);
+ startAHHeaderIcon->setPixmap(SmallIcon("start_arrowhead", 16));
+ startAHHeaderIcon->setFixedSize(16, 16);
+ QLabel* startAHHeaderLabel = new QLabel(i18n("<b>Arrowhead at Origin</b>"), mainWidget);
+ QFont font = startAHHeaderLabel->font();
+ QFrame* startAHHeaderLine = new QFrame(mainWidget);
+ startAHHeaderLine->setFrameStyle(QFrame::HLine|QFrame::Plain);
+ QLabel* startAHTypeLbl = new QLabel(i18n("&Type:"), mainWidget);
+ m_startAHTypeCBox = new KComboBox(mainWidget);
+ loadArrowHeads(m_startAHTypeCBox);
+ startAHTypeLbl->setBuddy(m_startAHTypeCBox);
+ QLabel* startAHWidthLbl = new QLabel(i18n("&Width:"), mainWidget);
+ m_startAHWidthUSBox = new KoUnitDoubleSpinBox(mainWidget, 0.0, 1000.0, 0.1, 1.0, m_unit, 2);
+ startAHWidthLbl->setBuddy(m_startAHWidthUSBox);
+ QLabel* startAHHeightLbl = new QLabel(i18n("&Length:"), mainWidget);
+ m_startAHHeightUSBox = new KoUnitDoubleSpinBox(mainWidget, 0.0, 1000.0, 0.1, 1.0, m_unit, 2);
+ startAHHeightLbl->setBuddy(m_startAHHeightUSBox);
+
+ QLabel* endAHHeaderIcon = new QLabel(mainWidget);
+ endAHHeaderIcon->setPixmap(SmallIcon("end_arrowhead", 16));
+ endAHHeaderIcon->setFixedSize(16, 16);
+ QLabel* endAHHeaderLabel = new QLabel(i18n("<b>Arrowhead at End</b>"), mainWidget);
+ QFrame* endAHHeaderLine = new QFrame(mainWidget);
+ endAHHeaderLine->setFrameStyle(QFrame::HLine|QFrame::Plain);
+ QLabel* endAHTypeLbl = new QLabel(i18n("T&ype:"), mainWidget);
+ m_endAHTypeCBox = new KComboBox(mainWidget);
+ loadArrowHeads(m_endAHTypeCBox);
+ endAHTypeLbl->setBuddy(m_endAHTypeCBox);
+ QLabel* endAHWidthLbl = new QLabel(i18n("W&idth:"), mainWidget);
+ m_endAHWidthUSBox = new KoUnitDoubleSpinBox(mainWidget, 0.0, 1000.0, 0.1, 1.0, m_unit, 2);
+ endAHWidthLbl->setBuddy(m_endAHWidthUSBox);
+ QLabel* endAHHeightLbl = new QLabel(i18n("L&ength:"), mainWidget);
+ m_endAHHeightUSBox = new KoUnitDoubleSpinBox(mainWidget, 0.0, 1000.0, 0.1, 1.0, m_unit, 2);
+ endAHHeightLbl->setBuddy(m_endAHHeightUSBox);
+
+ gl->addWidget(startAHHeaderIcon, 0, 0);
+ gl->addMultiCellWidget(startAHHeaderLabel, 0, 0, 1, 2);
+ gl->addMultiCellWidget(startAHHeaderLine, 1, 1, 0, 2);
+ gl->addMultiCellWidget(startAHTypeLbl, 2, 2, 0, 1);
+ gl->addWidget(m_startAHTypeCBox, 2, 2);
+ gl->addMultiCellWidget(startAHWidthLbl, 3, 3, 0, 1);
+ gl->addWidget(m_startAHWidthUSBox, 3, 2);
+ gl->addMultiCellWidget(startAHHeightLbl, 4, 4, 0, 1);
+ gl->addWidget(m_startAHHeightUSBox, 4, 2);
+
+ gl->addMultiCell(new QSpacerItem(KDialog::marginHint(), KDialog::marginHint(),
+ QSizePolicy::Minimum, QSizePolicy::Fixed), 5, 5, 0, 2);
+
+ gl->addWidget(endAHHeaderIcon, 6, 0);
+ gl->addMultiCellWidget(endAHHeaderLabel, 6, 6, 1, 2);
+ gl->addMultiCellWidget(endAHHeaderLine, 7, 7, 0, 2);
+ gl->addMultiCellWidget(endAHTypeLbl, 8, 8, 0, 1);
+ gl->addWidget(m_endAHTypeCBox, 8, 2);
+ gl->addMultiCellWidget(endAHWidthLbl, 9, 9, 0, 1);
+ gl->addWidget(m_endAHWidthUSBox, 9, 2);
+ gl->addMultiCellWidget(endAHHeightLbl, 10, 10, 0, 1);
+ gl->addWidget(m_endAHHeightUSBox, 10, 2);
+ gl->setRowStretch(11, 10);
+}
+
+void KivioArrowHeadFormatDlg::loadArrowHeads(KComboBox* combo)
+{
+ QBitmap mask;
+ QPixmap pixAll = Kivio::arrowHeadPixmap();
+ QPixmap pix(pixAll.width(), 17);
+ QPainter p(&pix, combo);
+ int cindex = 0;
+
+ // insert item "None"
+ combo->insertItem(i18n("no line end", "None"),cindex++);
+
+ for (int y = 0; y < pixAll.height(); y += 17 ) {
+ p.drawPixmap(0, 0, pixAll, 0, y, pix.width(), pix.height());
+ combo->insertItem(pix,cindex++);
+ }
+
+ p.end();
+}
+
+int KivioArrowHeadFormatDlg::startAHType()
+{
+ return m_startAHTypeCBox->currentItem();
+}
+
+double KivioArrowHeadFormatDlg::startAHWidth()
+{
+ return m_startAHWidthUSBox->value();
+}
+
+double KivioArrowHeadFormatDlg::startAHHeight()
+{
+ return m_startAHHeightUSBox->value();
+}
+
+int KivioArrowHeadFormatDlg::endAHType()
+{
+ return m_endAHTypeCBox->currentItem();
+}
+
+double KivioArrowHeadFormatDlg::endAHWidth()
+{
+ return m_endAHWidthUSBox->value();
+}
+
+double KivioArrowHeadFormatDlg::endAHHeight()
+{
+ return m_endAHHeightUSBox->value();
+}
+
+void KivioArrowHeadFormatDlg::setUnit(KoUnit::Unit u)
+{
+ m_unit = u;
+ m_startAHWidthUSBox->setUnit(u);
+ m_startAHHeightUSBox->setUnit(u);
+ m_endAHWidthUSBox->setUnit(u);
+ m_endAHHeightUSBox->setUnit(u);
+}
+
+void KivioArrowHeadFormatDlg::setStartAHType(int t)
+{
+ m_startAHTypeCBox->setCurrentItem(t);
+}
+
+void KivioArrowHeadFormatDlg::setStartAHWidth(double w)
+{
+ m_startAHWidthUSBox->setValue(KoUnit::toUserValue(w, m_unit));
+}
+
+void KivioArrowHeadFormatDlg::setStartAHHeight(double h)
+{
+ m_startAHHeightUSBox->setValue(KoUnit::toUserValue(h, m_unit));
+}
+
+void KivioArrowHeadFormatDlg::setEndAHType(int t)
+{
+ m_endAHTypeCBox->setCurrentItem(t);
+}
+
+void KivioArrowHeadFormatDlg::setEndAHWidth(double w)
+{
+ m_endAHWidthUSBox->setValue(KoUnit::toUserValue(w, m_unit));
+}
+
+void KivioArrowHeadFormatDlg::setEndAHHeight(double h)
+{
+ m_endAHHeightUSBox->setValue(KoUnit::toUserValue(h, m_unit));
+}
+
+void KivioArrowHeadFormatDlg::slotDefault()
+{
+ setStartAHType(0);
+ setEndAHType(0);
+ setStartAHWidth(10.0);
+ setStartAHHeight(10.0);
+ setEndAHWidth(10.0);
+ setEndAHHeight(10.0);
+}
+
+#include "kivioarrowheadformatdlg.moc"
diff --git a/kivio/kiviopart/ui/kivioarrowheadformatdlg.h b/kivio/kiviopart/ui/kivioarrowheadformatdlg.h
new file mode 100644
index 00000000..6105b14c
--- /dev/null
+++ b/kivio/kiviopart/ui/kivioarrowheadformatdlg.h
@@ -0,0 +1,70 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIVIOARROWHEADFORMATDLG_H
+#define KIVIOARROWHEADFORMATDLG_H
+
+#include <kdialogbase.h>
+
+#include <KoUnit.h>
+
+class KoUnitDoubleSpinBox;
+class KComboBox;
+class KivioView;
+
+class KivioArrowHeadFormatDlg : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ KivioArrowHeadFormatDlg(KivioView* parent, const char* name = 0);
+
+ int startAHType();
+ double startAHWidth();
+ double startAHHeight();
+ int endAHType();
+ double endAHWidth();
+ double endAHHeight();
+
+ public slots:
+ void setUnit(KoUnit::Unit u);
+ void setStartAHType(int t);
+ void setStartAHWidth(double w);
+ void setStartAHHeight(double h);
+ void setEndAHType(int t);
+ void setEndAHWidth(double w);
+ void setEndAHHeight(double h);
+
+ protected slots:
+ void slotDefault();
+
+ protected:
+ void init();
+ void loadArrowHeads(KComboBox* combo);
+
+ protected:
+ KoUnitDoubleSpinBox* m_startAHWidthUSBox;
+ KoUnitDoubleSpinBox* m_startAHHeightUSBox;
+ KoUnitDoubleSpinBox* m_endAHWidthUSBox;
+ KoUnitDoubleSpinBox* m_endAHHeightUSBox;
+ KComboBox* m_startAHTypeCBox;
+ KComboBox* m_endAHTypeCBox;
+ KoUnit::Unit m_unit;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kiviooptionsdialog.cpp b/kivio/kiviopart/ui/kiviooptionsdialog.cpp
new file mode 100644
index 00000000..d19dce6d
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviooptionsdialog.cpp
@@ -0,0 +1,338 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kiviooptionsdialog.h"
+#include "kivio_view.h"
+#include "kivio_doc.h"
+#include "kivio_page.h"
+#include "kivioglobal.h"
+#include "kivio_grid_data.h"
+#include "kivio_canvas.h"
+#include "kivio_settings.h"
+#include "kivio_config.h"
+
+#include <klocale.h>
+#include <KoApplication.h>
+#include <kiconloader.h>
+#include <kpushbutton.h>
+#include <KoPageLayoutDia.h>
+#include <kurlrequester.h>
+#include <kcolorbutton.h>
+#include <KoUnitWidgets.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <kfontdialog.h>
+
+#include <qlabel.h>
+#include <qbuttongroup.h>
+#include <qgroupbox.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qtabwidget.h>
+
+// GuidesListViewItem::GuidesListViewItem(QListView* parent, KivioGuideLineData *gd, KoUnit::Unit u)
+// : KListViewItem(parent), m_data(gd)
+// {
+// setPixmap(0, BarIcon(m_data->orientation() == Qt::Vertical ?
+// "guides_vertical":"guides_horizontal"));
+// QString s = KGlobal::_locale->formatNumber(KoUnit::toUserValue(m_data->position(), u), 2);
+// s += " " + KoUnit::unitName(u);
+// setText(1, s);
+// }
+//
+// GuidesListViewItem::~GuidesListViewItem()
+// {
+// delete m_data;
+// }
+//
+// void GuidesListViewItem::setUnit(KoUnit::Unit u)
+// {
+// QString s = KGlobal::_locale->formatNumber(KoUnit::toUserValue(m_data->position(), u), 2);
+// s += " " + KoUnit::unitName(u);
+// setText(1, s);
+// }
+//
+// void GuidesListViewItem::setPosition(double p, KoUnit::Unit u)
+// {
+// m_data->setPosition(KoUnit::fromUserValue(p, u));
+// QString s = KGlobal::_locale->formatNumber(p, 2);
+// s += " " + KoUnit::unitName(u);
+// setText(1, s);
+// }
+//
+// void GuidesListViewItem::setOrientation(Qt::Orientation o)
+// {
+// m_data->setOrientation(o);
+// setPixmap(0, BarIcon(m_data->orientation() == Qt::Vertical ?
+// "guides_vertical":"guides_horizontal"));
+// }
+
+/*****************************************************************************/
+
+KivioOptionsDialog::KivioOptionsDialog(KivioView* parent, const char* name)
+ : KDialogBase(IconList, i18n("Settings"), Ok|Cancel|Apply|Default, Ok, parent, name)
+{
+ initPage();
+ initGrid();
+ unitChanged(parent->doc()->unit());
+}
+
+void KivioOptionsDialog::initPage()
+{
+ QFrame* page = addPage(i18n("Page"), i18n("Page Settings"),
+ kapp->iconLoader()->loadIcon("empty", KIcon::Toolbar, 32));
+ m_pageIndex = pageIndex(page);
+
+ KivioView* view = static_cast<KivioView*>(parent());
+ KoUnit::Unit unit = KoUnit::unit(Kivio::Config::unit());
+ m_layout = Kivio::Config::defaultPageLayout();
+ m_font = Kivio::Config::font();
+
+ QLabel* unitLbl = new QLabel(i18n("Default &units:"), page);
+ m_unitCombo = new QComboBox(page);
+ m_unitCombo->insertStringList(KoUnit::listOfUnitName());
+ m_unitCombo->setCurrentItem(unit);
+ unitLbl->setBuddy(m_unitCombo);
+ QLabel* layoutLbl = new QLabel(i18n("Default layout:"), page);
+ m_layoutTxtLbl = new QLabel(page);
+ m_layoutTxtLbl->setFrameStyle(QFrame::LineEditPanel | QFrame::Sunken);
+ m_layoutTxtLbl->setSizePolicy(QSizePolicy(
+ QSizePolicy::Minimum, QSizePolicy::Fixed));
+ setLayoutText(m_layout);
+ KPushButton* layoutBtn = new KPushButton(i18n("Change..."), page);
+ layoutBtn->setSizePolicy(QSizePolicy(
+ QSizePolicy::Fixed, QSizePolicy::Fixed));
+ QLabel* fontLbl = new QLabel(i18n("Default font:"), page);
+ m_fontTxtLbl = new QLabel(page);
+ m_fontTxtLbl->setFrameStyle(QFrame::LineEditPanel | QFrame::Sunken);
+ m_fontTxtLbl->setSizePolicy(QSizePolicy(
+ QSizePolicy::Minimum, QSizePolicy::Fixed));
+ setFontText(m_font);
+ KPushButton* fontBtn = new KPushButton(i18n("Change..."), page);
+ layoutBtn->setSizePolicy(QSizePolicy(
+ QSizePolicy::Fixed, QSizePolicy::Fixed));
+ m_marginsChBox = new QCheckBox(i18n("Show page &margins"), page);
+ m_marginsChBox->setChecked(view->isShowPageMargins());
+ m_rulersChBox = new QCheckBox(i18n("Show page &rulers"), page);
+ m_rulersChBox->setChecked(view->isShowRulers());
+
+ QGridLayout* gl = new QGridLayout(page);
+ gl->setSpacing(KDialog::spacingHint());
+ gl->addWidget(unitLbl, 0, 0);
+ gl->addMultiCellWidget(m_unitCombo, 0, 0, 1, 2);
+ gl->addWidget(layoutLbl, 1, 0);
+ gl->addWidget(m_layoutTxtLbl, 1, 1);
+ gl->addWidget(layoutBtn, 1, 2);
+ gl->addWidget(fontLbl, 2, 0);
+ gl->addWidget(m_fontTxtLbl, 2, 1);
+ gl->addWidget(fontBtn, 2, 2);
+ gl->addMultiCellWidget(m_marginsChBox, 3, 3, 0, 2);
+ gl->addMultiCellWidget(m_rulersChBox, 4, 4, 0, 2);
+ gl->addMultiCell(new QSpacerItem(0, 0), 5, 5, 0, 2);
+
+ connect(layoutBtn, SIGNAL(clicked()), SLOT(pageLayoutDlg()));
+ connect(fontBtn, SIGNAL(clicked()), SLOT(fontDlg()));
+ connect(m_unitCombo, SIGNAL(activated(int)), SLOT(unitChanged(int)));
+}
+
+void KivioOptionsDialog::initGrid()
+{
+ QFrame* page = addPage(i18n("Grid"), i18n("Grid Settings"), BarIcon( "grid", KIcon::SizeMedium ));
+ m_gridIndex = pageIndex(page);
+
+ KoUnit::Unit unit = static_cast<KivioView*>(parent())->doc()->unit();
+ KivioGridData d = static_cast<KivioView*>(parent())->doc()->grid();
+ double pgw = m_layout.ptWidth;
+ double pgh = m_layout.ptHeight;
+ double fw = Kivio::Config::gridXSpacing();
+ double fh = Kivio::Config::gridYSpacing();
+ double sw = Kivio::Config::gridXSnap();
+ double sh = Kivio::Config::gridYSnap();
+
+ m_gridChBox = new QCheckBox(i18n("Show &grid"), page);
+ m_gridChBox->setChecked(Kivio::Config::showGrid());
+ m_snapChBox = new QCheckBox(i18n("Snap to g&rid"), page);
+ m_snapChBox->setChecked(Kivio::Config::snapGrid());
+ QLabel* gridColorLbl = new QLabel(i18n("Grid &color:"), page);
+ m_gridColorBtn = new KColorButton(Kivio::Config::gridColor(), page);
+ gridColorLbl->setBuddy(m_gridColorBtn);
+ QGroupBox* spacingGrp = new QGroupBox(2, Qt::Horizontal, i18n("Spacing"), page);
+ QLabel* spaceHorizLbl = new QLabel(i18n("&Horizontal:"), spacingGrp);
+ m_spaceHorizUSpin = new KoUnitDoubleSpinBox(spacingGrp, 0.0, pgw, 0.1,
+ fw, unit);
+ spaceHorizLbl->setBuddy(m_spaceHorizUSpin);
+ QLabel* spaceVertLbl = new QLabel(i18n("&Vertical:"), spacingGrp);
+ m_spaceVertUSpin = new KoUnitDoubleSpinBox(spacingGrp, 0.0, pgh, 0.1,
+ fh, unit);
+ spaceVertLbl->setBuddy(m_spaceVertUSpin);
+ QGroupBox* snapGrp = new QGroupBox(2, Qt::Horizontal, i18n("Snap Distance"), page);
+ QLabel* snapHorizLbl = new QLabel(i18n("H&orizontal:"), snapGrp);
+ m_snapHorizUSpin = new KoUnitDoubleSpinBox(snapGrp, 0.0, fw, 0.1,
+ sw, unit);
+ snapHorizLbl->setBuddy(m_snapHorizUSpin);
+ QLabel* snapVertLbl = new QLabel(i18n("V&ertical:"), snapGrp);
+ m_snapVertUSpin = new KoUnitDoubleSpinBox(snapGrp, 0.0, fh, 0.1,
+ sh, unit);
+ snapVertLbl->setBuddy(m_snapVertUSpin);
+
+ QGridLayout* gl = new QGridLayout(page);
+ gl->setSpacing(KDialog::spacingHint());
+ gl->addMultiCellWidget(m_gridChBox, 0, 0, 0, 2);
+ gl->addMultiCellWidget(m_snapChBox, 1, 1, 0, 2);
+ gl->addWidget(gridColorLbl, 2, 0);
+ gl->addWidget(m_gridColorBtn, 2, 1);
+ gl->addItem(new QSpacerItem(0, 0), 2, 2);
+ gl->addMultiCellWidget(spacingGrp, 3, 3, 0, 2);
+ gl->addMultiCellWidget(snapGrp, 4, 4, 0, 2);
+ gl->addMultiCell(new QSpacerItem(0, 0), 5, 5, 0, 2);
+
+ connect(m_spaceHorizUSpin, SIGNAL(valueChanged(double)), SLOT(setMaxHorizSnap(double)));
+ connect(m_spaceVertUSpin, SIGNAL(valueChanged(double)), SLOT(setMaxVertSnap(double)));
+}
+
+void KivioOptionsDialog::applyPage()
+{
+ KivioView* view = static_cast<KivioView*>(parent());
+ view->doc()->setUnit(static_cast<KoUnit::Unit>(m_unitCombo->currentItem()));
+ Kivio::Config::setUnit(KoUnit::unitName(view->doc()->unit()));
+ Kivio::Config::setDefaultPageLayout(m_layout);
+ Kivio::Config::setFont(m_font);
+ view->doc()->setDefaultFont(m_font);
+ view->togglePageMargins(m_marginsChBox->isChecked());
+ view->toggleShowRulers(m_rulersChBox->isChecked());
+}
+
+void KivioOptionsDialog::applyGrid()
+{
+ KivioGridData d;
+ Kivio::Config::setGridXSpacing(m_spaceHorizUSpin->value());
+ Kivio::Config::setGridYSpacing(m_spaceVertUSpin->value());
+ Kivio::Config::setGridXSnap(m_snapHorizUSpin->value());
+ Kivio::Config::setGridYSnap(m_snapVertUSpin->value());
+ Kivio::Config::setShowGrid(m_gridChBox->isChecked());
+ Kivio::Config::setSnapGrid(m_snapChBox->isChecked());
+ Kivio::Config::setGridColor(m_gridColorBtn->color());
+ KivioView* view = static_cast<KivioView*>(parent());
+ view->doc()->updateView(0);
+}
+
+void KivioOptionsDialog::defaultPage()
+{
+ m_layout = Kivio::Config::defaultPageLayout();
+ m_font = Kivio::Config::font();
+ m_unitCombo->setCurrentItem(KoUnit::unit(Kivio::Config::unit()));
+ unitChanged(m_unitCombo->currentItem());
+ setLayoutText(m_layout);
+ setFontText(m_font);
+ m_marginsChBox->setChecked(true);
+ m_rulersChBox->setChecked(true);
+}
+
+void KivioOptionsDialog::defaultGrid()
+{
+ m_spaceHorizUSpin->changeValue(Kivio::Config::gridXSpacing());
+ m_spaceVertUSpin->changeValue(Kivio::Config::gridYSpacing());
+ m_snapHorizUSpin->changeValue(Kivio::Config::gridXSnap());
+ m_snapVertUSpin->changeValue(Kivio::Config::gridYSnap());
+ m_gridChBox->setChecked(Kivio::Config::showGrid());
+ m_snapChBox->setChecked(Kivio::Config::snapGrid());
+ m_gridColorBtn->setColor(Kivio::Config::gridColor());
+}
+
+void KivioOptionsDialog::setLayoutText(const KoPageLayout& l)
+{
+ KoUnit::Unit unit = static_cast<KoUnit::Unit>(m_unitCombo->currentItem());
+ QString txt = i18n("Format: %1, Width: %2 %4, Height: %3 %5").arg(
+ KoPageFormat::formatString(l.format)).arg(KoUnit::toUserValue(l.ptWidth, unit))
+ .arg(KoUnit::toUserValue(l.ptHeight, unit)).arg(KoUnit::unitName(unit)).arg(
+ KoUnit::unitName(unit));
+ m_layoutTxtLbl->setText(txt);
+}
+
+void KivioOptionsDialog::pageLayoutDlg()
+{
+ KoHeadFoot headfoot;
+ int tabs = FORMAT_AND_BORDERS | DISABLE_UNIT;
+ KoUnit::Unit unit = static_cast<KoUnit::Unit>(m_unitCombo->currentItem());
+
+ if(KoPageLayoutDia::pageLayout(m_layout, headfoot, tabs, unit))
+ {
+ setLayoutText(m_layout);
+ }
+}
+
+void KivioOptionsDialog::unitChanged(int u)
+{
+ KoUnit::Unit unit = static_cast<KoUnit::Unit>(u);
+ setLayoutText(m_layout);
+ m_snapHorizUSpin->setUnit(unit);
+ m_snapVertUSpin->setUnit(unit);
+ m_spaceHorizUSpin->setUnit(unit);
+ m_spaceVertUSpin->setUnit(unit);
+}
+
+void KivioOptionsDialog::slotOk()
+{
+ slotApply();
+ accept();
+}
+
+void KivioOptionsDialog::slotApply()
+{
+ applyPage();
+ applyGrid();
+ Kivio::Config::self()->writeConfig();
+}
+
+void KivioOptionsDialog::slotDefault()
+{
+ bool defaults = Kivio::Config::self()->useDefaults(true);
+ defaultPage();
+ defaultGrid();
+ Kivio::Config::self()->useDefaults(defaults);
+}
+
+void KivioOptionsDialog::setMaxHorizSnap(double v)
+{
+ KoUnit::Unit unit = static_cast<KoUnit::Unit>(m_unitCombo->currentItem());
+ m_snapHorizUSpin->setMaxValue(KoUnit::fromUserValue(v, unit));
+}
+
+void KivioOptionsDialog::setMaxVertSnap(double v)
+{
+ KoUnit::Unit unit = static_cast<KoUnit::Unit>(m_unitCombo->currentItem());
+ m_snapVertUSpin->setMaxValue(KoUnit::fromUserValue(v, unit));
+}
+
+void KivioOptionsDialog::setFontText(const QFont& f)
+{
+ QString txt = f.family() + " " + QString::number(f.pointSize());
+ m_fontTxtLbl->setText(txt);
+}
+
+void KivioOptionsDialog::fontDlg()
+{
+ if(KFontDialog::getFont(m_font, false, this) == QDialog::Accepted) {
+ setFontText(m_font);
+ }
+}
+
+#include "kiviooptionsdialog.moc"
diff --git a/kivio/kiviopart/ui/kiviooptionsdialog.h b/kivio/kiviopart/ui/kiviooptionsdialog.h
new file mode 100644
index 00000000..1fbb209f
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviooptionsdialog.h
@@ -0,0 +1,107 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIVIOOPTIONSDIALOG_H
+#define KIVIOOPTIONSDIALOG_H
+
+#include <kdialogbase.h>
+#include <KoPageLayout.h>
+#include <KoUnit.h>
+#include <klistview.h>
+
+class KivioView;
+class QComboBox;
+class QCheckBox;
+class QLabel;
+class QRadioButton;
+class KColorButton;
+class KURLRequester;
+class KoUnitDoubleSpinBox;
+class KivioGuideLineData;
+class QGroupBox;
+class QFont;
+
+// class GuidesListViewItem : public KListViewItem
+// {
+// public:
+// GuidesListViewItem(QListView* parent, KivioGuideLineData *gd, KoUnit::Unit u);
+// ~GuidesListViewItem();
+//
+// void setUnit(KoUnit::Unit u);
+// void setPosition(double p, KoUnit::Unit u);
+// void setOrientation(Qt::Orientation o);
+// KivioGuideLineData* guideData() { return m_data; }
+//
+// private:
+// KivioGuideLineData* m_data;
+// };
+
+/***********************************************************************/
+
+class KivioOptionsDialog : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ KivioOptionsDialog(KivioView* parent, const char* name = 0);
+
+ protected:
+ void initPage();
+ void initGrid();
+
+ void applyPage();
+ void applyGrid();
+
+ void defaultPage();
+ void defaultGrid();
+
+ void setLayoutText(const KoPageLayout& l);
+ void setFontText(const QFont& f);
+
+ protected slots:
+ void pageLayoutDlg();
+ void fontDlg();
+ void unitChanged(int u);
+ void slotOk();
+ void slotApply();
+ void slotDefault();
+ void setMaxHorizSnap(double v);
+ void setMaxVertSnap(double v);
+
+ private:
+ // Page indecies
+ int m_pageIndex;
+ int m_gridIndex;
+
+ QComboBox* m_unitCombo;
+ QCheckBox* m_marginsChBox;
+ QCheckBox* m_rulersChBox;
+ QLabel* m_layoutTxtLbl;
+ KoPageLayout m_layout;
+ QLabel* m_fontTxtLbl;
+ QFont m_font;
+ KoUnitDoubleSpinBox* m_spaceHorizUSpin;
+ KoUnitDoubleSpinBox* m_spaceVertUSpin;
+ KoUnitDoubleSpinBox* m_snapHorizUSpin;
+ KoUnitDoubleSpinBox* m_snapVertUSpin;
+ QCheckBox* m_gridChBox;
+ QCheckBox* m_snapChBox;
+ KColorButton* m_gridColorBtn;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kiviostencilformatdlg.cpp b/kivio/kiviopart/ui/kiviostencilformatdlg.cpp
new file mode 100644
index 00000000..c51e3e00
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviostencilformatdlg.cpp
@@ -0,0 +1,224 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kiviostencilformatdlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qbitmap.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+
+#include <kcolorbutton.h>
+#include <klocale.h>
+
+#include <KoUnitWidgets.h>
+
+#include "kivio_view.h"
+
+KivioStencilFormatDlg::KivioStencilFormatDlg(KivioView* parent, const char* name)
+ : KDialogBase(parent, name, true, i18n("Stencil & Connector Format"), Ok|Cancel|Default, Ok)
+{
+ m_unit = KoUnit::U_PT;
+ init();
+}
+
+void KivioStencilFormatDlg::init()
+{
+ QWidget* mainWidget = new QWidget(this);
+ setMainWidget(mainWidget);
+ QGridLayout* gl = new QGridLayout(mainWidget, 3, 2, KDialog::marginHint(), KDialog::spacingHint());
+
+ QLabel* lineWidthLbl = new QLabel(i18n("Line &width:"), mainWidget);
+ m_lineWidthUSBox = new KoUnitDoubleSpinBox(mainWidget, 0.0, 1000.0, 0.1, 1.0, m_unit, 2);
+ lineWidthLbl->setBuddy(m_lineWidthUSBox);
+ QLabel* lineColorLbl = new QLabel(i18n("Line &color:"), mainWidget);
+ m_lineCBtn = new KColorButton(mainWidget);
+ lineColorLbl->setBuddy(m_lineCBtn);
+ QLabel* patternLbl = new QLabel(i18n("Line &style:"), mainWidget);
+ m_patternCBox = new KComboBox(mainWidget);
+ patternLbl->setBuddy(m_patternCBox);
+ initLinePatterns();
+ QLabel* lineEndStyleLbl = new QLabel(i18n("Line &end style:"), mainWidget);
+ m_lineEndStyleCBox = new KComboBox(mainWidget);
+ lineEndStyleLbl->setBuddy(m_lineEndStyleCBox);
+ initLineEndStyles();
+ QLabel* fillColorLbl = new QLabel(i18n("&Fill color:"), mainWidget);
+ m_fillCBtn = new KColorButton(mainWidget);
+ fillColorLbl->setBuddy(m_fillCBtn);
+ QLabel* fillPatternLbl = new QLabel(i18n("F&ill style:"), mainWidget);
+ m_fillPatternCBox = new KComboBox(mainWidget);
+ fillPatternLbl->setBuddy(m_fillPatternCBox);
+ initFillPatterns();
+
+ gl->addWidget(lineWidthLbl, 0, 0);
+ gl->addWidget(m_lineWidthUSBox, 0, 1);
+ gl->addWidget(lineColorLbl, 1, 0);
+ gl->addWidget(m_lineCBtn, 1, 1);
+ gl->addWidget(patternLbl, 2, 0);
+ gl->addWidget(m_patternCBox, 2, 1);
+ gl->addWidget(lineEndStyleLbl, 3, 0);
+ gl->addWidget(m_lineEndStyleCBox, 3, 1);
+ gl->addWidget(fillColorLbl, 4, 0);
+ gl->addWidget(m_fillCBtn, 4, 1);
+ gl->addWidget(fillPatternLbl, 5, 0);
+ gl->addWidget(m_fillPatternCBox, 5, 1);
+}
+
+void KivioStencilFormatDlg::initLinePatterns()
+{
+ QBitmap mask;
+ QPixmap pix(m_patternCBox->width(), 17);
+ QPainter p(&pix, m_patternCBox);
+ QPen pen;
+ pen.setColor(QColor(0, 0, 0));
+ pen.setWidth(3);
+
+ for (int i = NoPen; i <= DashDotDotLine ; i++ ) {
+ pix.fill(white);
+ pen.setStyle(static_cast<PenStyle>(i));
+ p.setPen(pen);
+ p.drawLine(0, 8, pix.width(), 8);
+
+ mask = pix;
+ pix.setMask(mask);
+ m_patternCBox->insertItem(pix, i);
+ }
+
+ p.end();
+}
+
+void KivioStencilFormatDlg::initFillPatterns()
+{
+ QBitmap mask;
+ QPixmap pix(m_fillPatternCBox->width(), m_fillPatternCBox->fontMetrics().height() + 4);
+ QPainter p(&pix, m_fillPatternCBox);
+ QBrush brush;
+ brush.setColor(QColor(0, 0, 0));
+
+ for (int i = NoBrush; i <= DiagCrossPattern; i++ ) {
+ pix.fill(white);
+ brush.setStyle(static_cast<BrushStyle>(i));
+ p.setBrush(brush);
+ p.fillRect(0, 0, pix.width(), pix.height(), brush);
+
+ m_fillPatternCBox->insertItem(pix, i);
+ }
+
+ p.end();
+}
+
+void KivioStencilFormatDlg::initLineEndStyles()
+{
+ QBitmap mask;
+ QPixmap pix(m_lineEndStyleCBox->width(), 17);
+ QPainter p(&pix, m_lineEndStyleCBox);
+ QPen pen;
+ pen.setColor(QColor(0, 0, 0));
+ pen.setWidth(4);
+ pen.setStyle(SolidLine);
+ pen.setJoinStyle(RoundJoin);
+ p.setBrush(white);
+
+ for (int i = 0; i < 3; i++) {
+ pix.fill(white);
+ pen.setCapStyle(static_cast<PenCapStyle>(i * 0x10));
+ p.setPen(pen);
+ p.drawLine(6, 8, pix.width() - 12, 8);
+
+ mask = pix;
+ pix.setMask(mask);
+ m_lineEndStyleCBox->insertItem(pix, i);
+ }
+
+ p.end();
+}
+
+double KivioStencilFormatDlg::lineWidth()
+{
+ return m_lineWidthUSBox->value();
+}
+
+QColor KivioStencilFormatDlg::lineColor()
+{
+ return m_lineCBtn->color();
+}
+
+int KivioStencilFormatDlg::linePattern()
+{
+ return m_patternCBox->currentItem();
+}
+
+QColor KivioStencilFormatDlg::fillColor()
+{
+ return m_fillCBtn->color();
+}
+
+int KivioStencilFormatDlg::fillPattern()
+{
+ return m_fillPatternCBox->currentItem();
+}
+
+int KivioStencilFormatDlg::lineEndStyle()
+{
+ return m_lineEndStyleCBox->currentItem() * 0x10;
+}
+
+void KivioStencilFormatDlg::setLineWidth(double w, KoUnit::Unit u)
+{
+ m_unit = u;
+ m_lineWidthUSBox->setUnit(u);
+ m_lineWidthUSBox->setValue(KoUnit::toUserValue(w, u));
+}
+
+void KivioStencilFormatDlg::setLineColor(QColor c)
+{
+ m_lineCBtn->setColor(c);
+}
+
+void KivioStencilFormatDlg::setLinePattern(int p)
+{
+ m_patternCBox->setCurrentItem(p);
+}
+
+void KivioStencilFormatDlg::setFillColor(QColor c)
+{
+ m_fillCBtn->setColor(c);
+}
+
+void KivioStencilFormatDlg::setFillPattern(int p)
+{
+ m_fillPatternCBox->setCurrentItem(p);
+}
+
+void KivioStencilFormatDlg::setLineEndStyle(int s)
+{
+ m_lineEndStyleCBox->setCurrentItem(s / 0x10);
+}
+
+void KivioStencilFormatDlg::slotDefault()
+{
+ setLineWidth(1.0, m_unit);
+ setLineColor(QColor(0, 0, 0));
+ setLinePattern(1);
+ setFillColor(QColor(255, 255, 255));
+ setFillPattern(1);
+}
+
+#include "kiviostencilformatdlg.moc"
diff --git a/kivio/kiviopart/ui/kiviostencilformatdlg.h b/kivio/kiviopart/ui/kiviostencilformatdlg.h
new file mode 100644
index 00000000..940bdf09
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviostencilformatdlg.h
@@ -0,0 +1,73 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIVIOSTENCILFORMATDLG_H
+#define KIVIOSTENCILFORMATDLG_H
+
+#include <kdialogbase.h>
+
+#include <KoUnit.h>
+
+class KoUnitDoubleSpinBox;
+class KColorButton;
+class KComboBox;
+class KivioView;
+class QColor;
+
+class KivioStencilFormatDlg : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ KivioStencilFormatDlg(KivioView* parent, const char* name = 0);
+
+ double lineWidth();
+ QColor lineColor();
+ int linePattern();
+ QColor fillColor();
+ int fillPattern();
+ int lineEndStyle();
+
+ public slots:
+ void setLineWidth(double w, KoUnit::Unit u);
+ void setLineColor(QColor c);
+ void setLinePattern(int p);
+ void setFillColor(QColor c);
+ void setFillPattern(int p);
+ void setLineEndStyle(int s);
+
+ protected slots:
+ void slotDefault();
+
+ protected:
+ void init();
+ void initLinePatterns();
+ void initFillPatterns();
+ void initLineEndStyles();
+
+ protected:
+ KoUnitDoubleSpinBox* m_lineWidthUSBox;
+ KColorButton* m_lineCBtn;
+ KColorButton* m_fillCBtn;
+ KComboBox* m_patternCBox;
+ KComboBox* m_fillPatternCBox;
+ KComboBox* m_lineEndStyleCBox;
+ KoUnit::Unit m_unit;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/kiviostencilsetwidget.ui b/kivio/kiviopart/ui/kiviostencilsetwidget.ui
new file mode 100644
index 00000000..fb7a79b3
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviostencilsetwidget.ui
@@ -0,0 +1,165 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KivioStencilSetWidget</class>
+<comment>This program 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 2
+of the License, or (at your option) any later version.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+</comment>
+<author>(C) 2004-2005 Peter Simonsson</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KivioStencilSetWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Stencil Set</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QSplitter" row="0" column="0">
+ <property name="name">
+ <cstring>splitter1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Stencil Set</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_stencilSetLView</cstring>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ <property name="dropVisualizer">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>m_stencilsetGBox</cstring>
+ </property>
+ <property name="title">
+ <string>No Selection</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter" row="0" column="0">
+ <property name="name">
+ <cstring>m_stencilSetSplitter</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="QIconView">
+ <property name="name">
+ <cstring>m_stencilIView</cstring>
+ </property>
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ <property name="hScrollBarMode">
+ <enum>AlwaysOff</enum>
+ </property>
+ <property name="selectionMode">
+ <enum>NoSelection</enum>
+ </property>
+ <property name="gridX">
+ <number>64</number>
+ </property>
+ <property name="gridY">
+ <number>64</number>
+ </property>
+ <property name="resizeMode">
+ <enum>Adjust</enum>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This is a preview of the stencils contained in the set</string>
+ </property>
+ </widget>
+ <widget class="QTextBrowser">
+ <property name="name">
+ <cstring>m_descriptionBrowser</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>m_addToDocBtn</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Add to Document</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/kivio/kiviopart/ui/kiviotextformatdlg.cpp b/kivio/kiviopart/ui/kiviotextformatdlg.cpp
new file mode 100644
index 00000000..7d02f643
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviotextformatdlg.cpp
@@ -0,0 +1,192 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kiviotextformatdlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+
+#include <kfontdialog.h>
+#include <kcolorbutton.h>
+#include <klocale.h>
+
+#include "kivio_view.h"
+#include "kivio_doc.h"
+
+KivioTextFormatDlg::KivioTextFormatDlg(KivioView* parent, const char* name)
+ : KDialogBase(Tabbed, i18n("Text Format"), Ok|Cancel|Default, Ok, parent, name)
+{
+ m_valign = Qt::AlignVCenter;
+ m_halign = Qt::AlignHCenter;
+ initFontTab();
+ initPositionTab();
+}
+
+void KivioTextFormatDlg::initFontTab()
+{
+ QFrame* tab = addPage(i18n("Font"));
+ m_fontChooser = new KFontChooser(tab);
+ QLabel* textColorLbl = new QLabel(i18n("Text color:"), tab);
+ m_textCBtn = new KColorButton(tab);
+ QGridLayout* gl = new QGridLayout(tab);
+ gl->setSpacing(KDialog::spacingHint());
+ gl->addMultiCellWidget(m_fontChooser, 0, 0, 0, 1);
+ gl->addWidget(textColorLbl, 1, 0);
+ gl->addWidget(m_textCBtn, 1, 1);
+}
+
+void KivioTextFormatDlg::initPositionTab()
+{
+ QFrame* tab = addPage(i18n("Position"));
+ m_valignBGrp = new QButtonGroup(1, Qt::Horizontal, i18n("Vertical"), tab);
+ (void) new QRadioButton(i18n("&Top"), m_valignBGrp);
+ (void) new QRadioButton(i18n("&Center"), m_valignBGrp);
+ (void) new QRadioButton(i18n("&Bottom"), m_valignBGrp);
+ m_valignBGrp->setButton(1);
+ m_halignBGrp = new QButtonGroup(1, Qt::Vertical, i18n("Horizontal"), tab);
+ (void) new QRadioButton(i18n("&Left"), m_halignBGrp);
+ (void) new QRadioButton(i18n("C&enter"), m_halignBGrp);
+ (void) new QRadioButton(i18n("&Right"), m_halignBGrp);
+ m_halignBGrp->setButton(1);
+ m_preview = new QLabel(i18n("Preview"), tab);
+ m_preview->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ m_preview->setAlignment(m_valign | m_halign);
+ QGridLayout* gl = new QGridLayout(tab);
+ gl->setSpacing(KDialog::spacingHint());
+ gl->setRowStretch(0, 10);
+ gl->setColStretch(1, 10);
+ gl->addWidget(m_valignBGrp, 0, 0);
+ gl->addWidget(m_preview, 0, 1);
+ gl->addWidget(m_halignBGrp, 1, 1);
+
+ connect(m_valignBGrp, SIGNAL(clicked(int)), SLOT(updateVAlign(int)));
+ connect(m_halignBGrp, SIGNAL(clicked(int)), SLOT(updateHAlign(int)));
+}
+
+void KivioTextFormatDlg::updateVAlign(int i)
+{
+ switch(i) {
+ case 0:
+ m_valign = Qt::AlignTop;
+ break;
+ case 1:
+ m_valign = Qt::AlignVCenter;
+ break;
+ case 2:
+ m_valign = Qt::AlignBottom;
+ break;
+ }
+
+ m_preview->setAlignment(m_valign | m_halign);
+}
+
+void KivioTextFormatDlg::updateHAlign(int i)
+{
+ switch(i) {
+ case 0:
+ m_halign = Qt::AlignLeft;
+ break;
+ case 1:
+ m_halign = Qt::AlignHCenter;
+ break;
+ case 2:
+ m_halign = Qt::AlignRight;
+ break;
+ }
+
+ m_preview->setAlignment(m_valign | m_halign);
+}
+
+int KivioTextFormatDlg::valign()
+{
+ return m_valign;
+}
+
+int KivioTextFormatDlg::halign()
+{
+ return m_halign;
+}
+
+QFont KivioTextFormatDlg::font()
+{
+ return m_fontChooser->font();
+}
+
+QColor KivioTextFormatDlg::textColor()
+{
+ return m_textCBtn->color();
+}
+
+void KivioTextFormatDlg::setVAlign(int i)
+{
+ switch(i) {
+ case Qt::AlignTop:
+ m_valignBGrp->setButton(0);
+ break;
+ case Qt::AlignVCenter:
+ m_valignBGrp->setButton(1);
+ break;
+ case Qt::AlignBottom:
+ m_valignBGrp->setButton(2);
+ break;
+ }
+
+ m_valign = static_cast<Qt::AlignmentFlags>(i);
+ m_preview->setAlignment(m_valign | m_halign);
+}
+
+void KivioTextFormatDlg::setHAlign(int i)
+{
+ switch(i) {
+ case Qt::AlignLeft:
+ m_halignBGrp->setButton(0);
+ break;
+ case Qt::AlignHCenter:
+ m_halignBGrp->setButton(1);
+ break;
+ case Qt::AlignRight:
+ m_halignBGrp->setButton(2);
+ break;
+ }
+
+ m_halign = static_cast<Qt::AlignmentFlags>(i);
+ m_preview->setAlignment(m_valign | m_halign);
+}
+
+void KivioTextFormatDlg::setFont(QFont f)
+{
+ m_fontChooser->setFont(f);
+}
+
+void KivioTextFormatDlg::setTextColor(QColor c)
+{
+ m_textCBtn->setColor(c);
+}
+
+void KivioTextFormatDlg::slotDefault()
+{
+ setFont((static_cast<KivioView*>(parent()))->doc()->defaultFont());
+ setTextColor(QColor(0, 0, 0));
+ setHAlign(Qt::AlignHCenter);
+ setVAlign(Qt::AlignVCenter);
+}
+
+#include "kiviotextformatdlg.moc"
diff --git a/kivio/kiviopart/ui/kiviotextformatdlg.h b/kivio/kiviopart/ui/kiviotextformatdlg.h
new file mode 100644
index 00000000..58ce2ad4
--- /dev/null
+++ b/kivio/kiviopart/ui/kiviotextformatdlg.h
@@ -0,0 +1,69 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Peter Simonsson <psn@linux.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KIVIOTEXTFORMATDLG_H
+#define KIVIOTEXTFORMATDLG_H
+
+#include <kdialogbase.h>
+
+class KivioView;
+class KFontChooser;
+class KColorButton;
+class QButtonGroup;
+class QLabel;
+class QFont;
+class QColor;
+
+class KivioTextFormatDlg : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ KivioTextFormatDlg(KivioView* parent, const char* name = 0);
+
+ int valign();
+ int halign();
+ QFont font();
+ QColor textColor();
+
+ public slots:
+ void setVAlign(int i);
+ void setHAlign(int i);
+ void setFont(QFont f);
+ void setTextColor(QColor c);
+
+ protected:
+ void initFontTab();
+ void initPositionTab();
+
+ protected slots:
+ void updateVAlign(int i);
+ void updateHAlign(int i);
+ void slotDefault();
+
+ protected:
+ KFontChooser* m_fontChooser;
+ KColorButton* m_textCBtn;
+ QButtonGroup* m_halignBGrp;
+ QButtonGroup* m_valignBGrp;
+ QLabel* m_preview;
+ int m_valign;
+ int m_halign;
+};
+
+#endif
diff --git a/kivio/kiviopart/ui/layerlisttooltip.cpp b/kivio/kiviopart/ui/layerlisttooltip.cpp
new file mode 100644
index 00000000..13ecd770
--- /dev/null
+++ b/kivio/kiviopart/ui/layerlisttooltip.cpp
@@ -0,0 +1,61 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2006 Peter Simonsson <psn@linux.se>
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "layerlisttooltip.h"
+
+#include <qheader.h>
+
+#include <klocale.h>
+
+#include "kivio_layer_panel.h"
+#include "kivio_layer.h"
+
+namespace Kivio {
+
+LayerListToolTip::LayerListToolTip(QWidget* parent, QListView* listView)
+ : QToolTip(parent)
+{
+ m_listView = listView;
+}
+
+LayerListToolTip::~LayerListToolTip()
+{
+}
+
+void LayerListToolTip::maybeTip(const QPoint& pos)
+{
+ if(!m_listView) {
+ return;
+ }
+
+ KivioLayerItem* item = dynamic_cast<KivioLayerItem*>(m_listView->itemAt(pos));
+
+ if(!item) {
+ return;
+ }
+
+ QRect itemRect = m_listView->itemRect(item);
+ QString toolTip = "<b>" + item->layer()->name() + "</b><br>";
+ toolTip += i18n("Visible: ") + (item->layer()->visible() ? i18n("Yes") : i18n("No")) + "<br>";
+ toolTip += i18n("Printable: ") + (item->layer()->printable() ? i18n("Yes") : i18n("No")) + "<br>";
+ toolTip += i18n("Editable: ") + (item->layer()->editable() ? i18n("Yes") : i18n("No")) + "<br>";
+ toolTip += i18n("Connectable: ") + (item->layer()->connectable() ? i18n("Yes") : i18n("No"));
+ tip(itemRect, toolTip);
+}
+
+}
diff --git a/kivio/kiviopart/ui/layerlisttooltip.h b/kivio/kiviopart/ui/layerlisttooltip.h
new file mode 100644
index 00000000..9f8fd41c
--- /dev/null
+++ b/kivio/kiviopart/ui/layerlisttooltip.h
@@ -0,0 +1,44 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2006 Peter Simonsson <psn@linux.se>
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIVIOLAYERLISTTOOLTIP_H
+#define KIVIOLAYERLISTTOOLTIP_H
+
+#include <qtooltip.h>
+#include <qlistview.h>
+
+namespace Kivio {
+
+/**
+ * Shows the tooltips in the layer list
+ */
+class LayerListToolTip : public QToolTip
+{
+ public:
+ LayerListToolTip(QWidget* parent, QListView* listView);
+ ~LayerListToolTip();
+
+ void maybeTip(const QPoint& pos);
+
+ protected:
+ QListView* m_listView;
+};
+
+}
+
+#endif
diff --git a/kivio/kiviopart/ui/objectlistpalette.cpp b/kivio/kiviopart/ui/objectlistpalette.cpp
new file mode 100644
index 00000000..721f84ca
--- /dev/null
+++ b/kivio/kiviopart/ui/objectlistpalette.cpp
@@ -0,0 +1,165 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2005 Peter Simonsson
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "objectlistpalette.h"
+
+#include <qlayout.h>
+#include <qheader.h>
+#include <qptrlist.h>
+
+#include <klistview.h>
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "kivio_view.h"
+#include "kivio_stencil.h"
+#include "kivio_layer.h"
+#include "kivio_stencil_spawner.h"
+#include "kivio_stencil_spawner_info.h"
+#include "kivio_page.h"
+#include "kivioglobal.h"
+#include "kivio_doc.h"
+
+namespace Kivio {
+
+class ObjectListItem : public KListViewItem
+{
+ public:
+ ObjectListItem(KListView* parent, KivioStencil* _stencil)
+ : KListViewItem(parent, "")
+ {
+ m_stencil = _stencil;
+ setPixmap(0, Kivio::generatePixmapFromStencil(22, 22, m_stencil));
+
+ QString type;
+ QString name;
+
+ switch(m_stencil->type()) {
+ case kstGroup:
+ type = i18n("Group");
+ name = type;
+ break;
+ case kstConnector:
+ type = i18n("Connector");
+ name = _stencil->spawner()->info()->title();
+ break;
+ case kstText:
+ type = i18n("Text Area");
+ name = type;
+ break;
+ case kstNormal:
+ default:
+ type = i18n("Stencil");
+ name = _stencil->spawner()->info()->title();
+ break;
+ }
+
+ setText(0, name);
+ setText(1, type);
+ setSelected(m_stencil->isSelected());
+ }
+
+ KivioStencil* stencil() const { return m_stencil; }
+
+ private:
+ KivioStencil* m_stencil;
+};
+
+ObjectListPalette::ObjectListPalette(KivioView* parent, const char* name)
+ : QWidget(parent, name), m_view(parent)
+{
+ m_blockUpdate = false;
+
+ QVBoxLayout* layout = new QVBoxLayout(this, 0, 2);
+
+ m_objectList = new KListView(this);
+ m_objectList->setFullWidth(true);
+ m_objectList->setAllColumnsShowFocus(true);
+ m_objectList->setSorting(-1);
+ m_objectList->setSelectionMode(QListView::Extended);
+ m_objectList->addColumn(i18n("Name"));
+ m_objectList->addColumn(i18n("Type"));
+
+ layout->addWidget(m_objectList);
+
+ connect(m_objectList, SIGNAL(selectionChanged()), this, SLOT(updateSelection()));
+}
+
+ObjectListPalette::~ObjectListPalette()
+{
+}
+
+void ObjectListPalette::updateObjectList()
+{
+ if(m_blockUpdate) {
+ m_blockUpdate = false;
+ return;
+ }
+
+ KivioPage* page = m_view->activePage();
+
+ if(!page)
+ return;
+
+ m_objectList->clear();
+
+ QPtrList<KivioLayer>* layers = page->layers();
+
+ KivioLayer* layer = layers->first();
+ KivioStencil* stencil;
+ m_objectList->blockSignals(true);
+
+ while(layer) {
+ stencil = layer->firstStencil();
+
+ while(stencil) {
+ new ObjectListItem(m_objectList, stencil);
+ stencil = layer->nextStencil();
+ }
+
+ layer = layers->next();
+ }
+
+ m_objectList->blockSignals(false);
+}
+
+void ObjectListPalette::updateSelection()
+{
+ KivioPage* page = m_view->activePage();
+
+ if(!page)
+ return;
+
+ page->unselectAllStencils();
+
+ QPtrList<QListViewItem> selectedItems = m_objectList->selectedItems();
+ QPtrListIterator<QListViewItem> it(selectedItems);
+ ObjectListItem* item = 0;
+
+ while((item = static_cast<ObjectListItem*>(it.current())) != 0) {
+ page->selectStencil(item->stencil());
+ ++it;
+ }
+
+ m_blockUpdate = true;
+ m_view->doc()->updateView(page);
+}
+
+}
+
+#include "objectlistpalette.moc"
diff --git a/kivio/kiviopart/ui/objectlistpalette.h b/kivio/kiviopart/ui/objectlistpalette.h
new file mode 100644
index 00000000..027154c3
--- /dev/null
+++ b/kivio/kiviopart/ui/objectlistpalette.h
@@ -0,0 +1,53 @@
+/*
+ * Kivio - Visual Modelling and Flowcharting
+ * Copyright (C) 2005 Peter Simonsson
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KIVIOOBJECTLISTPALETTE_H
+#define KIVIOOBJECTLISTPALETTE_H
+
+#include <qwidget.h>
+
+class KListView;
+class KivioView;
+
+namespace Kivio {
+
+/**
+ * Palette showing a list of all objects on the page
+ */
+class ObjectListPalette : public QWidget
+{
+ Q_OBJECT
+ public:
+ ObjectListPalette(KivioView* parent = 0, const char* name = 0);
+ ~ObjectListPalette();
+
+ void updateObjectList();
+
+ protected slots:
+ void updateSelection();
+
+ private:
+ KivioView* m_view;
+ KListView* m_objectList;
+
+ bool m_blockUpdate;
+};
+
+}
+
+#endif