View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0015899 | Scribus | Properties Palette | public | 2019-11-02 12:23 | 2024-03-23 22:31 |
Reporter | ale | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | ||
Product Version | 1.5.6.svn | ||||
Summary | 0015899: [PATCH] Indigo UI: add an advanced section for the item name | ||||
Description | This patch should be applied before / in combination with the patch for the XYZ panel and adds a new "advanced" section that allows the user to edit the item name. This is might be a temporary solution until we find a better place for this field. As soon as we can play with the "new" properties and content palettes, i hope that it will be easier to find a good layout. After the review and commit of the XYZ panel we might also move the "do not print item" button to this new advanced section. Here is the merge request: https://gitlab.com/scribus/scribus/merge_requests/9 (it does not contain the patch for the xyz pane!) | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
indigo-pp-advanced.diff (18,956 bytes)
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt index 8e08543ae..334cd4f0f 100644 --- a/scribus/CMakeLists.txt +++ b/scribus/CMakeLists.txt @@ -158,6 +158,7 @@ set(SCRIBUS_UI_SRC ui/prefs_tableofcontentsbase.ui ui/prefs_documentitemattributesbase.ui ui/printdialogbase.ui + ui/propertiespalette_advancedbase.ui ui/propertiespalette_groupbase.ui ui/propertiespalette_imagebase.ui ui/propertiespalette_linebase.ui @@ -455,6 +456,7 @@ set(SCRIBUS_MOC_CLASSES ui/preview.h ui/printdialog.h ui/propertiespalette.h + ui/propertiespalette_advanced.h ui/propertiespalette_group.h ui/propertiespalette_image.h ui/propertiespalette_line.h @@ -955,6 +957,7 @@ set(SCRIBUS_SOURCES ui/preview.cpp ui/printdialog.cpp ui/propertiespalette.cpp + ui/propertiespalette_advanced.cpp ui/propertiespalette_image.cpp ui/propertiespalette_group.cpp ui/propertiespalette_line.cpp diff --git a/scribus/ui/propertiespalette.cpp b/scribus/ui/propertiespalette.cpp index 6e44a4829..0988aa4e5 100644 --- a/scribus/ui/propertiespalette.cpp +++ b/scribus/ui/propertiespalette.cpp @@ -41,6 +41,7 @@ for which a new license (GPL+exception) is in place. #include "cpalette.h" #include "dasheditor.h" #include "pageitem_table.h" +#include "propertiespalette_advanced.h" #include "propertiespalette_group.h" #include "propertiespalette_line.h" #include "propertiespalette_shadow.h" @@ -96,6 +97,9 @@ PropertiesPalette::PropertiesPalette( QWidget* parent) : ScDockPalette( parent, tablePal = new PropertiesPalette_Table(this); idTableItem = TabStack->addItem(tablePal, "T&able" ); + advancedPal = new PropertiesPalette_Advanced(this); + idAdvancedItem = TabStack->addItem(advancedPal, "&Advanced"); + setWidget( TabStack ); languageChange(); @@ -148,6 +152,7 @@ void PropertiesPalette::setMainWindow(ScribusMainWindow* mw) this->groupPal->setMainWindow(mw); this->linePal->setMainWindow(mw); this->tablePal->setMainWindow(mw); + this->advancedPal->setMainWindow(mw); //connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill())); //connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke())); @@ -218,6 +223,7 @@ void PropertiesPalette::setDoc(ScribusDoc *d) groupPal->setDoc(m_doc); linePal->setDoc(m_doc); tablePal->setDocument(m_doc); + advancedPal->setDoc(m_doc); updateColorList(); @@ -253,6 +259,8 @@ void PropertiesPalette::unsetDoc() linePal->unsetDoc(); tablePal->unsetItem(); tablePal->unsetDocument(); + advancedPal->unsetItem(); + advancedPal->unsetDoc(); colorPalette->setCurrentItem(nullptr); colorPalette->setDocument(nullptr); @@ -264,6 +272,7 @@ void PropertiesPalette::unsetDoc() TabStack->setItemEnabled(ws, false); TabStack->widget(0)->setEnabled(false); TabStack->setItemEnabled(idXYZItem, false); + TabStack->setItemEnabled(idAdvancedItem, false); } void PropertiesPalette::unsetItem() @@ -358,6 +367,7 @@ void PropertiesPalette::setCurrentItem(PageItem *item) TabStack->setItemEnabled(idColorsItem, false); TabStack->setItemEnabled(idTransparencyItem, true); TabStack->setItemEnabled(idTableItem, false); + TabStack->setItemEnabled(idAdvancedItem, true); } else TabStack->setItemEnabled(idGroupItem, false); @@ -380,6 +390,7 @@ void PropertiesPalette::setCurrentItem(PageItem *item) linePal->handleSelectionChanged(); tablePal->handleSelectionChanged(); colorPalette->handleSelectionChanged(); + advancedPal->handleSelectionChanged(); } if (m_item->asOSGFrame()) @@ -393,6 +404,7 @@ void PropertiesPalette::setCurrentItem(PageItem *item) TabStack->setItemEnabled(idTableItem, false); TabStack->setItemEnabled(idTransparencyItem, false); TabStack->setItemEnabled(idTableItem, false); + TabStack->setItemEnabled(idAdvancedItem, true); } if (m_item->asSymbolFrame()) { @@ -404,6 +416,7 @@ void PropertiesPalette::setCurrentItem(PageItem *item) TabStack->setItemEnabled(idColorsItem, false); TabStack->setItemEnabled(idTransparencyItem, false); TabStack->setItemEnabled(idTableItem, false); + TabStack->setItemEnabled(idAdvancedItem, true); } connect(TabStack, SIGNAL(currentChanged2(int)), this, SLOT(SelTab(int))); } @@ -427,6 +440,7 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idColorsItem, true); TabStack->setItemEnabled(idTransparencyItem, true); TabStack->setItemEnabled(idTableItem, false); // At least not for now. + TabStack->setItemEnabled(idAdvancedItem, true); if (m_haveItem && m_item) { if ((m_item->isGroup()) && (!m_item->isSingleSel)) @@ -444,6 +458,7 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idColorsItem, true); TabStack->setItemEnabled(idTransparencyItem, true); TabStack->setItemEnabled(idTableItem, false); + TabStack->setItemEnabled(idAdvancedItem, true); switch (itemType) { case -1: @@ -452,6 +467,7 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(ws, false); TabStack->widget(0)->setEnabled(false); TabStack->setItemEnabled(idXYZItem, false); + TabStack->setItemEnabled(idAdvancedItem, false); colorPalette->showGradient(0); break; case PageItem::ImageFrame: @@ -466,6 +482,7 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idColorsItem, true); TabStack->setItemEnabled(idTransparencyItem, false); + TabStack->setItemEnabled(idAdvancedItem, true); } else { @@ -473,6 +490,7 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); TabStack->setItemEnabled(idLineItem, true); + TabStack->setItemEnabled(idAdvancedItem, true); } break; case PageItem::TextFrame: @@ -552,6 +570,7 @@ void PropertiesPalette::unitChange() shapePal->unitChange(); groupPal->unitChange(); linePal->unitChange(); + advancedPal->unitChange(); colorPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); transparencyPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); @@ -814,6 +833,7 @@ void PropertiesPalette::languageChange() TabStack->setItemText(idGroupItem, tr("&Group")); TabStack->setItemText(idTransparencyItem, tr("&Transparency")); TabStack->setItemText(idTableItem, tr("T&able")); + TabStack->setItemText(idAdvancedItem, tr("&Advanced")); xyzPal->languageChange(); shadowPal->languageChange(); @@ -822,6 +842,7 @@ void PropertiesPalette::languageChange() colorPalette->languageChange(); linePal->languageChange(); tablePal->languageChange(); + advancedPal->languageChange(); } void PropertiesPalette::setGradientEditMode(bool on) diff --git a/scribus/ui/propertiespalette.h b/scribus/ui/propertiespalette.h index 0b04e900b..8dca03784 100644 --- a/scribus/ui/propertiespalette.h +++ b/scribus/ui/propertiespalette.h @@ -33,6 +33,7 @@ class QWidget; class ColorCombo; class ColorPalette; class NameWidget; +class PropertiesPalette_Advanced; class PropertiesPalette_Group; class PropertiesPalette_Line; class PropertiesPalette_Shadow; @@ -69,6 +70,7 @@ public: // and if in ScribusView a groupTransaction has been started it must be also // commmited + PropertiesPalette_Advanced* advancedPal {nullptr}; PropertiesPalette_Group* groupPal {nullptr}; PropertiesPalette_Line* linePal {nullptr}; PropertiesPalette_Shadow* shadowPal {nullptr}; @@ -130,6 +132,7 @@ protected: int idTransparencyItem {0}; int idGroupItem {0}; int idShadowItem {0}; + int idAdvancedItem {0}; }; #endif diff --git a/scribus/ui/propertiespalette_advanced.cpp b/scribus/ui/propertiespalette_advanced.cpp new file mode 100644 index 000000000..7ba213a21 --- /dev/null +++ b/scribus/ui/propertiespalette_advanced.cpp @@ -0,0 +1,258 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ + +#include "propertiespalette_advanced.h" + +#include <QMessageBox> + +#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) +#define _USE_MATH_DEFINES +#endif +#include <cmath> + +#include "appmodehelper.h" +#include "appmodes.h" +#include "autoform.h" +#include "basepointwidget.h" +#include "commonstrings.h" +#include "pageitem.h" +#include "pageitem_arc.h" +#include "pageitem_group.h" +#include "propertiespalette_utils.h" + +#include "scribuscore.h" +#include "scraction.h" +#include "scribusdoc.h" +#include "scribusview.h" +#include "selection.h" +#include "tabmanager.h" +#include "units.h" +#include "undomanager.h" +#include "util.h" +#include "iconmanager.h" +#include "util_math.h" + +//using namespace std; + +PropertiesPalette_Advanced::PropertiesPalette_Advanced( QWidget* parent) : QWidget(parent) +{ + m_ScMW=nullptr; + m_doc=nullptr; + m_haveDoc = false; + m_haveItem = false; + m_unitRatio = 1.0; + + setupUi(this); + setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); + + nameEdit->setFocusPolicy(Qt::ClickFocus); + + languageChange(); + + connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName())); + + m_haveItem = false; +} + +void PropertiesPalette_Advanced::setMainWindow(ScribusMainWindow* mw) +{ + m_ScMW = mw; +} + +void PropertiesPalette_Advanced::setDoc(ScribusDoc *d) +{ + if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) + return; + + m_doc = d; + m_item = nullptr; + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + + m_haveDoc = true; + m_haveItem = false; + + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); +} + +void PropertiesPalette_Advanced::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_haveDoc = false; + m_haveItem = false; + m_doc = nullptr; + m_item = nullptr; + nameEdit->clear(); + setEnabled(false); +} + +void PropertiesPalette_Advanced::unsetItem() +{ + m_haveItem = false; + m_item = nullptr; + handleSelectionChanged(); +} + +PageItem* PropertiesPalette_Advanced::currentItemFromSelection() +{ + PageItem *currentItem = nullptr; + + if (m_doc) + { + if (m_doc->m_Selection->count() > 1) + { + currentItem = m_doc->m_Selection->itemAt(0); + } + else if (m_doc->m_Selection->count() == 1) + { + currentItem = m_doc->m_Selection->itemAt(0); + } + } + + return currentItem; +} + +void PropertiesPalette_Advanced::setCurrentItem(PageItem *item) +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + //CB We shouldn't really need to process this if our item is the same one + //maybe we do if the item has been changed by scripter.. but that should probably + //set some status if so. + //FIXME: This won't work until when a canvas deselect happens, m_item must be nullptr. + //if (m_item == i) + // return; + + if (!m_doc) + setDoc(item->doc()); + + disconnect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); + + m_haveItem = false; + m_item = item; + + nameEdit->setText(m_item->itemName()); + + connect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName())); + + m_haveItem = true; +} + +void PropertiesPalette_Advanced::handleSelectionChanged() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + nameEdit->setEnabled(m_doc->m_Selection->count() == 1); + + PageItem* currItem = currentItemFromSelection(); + if (m_doc->m_Selection->count() > 1) + { + nameEdit->setEnabled(false); + setEnabled(true); + } + else + { + int itemType = currItem ? (int) currItem->itemType() : -1; + + m_haveItem = (itemType!=-1); + nameEdit->setEnabled(true); + + setEnabled(true); + } + if (currItem) + { + setCurrentItem(currItem); + } + updateGeometry(); +} + +void PropertiesPalette_Advanced::unitChange() +{ + if (!m_haveDoc) + return; + bool tmp = m_haveItem; + m_haveItem = false; + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + // TODO: update the details infos as soon as we have some + m_haveItem = tmp; +} + +void PropertiesPalette_Advanced::handleNewName() +{ + if (m_ScMW->scriptIsRunning() || !m_haveDoc || !m_haveItem) + return; + QString NameOld = m_item->itemName(); + QString NameNew = nameEdit->text(); + if (NameNew.isEmpty()) + { + nameEdit->setText(NameOld); + return; + } + bool found = false; + QList<PageItem*> allItems; + for (int a = 0; a < m_doc->Items->count(); ++a) + { + PageItem *currItem = m_doc->Items->at(a); + if (currItem->isGroup()) + allItems = currItem->getAllChildren(); + else + allItems.append(currItem); + for (int ii = 0; ii < allItems.count(); ii++) + { + PageItem* item = allItems.at(ii); + if ((NameNew == item->itemName()) && (item != m_item)) + { + found = true; + break; + } + } + allItems.clear(); + } + if (found) + { + ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>"); + nameEdit->setText(NameOld); + nameEdit->setFocus(); + } + else + { + if (m_item->itemName() != nameEdit->text()) + { + m_item->setItemName(nameEdit->text()); + m_doc->changed(); + } + } +} + +void PropertiesPalette_Advanced::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + } + else + QWidget::changeEvent(e); +} + +void PropertiesPalette_Advanced::languageChange() +{ + setWindowTitle( tr("Details")); + retranslateUi(this); + + QString ptSuffix = tr(" pt"); + + QString ein = (m_haveDoc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix; + +} diff --git a/scribus/ui/propertiespalette_advanced.h b/scribus/ui/propertiespalette_advanced.h new file mode 100644 index 000000000..f4d19d6a1 --- /dev/null +++ b/scribus/ui/propertiespalette_advanced.h @@ -0,0 +1,66 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#ifndef PROPERTIESPALETTE_ADVANCED_H +#define PROPERTIESPALETTE_ADVANCED_H + +#include "ui_propertiespalette_advancedbase.h" + +#include "scribusapi.h" +#include "scrspinbox.h" +#include "linkbutton.h" +#include "sclistboxpixmap.h" +#include "scguardedptr.h" + +class NameWidget; +class PageItem; +class ScribusDoc; +class Selection; +class ScribusMainWindow; + +class SCRIBUS_API PropertiesPalette_Advanced : public QWidget, public Ui::PropertiesPalette_AdvancedBase +{ + Q_OBJECT + +public: + PropertiesPalette_Advanced(QWidget* parent); + ~PropertiesPalette_Advanced() {}; + + virtual void changeEvent(QEvent *e); + +private: + + PageItem* currentItemFromSelection(); + +public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *d); + void setCurrentItem(PageItem *item); + void unsetDoc(); + void unsetItem(); + + void languageChange(); + void unitChange(); + + void handleSelectionChanged(); + +private slots: + void handleNewName(); + +protected: + ScribusMainWindow *m_ScMW; + + bool m_haveDoc; + bool m_haveItem; + bool m_lineMode; + double m_unitRatio; + int m_unitIndex; + PageItem *m_item; + ScGuardedPtr<ScribusDoc> m_doc; +}; + +#endif diff --git a/scribus/ui/propertiespalette_advancedbase.ui b/scribus/ui/propertiespalette_advancedbase.ui new file mode 100644 index 000000000..73254ac67 --- /dev/null +++ b/scribus/ui/propertiespalette_advancedbase.ui @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PropertiesPalette_AdvancedBase</class> + <widget class="QWidget" name="PropertiesPalette_AdvancedBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>280</width> + <height>333</height> + </rect> + </property> + <property name="windowTitle"> + <string notr="true">Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>5</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QGroupBox" name="nameGroup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Name</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>2</number> + </property> + <property name="leftMargin"> + <number>2</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <item> + <widget class="NameWidget" name="nameEdit"> + <property name="focusPolicy"> + <enum>Qt::ClickFocus</enum> + </property> + <property name="toolTip"> + <string>Name of selected object</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>NameWidget</class> + <extends>QLineEdit</extends> + <header>ui/propertiespalette_utils.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> |
|
As already mentioned on IRC, I disagree with this approach. |
|
and where do you want it then? should i really make an advanced collapsed part of the xyz panel as martin suggests? it's more complicated to implement, more complex for the user and the item name is not part of the xyz (coordinates related) properties of an item. |
|
'x, y, z' contains already a mix of position related items and some more general properties like 'print', 'lock', 'mirror' or 'group'. do we need a 'general' tab? – or a less specific name for the current 'x, y, z' tab? |
|
group/ungroup is not in the proposal anymore. exactly because it does not belong in there. (and because there are much better alternatives for grouping items) for multiple reasons i'd like the "print" button to be removed from there. (btw, @utnik , have you ever used it? in which use case?) the other buttons, imo, somehow relate to the position and size (lock position, lock size, mirror coordinates, ...) in martin's proposal the item name is not at his current prominent place and i agree with him that it does not belong there. he puts the input field in a expandable section at the end of the xyz panel. i'd like to put it in an expandable secion at the end of the properties palette. |
|
@ale: no, i never use the 'print' button for items – if i exclude something from the export, i do it by a separate layer. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-11-02 12:23 | ale | New Issue | |
2019-11-02 12:23 | ale | File Added: indigo-pp-advanced.diff | |
2019-11-02 12:23 | ale | Summary | Inidigo UI: add an advanced section for the item name => [PATCH] Inidigo UI: add an advanced section for the item name |
2019-11-02 12:23 | ale | Patch | No => Yes |
2019-11-02 12:54 | jghali | Note Added: 0046918 | |
2019-11-02 13:10 | ale | Note Added: 0046920 | |
2019-11-02 14:39 | utnik | Note Added: 0046925 | |
2019-11-02 16:07 | ale | Note Added: 0046926 | |
2019-11-02 16:18 | utnik | Note Added: 0046928 | |
2019-11-05 07:26 | ale | Summary | [PATCH] Inidigo UI: add an advanced section for the item name => [PATCH] Indigo UI: add an advanced section for the item name |
2019-11-05 07:42 | ale | Relationship added | related to 0015813 |
2024-03-23 22:31 | nitramr | Relationship added | related to 0017180 |