00001
00002
00003 #ifndef OBJECTDIALOG_H
00004 #define OBJECTDIALOG_H
00005
00006 #include <qfont.h>
00007 #include <qcheckbox.h>
00008 #include <qlistview.h>
00009 #include "Worksheet.h"
00010 #include "Dialog.h"
00011 #include "RichTextWidget.h"
00012
00013 class ObjectDialog: public Dialog
00014 {
00015 Q_OBJECT
00016 public:
00017 ObjectDialog(MainWin *mw, const char *name, int activetab, int item);
00018 void updateDialog();
00019 public slots:
00020 void setType(int t) { tw->setCurrentPage(t); }
00021 int Type() { return tw->currentPageIndex(); }
00022
00023 void setItem(int i) {
00024 switch(tw->currentPageIndex()) {
00025 case 1: lv1->setSelected(lv1->itemAt(QPoint(0,i*lv1->currentItem()->height())),true); break;
00026 case 2: lv2->setSelected(lv2->itemAt(QPoint(0,i*lv2->currentItem()->height())),true); break;
00027 case 3: lv3->setSelected(lv3->itemAt(QPoint(0,i*lv3->currentItem()->height())),true); break;
00028 case 4: lv4->setSelected(lv4->itemAt(QPoint(0,i*lv4->currentItem()->height())),true); break;
00029 case 5: lv5->setSelected(lv5->itemAt(QPoint(0,i*lv5->currentItem()->height())),true); break;
00030 }
00031 }
00032 int Item() {
00033 switch(tw->currentPageIndex()) {
00034 case 1: return (int) (lv1->itemPos(lv1->currentItem())/lv1->currentItem()->height());
00035 case 2: return (int) (lv2->itemPos(lv2->currentItem())/lv2->currentItem()->height());
00036 case 3: return (int) (lv3->itemPos(lv3->currentItem())/lv3->currentItem()->height());
00037 case 4: return (int) (lv4->itemPos(lv4->currentItem())/lv4->currentItem()->height());
00038 case 5: return (int) (lv5->itemPos(lv5->currentItem())/lv5->currentItem()->height());
00039 }
00040 return 0;
00041 }
00042 void deleteObject();
00043
00044 void setLineStartPoint(double x, double y)
00045 { lx1le->setText(QString::number(x)); ly1le->setText(QString::number(y)); }
00046 Point LineStartPoint() { return Point(lx1le->text().toDouble(), ly1le->text().toDouble() ); }
00047 void setLineEndPoint(double x, double y)
00048 { lx2le->setText(QString::number(x)); ly2le->setText(QString::number(y)); }
00049 Point LineEndPoint() { return Point(lx2le->text().toDouble(), ly2le->text().toDouble() ); }
00050 void setLineWidth(int w) { lwni->setValue(w); }
00051 int LineWidth() { return lwni->value(); }
00052 void setLineColor(QColor c) { lcb->setColor(c); }
00053 QColor LineColor() { return lcb->color(); }
00054 void enableStartArrow(bool e=true) { startcb->setChecked(e); }
00055 bool StartArrowEnabled() { return startcb->isChecked(); }
00056 void setStartArrowLength(double l) { salle->setText(QString::number(l)); }
00057 double StartArrowLength() { return salle->text().toDouble(); }
00058 void setStartArrowAngle(double l) { saale->setText(QString::number(l)); }
00059 double StartArrowAngle() { return saale->text().toDouble(); }
00060 void setStartArrowFilled(bool f=true) { safcb->setChecked(f); }
00061 bool StartArrowFilled() { return safcb->isChecked(); }
00062 void setStartArrowFillColor(QColor c) { safccb->setColor(c); }
00063 QColor StartArrowFillColor() { return safccb->color(); }
00064 void enableEndArrow(bool e=true) { endcb->setChecked(e); }
00065 bool EndArrowEnabled() { return endcb->isChecked(); }
00066 void setEndArrowLength(double l) { ealle->setText(QString::number(l)); }
00067 double EndArrowLength() { return ealle->text().toDouble(); }
00068 void setEndArrowAngle(double l) { eaale->setText(QString::number(l)); }
00069 double EndArrowAngle() { return eaale->text().toDouble(); }
00070 void setEndArrowFilled(bool f=true) { eafcb->setChecked(f); }
00071 bool EndArrowFilled() { return eafcb->isChecked(); }
00072 void setEndArrowFillColor(QColor c) { eafccb->setColor(c); }
00073 QColor EndArrowFillColor() { return eafccb->color(); }
00074
00075 void setLabel(Label *l) { rtw->setLabel(l); }
00076 Label *getLabel() { return rtw->getLabel(); }
00077
00078 void setRectPosition(double x, double y)
00079 { rx1le->setText(QString::number(x)); ry1le->setText(QString::number(y)); }
00080 Point getRectPosition()
00081 { return Point(rx1le->text().toDouble(),ry1le->text().toDouble()); }
00082 void setRectSize(double x, double y)
00083 { rx2le->setText(QString::number(x)); ry2le->setText(QString::number(y)); }
00084 Point getRectSize()
00085 { return Point(rx2le->text().toDouble(),ry2le->text().toDouble()); }
00086 void setRectWidth(int w) { rwni->setValue(w); }
00087 int RectWidth() { return rwni->value(); }
00088 void setRectColor(QColor c) { rcb->setColor(c); }
00089 QColor RectColor() { return rcb->color(); }
00090 void setRectFilled(bool e=true) { rfccb->setChecked(e); }
00091 bool RectFilled() { return rfccb->isChecked(); }
00092 void setRectFillColor(QColor c) { rfcb->setColor(c); }
00093 QColor RectFillColor() { return rfcb->color(); }
00094
00095 void setEllipsePosition(double x, double y)
00096 { ex1le->setText(QString::number(x)); ey1le->setText(QString::number(y)); }
00097 Point getEllipsePosition()
00098 { return Point(ex1le->text().toDouble(),ey1le->text().toDouble()); }
00099 void setEllipseSize(double x, double y)
00100 { ex2le->setText(QString::number(x)); ey2le->setText(QString::number(y)); }
00101 Point getEllipseSize()
00102 { return Point(ex2le->text().toDouble(),ey2le->text().toDouble()); }
00103 void setEllipseWidth(int w) { ewni->setValue(w); }
00104 int EllipseWidth() { return ewni->value(); }
00105 void setEllipseColor(QColor c) { ecb->setColor(c); }
00106 QColor EllipseColor() { return ecb->color(); }
00107 void setEllipseFilled(bool e=true) { efccb->setChecked(e); }
00108 bool EllipseFilled() { return efccb->isChecked(); }
00109 void setEllipseFillColor(QColor c) { efcb->setColor(c); }
00110 QColor EllipseFillColor() { return efcb->color(); }
00111
00112 void setImagePosition(double x, double y)
00113 { ixle->setText(QString::number(x)); iyle->setText(QString::number(y)); }
00114 Point ImagePosition()
00115 { return Point(ixle->text().toDouble(),iyle->text().toDouble()); }
00116 void setImageFile(QString n) { ile->setText(n); }
00117 QString ImageFile() { return ile->text(); }
00118 void setImageScale(double v) { isle->setText(QString::number(v)); }
00119 double ImageScale() { return isle->text().toDouble(); }
00120 void setImageAngle(double a) { iale->setText(QString::number(a)); }
00121 double ImageAngle() { return iale->text().toDouble(); }
00122
00123 int Apply() { return apply_clicked(); }
00124 private:
00125 QTabWidget *tw;
00126 RichTextWidget *rtw;
00127 QListView *lv1, *lv2, *lv3, *lv4, *lv5;
00128 KLineEdit *lx1le, *ly1le, *lx2le, *ly2le;
00129 KLineEdit *rx1le, *ry1le, *rx2le, *ry2le;
00130 KLineEdit *ex1le, *ey1le, *ex2le, *ey2le;
00131 KLineEdit *ixle, *iyle;
00132 KIntNumInput *lwni, *rwni, *ewni;
00133 KLineEdit *ile, *isle, *iale, *salle, *saale, *ealle, *eaale;
00134 KColorButton *lcb, *rcb, *rfcb, *ecb, *efcb, *safccb, *eafccb;
00135 QCheckBox *rfccb, *efccb, *startcb, *endcb, *safcb, *eafcb;
00136 int item;
00137 private slots:
00138 void ok_clicked() { apply_clicked(); accept(); }
00139 void saveSettings();
00140 int apply_clicked();
00141 void selectFile();
00142 void updateLine();
00143 void updateLineListView();
00144 void updateLabel();
00145 void updateLabelListView();
00146 void updateRect();
00147 void updateRectListView();
00148 void updateEllipse();
00149 void updateEllipseListView();
00150 void updateImage();
00151 void updateImageListView();
00152 };
00153
00154 #endif //OBJECTDIALOG_H