X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fpenwidget.cpp;h=9b80932b2e47fc372f1b4870141616eb640c9156;hb=eb39f1bb5e6518c5dc4f4dbd3c88912a97192e95;hp=2a557e39d150f54ab48e080eace9d234d0425aee;hpb=acd27aa62a4c78b6aeee523e3145a8aa53f4bcde;p=architektonas diff --git a/src/penwidget.cpp b/src/penwidget.cpp index 2a557e3..9b80932 100644 --- a/src/penwidget.cpp +++ b/src/penwidget.cpp @@ -12,24 +12,28 @@ // //maybe add a button to have it stamp attributes on all objects clicked on? [added Global::penStamp to facilitate this.] //need to add to drawingview the ability to use attributes on new objects [DONE] -//need to override the selection so you can see the attributes effects immediately when they are changed instead of having to deselect them to see - +//need to override the selection so you can see the attributes effects immediately when they are changed instead of having to deselect them to see [IN PROGRESS] #include "penwidget.h" - -PenWidget::PenWidget(void): QWidget(), r(0), g(0), b(0), programChange(false) +PenWidget::PenWidget(void): QWidget(), width(new QLineEdit("1.0")), red(new QLineEdit("00")), green(new QLineEdit("00")), blue(new QLineEdit("00")), style(new QComboBox), r(0), g(0), b(0), programChange(false), stampAction(new QAction(QIcon(":/res/pen-stamp.png"), tr(""), this)), dropperAction(new QAction(QIcon(":/res/pen-dropper.png"), tr(""), this)), tbStamp(new QToolButton(this)), tbDropper(new QToolButton(this)) { - width = new QLineEdit("1.0"); - red = new QLineEdit("00"); - green = new QLineEdit("00"); - blue = new QLineEdit("00"); - style = new QComboBox; - QLabel * l1 = new QLabel(tr("Width:")); QLabel * l2 = new QLabel(tr("RGB:")); QLabel * l3 = new QLabel(tr("Style:")); + stampAction->setToolTip(tr("Stamp Selected")); + stampAction->setStatusTip(tr("Stamp selected objects with pen attributes.")); + stampAction->setShortcut(QKeySequence(tr("p,p"))); + stampAction->setCheckable(true); + tbStamp->setDefaultAction(stampAction); + + dropperAction->setToolTip(tr("Color Picker")); + dropperAction->setStatusTip(tr("Get pen attributes from objects.")); + dropperAction->setShortcut(QKeySequence(tr("d,d"))); + dropperAction->setCheckable(true); + tbDropper->setDefaultAction(dropperAction); + style->insertItem(1, tr("Solid")); style->insertItem(2, tr("Dash")); style->insertItem(3, tr("Dot")); @@ -55,14 +59,16 @@ PenWidget::PenWidget(void): QWidget(), r(0), g(0), b(0), programChange(false) style->setToolTip(tr("Sets pen style")); QHBoxLayout * hbox1 = new QHBoxLayout; - hbox1->addWidget(l1, 0, Qt::AlignLeft); - hbox1->addWidget(width, 0, Qt::AlignLeft); hbox1->addWidget(l2, 0, Qt::AlignLeft); hbox1->addWidget(red, 0, Qt::AlignLeft); hbox1->addWidget(green, 0, Qt::AlignLeft); hbox1->addWidget(blue, 0, Qt::AlignLeft); + hbox1->addWidget(l1, 0, Qt::AlignLeft); + hbox1->addWidget(width, 0, Qt::AlignLeft); hbox1->addWidget(l3, 0, Qt::AlignLeft); hbox1->addWidget(style, 0, Qt::AlignLeft); + hbox1->addWidget(tbStamp, 0, Qt::AlignLeft); + hbox1->addWidget(tbDropper, 0, Qt::AlignLeft); hbox1->addStretch(1); setLayout(hbox1); @@ -74,12 +80,10 @@ PenWidget::PenWidget(void): QWidget(), r(0), g(0), b(0), programChange(false) connect(style, SIGNAL(currentIndexChanged(int)), this, SLOT(HandleStyleSelected(int))); } - PenWidget::~PenWidget() { } - void PenWidget::SetFields(Object * obj) { // Sanity check @@ -103,7 +107,6 @@ void PenWidget::SetFields(Object * obj) programChange = false; } - void PenWidget::HandleWidthSelected(QString text) { // Parse the text in the control @@ -117,7 +120,6 @@ void PenWidget::HandleWidthSelected(QString text) emit WidthSelected(Global::penWidth); } - void PenWidget::HandleStyleSelected(int selected) { // Change was programmatic, don't do anything @@ -130,7 +132,6 @@ void PenWidget::HandleStyleSelected(int selected) emit StyleSelected(Global::penStyle); } - void PenWidget::HandleRedSelected(QString text) { // Parse the text in the control @@ -145,7 +146,6 @@ void PenWidget::HandleRedSelected(QString text) emit ColorSelected(Global::penColor); } - void PenWidget::HandleGreenSelected(QString text) { // Parse the text in the control @@ -160,7 +160,6 @@ void PenWidget::HandleGreenSelected(QString text) emit ColorSelected(Global::penColor); } - void PenWidget::HandleBlueSelected(QString text) { // Parse the text in the control @@ -174,4 +173,3 @@ void PenWidget::HandleBlueSelected(QString text) Global::penColor = (r << 16) | (g << 8) | b; emit ColorSelected(Global::penColor); } -