View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0015551 | Scribus | User Interface | public | 2019-01-24 08:54 | 2019-10-28 18:43 |
Reporter | ale | Assigned To | ale | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.5.svn | ||||
Fixed in Version | 1.5.6.svn | ||||
Summary | 0015551: Content Palette with Text and Image Properties | ||||
Description | Create a new palette that automatically switch the pane to show the Text and Image properties according to the type of the frame currently selected. - Create a new "Content Properties" palette - Move the inner pane of the "Text properties" into it - Move the "Image" tab of the "Properties" palette into it. I have a patch that is almost done. | ||||
Additional Information | some implementation details: - the "default" pane is currently left empty. i'm wondering if it could contain some page or document settings... - the "content properties" get the F3 shortcut from the text properties - all the calls to the text and image properties panes go through the "content properties": it might now be possible to simplify the code and remove many of the defensive checks on doc and items being there. - i'm using new style signals and slots. open questions / issues: - in ui/contentpalette.cpp check the "competences" of handleSelectionChanged() and setCurrentIndex() | ||||
Tags | patch | ||||
Patch | Yes | ||||
related to | 0009126 | new | show text tab in the properties palette when getting into text edit mode |
|
here is the patch! content-palette.diff (57,336 bytes)
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt index c21ab4927..18ca3bfab 100644 --- a/scribus/CMakeLists.txt +++ b/scribus/CMakeLists.txt @@ -340,6 +340,7 @@ set(SCRIBUS_MOC_CLASSES ui/colorlistbox.h ui/colorlistmodel.h ui/colorsandfills.h + ui/contentpalette.h ui/contextmenu.h ui/cpalette.h ui/cupsoptions.h @@ -547,7 +548,6 @@ set(SCRIBUS_MOC_CLASSES ui/tabmanager.h ui/tabpdfoptions.h ui/tabruler.h - ui/textpalette.h ui/transformdialog.h ui/transparencypalette.h tt/simpletreemodel/treemodel.h @@ -841,6 +841,7 @@ set(SCRIBUS_SOURCES ui/colorlistbox.cpp ui/colorlistmodel.cpp ui/colorsandfills.cpp + ui/contentpalette.cpp ui/contextmenu.cpp ui/cpalette.cpp ui/cupsoptions.cpp @@ -1047,7 +1048,6 @@ set(SCRIBUS_SOURCES ui/tabmanager.cpp ui/tabpdfoptions.cpp ui/tabruler.cpp - ui/textpalette.cpp ui/transformdialog.cpp ui/transparencypalette.cpp tt/simpletreemodel/treeitem.cpp diff --git a/scribus/actionmanager.cpp b/scribus/actionmanager.cpp index 9aec32c26..067ca92a6 100644 --- a/scribus/actionmanager.cpp +++ b/scribus/actionmanager.cpp @@ -794,7 +794,7 @@ void ActionManager::initToolsMenuActions() //Tool menu name="toolsProperties"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); - name="toolsText"; + name="toolsContent"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="toolsOutline"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); @@ -902,7 +902,7 @@ void ActionManager::initToolsMenuActions() #endif //Set the applicaton wide palette shortcuts (*scrActions)["toolsProperties"]->setShortcutContext(Qt::ApplicationShortcut); - (*scrActions)["toolsText"]->setShortcutContext(Qt::ApplicationShortcut); + (*scrActions)["toolsContent"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsScrapbook"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsLayers"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsPages"]->setShortcutContext(Qt::ApplicationShortcut); @@ -916,7 +916,7 @@ void ActionManager::initToolsMenuActions() (*scrActions)["toolsProperties"]->setToggleAction(true); - (*scrActions)["toolsText"]->setToggleAction(true); + (*scrActions)["toolsContent"]->setToggleAction(true); (*scrActions)["toolsOutline"]->setToggleAction(true); (*scrActions)["toolsScrapbook"]->setToggleAction(true); (*scrActions)["toolsLayers"]->setToggleAction(true); @@ -1681,7 +1681,7 @@ void ActionManager::languageChange() //Tool menu (*scrActions)["toolsProperties"]->setTexts( tr("&Properties")); - (*scrActions)["toolsText"]->setTexts( tr("Text Properties")); + (*scrActions)["toolsContent"]->setTexts( tr("&Content Properties")); (*scrActions)["toolsOutline"]->setTexts( tr("&Outline", "Document Outline Palette")); (*scrActions)["toolsScrapbook"]->setTexts( tr("&Scrapbook")); (*scrActions)["toolsLayers"]->setTexts( tr("&Layers")); @@ -1948,7 +1948,7 @@ void ActionManager::createDefaultShortcuts() //Tool menu defKeys.insert("toolsProperties", Qt::Key_F2); - defKeys.insert("toolsText", Qt::Key_F3); + defKeys.insert("toolsContent", Qt::Key_F3); defKeys.insert("toolsLayers", Qt::Key_F6); //toolbar only items @@ -2354,7 +2354,7 @@ void ActionManager::createDefaultMenus() << "windowsCascade" << "windowsTile" << "toolsProperties" - << "toolsText" + << "toolsContent" << "toolsOutline" << "toolsScrapbook" << "toolsLayers" diff --git a/scribus/canvasmode_imageimport.cpp b/scribus/canvasmode_imageimport.cpp index a0a1ceda5..c1c165ccf 100644 --- a/scribus/canvasmode_imageimport.cpp +++ b/scribus/canvasmode_imageimport.cpp @@ -35,8 +35,7 @@ #include "scribusdoc.h" #include "scribusview.h" #include "selection.h" -#include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" +#include "ui/contentpalette.h" CanvasMode_ImageImport::CanvasMode_ImageImport(ScribusView *view) : CanvasMode(view), m_ScMW(view->m_ScMW) { @@ -238,7 +237,7 @@ void CanvasMode_ImageImport::setImage(PageItem *currItem) m_doc->loadPict(fileName, currItem, false, true); // Call to showScaleAndOffset() is now very likely unnecessary // due to mecanisms used to update properties in PP in 1.5.x+ - //m_ScMW->propertiesPalette->imagePal->showScaleAndOffset(currItem->imageXScale(), currItem->imageYScale(), currItem->imageXOffset(), currItem->imageYOffset()); + // m_ScMW->contentPalette->update(currItem->asImageFrame()); m_ScMW->repaint(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); m_view->DrawNew(); diff --git a/scribus/canvasmode_normal.cpp b/scribus/canvasmode_normal.cpp index 8eabfd951..55b1ce4bc 100644 --- a/scribus/canvasmode_normal.cpp +++ b/scribus/canvasmode_normal.cpp @@ -46,7 +46,6 @@ #include "pageitem_arc.h" #include "pageitem_line.h" #include "pageitem_regularpolygon.h" -#include "pageitem_textframe.h" #include "plugins/formatidlist.h" #include "prefscontext.h" #include "prefsfile.h" @@ -1175,7 +1174,6 @@ void CanvasMode_Normal::mouseReleaseEvent(QMouseEvent *m) m_doc->m_Selection->delaySignalsOn(); // loop over all items and select bool altPressed = m->modifiers() & Qt::AltModifier; - bool shiftPressed = m->modifiers() & Qt::ShiftModifier; for (int a = 0; a < docItemCount; ++a) { diff --git a/scribus/gtaction.cpp b/scribus/gtaction.cpp index 8290da91d..5c3c511c7 100644 --- a/scribus/gtaction.cpp +++ b/scribus/gtaction.cpp @@ -50,8 +50,7 @@ for which a new license (GPL+exception) is in place. #include "undomanager.h" #include "util.h" #include "util_text.h" -#include "ui/textpalette.h" -#include "ui/propertiespalette_text.h" +#include "ui/contentpalette.h" #include "ui/missing.h" @@ -555,7 +554,7 @@ void gtAction::createParagraphStyle(gtParagraphStyle* pstyle) tmp.create(vg); m_textFrame->doc()->redefineStyles(tmp, false); - m_ScMW->textPalette->textPal->updateParagraphStyles(); + m_ScMW->contentPalette->updateTextStyles(); } void gtAction:: setCharStyleAttributes(gtFont *font, CharStyle& style) @@ -872,7 +871,7 @@ QString gtAction::parseColor(const QString &s) ScColor tmp; tmp.fromQColor(c); m_textFrame->doc()->PageColors.insert("FromGetText"+c.name(), tmp); - m_ScMW->textPalette->updateColorList(); + m_ScMW->contentPalette->updateColorList(); ret = "FromGetText"+c.name(); } } diff --git a/scribus/pageitem.cpp b/scribus/pageitem.cpp index 74aa708dc..2c46e6e91 100644 --- a/scribus/pageitem.cpp +++ b/scribus/pageitem.cpp @@ -75,7 +75,7 @@ for which a new license (GPL+exception) is in place. #include "text/storytext.h" #include "ui/guidemanager.h" #include "ui/propertiespalette.h" -#include "ui/textpalette.h" +#include "ui/contentpalette.h" #include "undomanager.h" #include "undostate.h" #include "units.h" @@ -9443,7 +9443,7 @@ bool PageItem::loadImage(const QString& filename, const bool reload, const int g efVal += pixm.imgInfo.duotoneColors[cc].Name+"\n"; } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); struct ImageEffect ef; if (pixm.imgInfo.duotoneColors.count() == 1) { diff --git a/scribus/plugins/colorwheel/cwdialog.cpp b/scribus/plugins/colorwheel/cwdialog.cpp index f8644be9d..60b995fe7 100644 --- a/scribus/plugins/colorwheel/cwdialog.cpp +++ b/scribus/plugins/colorwheel/cwdialog.cpp @@ -19,7 +19,7 @@ for which a new license (GPL+exception) is in place. #include "ui/cmykfw.h" #include "ui/colorlistbox.h" #include "ui/propertiespalette.h" -#include "ui/textpalette.h" +#include "ui/contentpalette.h" #include "util_color.h" @@ -343,7 +343,7 @@ void CWDialog::addButton_clicked() return; } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); accept(); } @@ -354,7 +354,7 @@ void CWDialog::replaceButton_clicked() m_Doc->PageColors[it.key()] = it.value(); } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); accept(); } diff --git a/scribus/plugins/scripter/api_imageitem.cpp b/scribus/plugins/scripter/api_imageitem.cpp index 8d5be1a65..222cae440 100644 --- a/scribus/plugins/scripter/api_imageitem.cpp +++ b/scribus/plugins/scripter/api_imageitem.cpp @@ -10,8 +10,6 @@ for which a new license (GPL+exception) is in place. #include "undomanager.h" #include "sctextstream.h" #include "scribusview.h" -#include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" ImageAPI::ImageAPI(PageItem_ImageFrame* im) : ItemAPI(im) { @@ -205,7 +203,7 @@ void ImageAPI::scaleToFrame(bool scaleToFrame, bool proportional) // Force the braindead app to notice the changes //FIXME emit or something so we dont need this - ScCore->primaryMainWindow()->propertiesPalette->imagePal->showScaleAndOffset(item->imageXScale(), item->imageYScale(), item->imageXOffset(), item->imageYOffset()); + ScCore->primaryMainWindow()->contentPalette->update(item->asImageFrame()); item->adjustPictScale(); //ScCore->primaryMainWindow()->view->adjustPictScale(item); diff --git a/scribus/plugins/scripter/api_page.cpp b/scribus/plugins/scripter/api_page.cpp index ef32e967b..92e596608 100644 --- a/scribus/plugins/scripter/api_page.cpp +++ b/scribus/plugins/scripter/api_page.cpp @@ -12,7 +12,6 @@ for which a new license (GPL+exception) is in place. #include "../formatidlist.h" #include "loadsaveplugin.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_text.h" #include "ui/propertiespalette_line.h" #include "ui/textpalette.h" #include "scribuscore.h" diff --git a/scribus/plugins/scriptplugin/cmdmani.cpp b/scribus/plugins/scriptplugin/cmdmani.cpp index 03b7b3e0f..4220ca64b 100644 --- a/scribus/plugins/scriptplugin/cmdmani.cpp +++ b/scribus/plugins/scriptplugin/cmdmani.cpp @@ -11,8 +11,6 @@ for which a new license (GPL+exception) is in place. #include "scribusview.h" #include "sctextstream.h" #include "selection.h" -#include "ui/propertiespalette.h" //CB argh.. noooooooooooooooooooooooooooooooooooo FIXME see other FIXME -#include "ui/propertiespalette_image.h" #include "undomanager.h" diff --git a/scribus/plugins/scriptplugin/scriptercore.cpp b/scribus/plugins/scriptplugin/scriptercore.cpp index c9c8672cc..6b0dc09a8 100644 --- a/scribus/plugins/scriptplugin/scriptercore.cpp +++ b/scribus/plugins/scriptplugin/scriptercore.cpp @@ -22,12 +22,12 @@ for which a new license (GPL+exception) is in place. #include "ui/marksmanager.h" #include "ui/notesstyleseditor.h" #include "ui/propertiespalette.h" //TODO Move the calls to this to a signal +#include "ui/contentpalette.h" //TODO Move the calls to this to a signal #include "ui/pagepalette.h" //TODO Move the calls to this to a signal #include "ui/layers.h" //TODO Move the calls to this to a signal #include "ui/outlinepalette.h" //TODO Move the calls to this to a signal #include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" -#include "ui/textpalette.h" #include "pconsole.h" #include "scraction.h" #include "scribuscore.h" @@ -162,7 +162,7 @@ void ScripterCore::FinishScriptRun() if (ScMW->HaveDoc) { ScMW->propertiesPalette->setDoc(ScMW->doc); - ScMW->textPalette->setDoc(ScMW->doc); + ScMW->contentPalette->setDoc(ScMW->doc); ScMW->marksManager->setDoc(ScMW->doc); ScMW->nsEditor->setDoc(ScMW->doc); ScMW->layerPalette->setDoc(ScMW->doc); @@ -249,7 +249,7 @@ void ScripterCore::slotRunScriptFile(const QString& fileName, QStringList argume if (!inMainInterpreter) { ScCore->primaryMainWindow()->propertiesPalette->unsetDoc(); - ScCore->primaryMainWindow()->textPalette->unsetDoc(); + ScCore->primaryMainWindow()->contentPalette->unsetDoc(); ScCore->primaryMainWindow()->pagePalette->setView(nullptr); ScCore->primaryMainWindow()->setScriptRunning(true); qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -394,7 +394,7 @@ void ScripterCore::slotRunScript(const QString& Script) disableMainWindowMenu(); ScCore->primaryMainWindow()->propertiesPalette->unsetDoc(); - ScCore->primaryMainWindow()->textPalette->unsetDoc(); + ScCore->primaryMainWindow()->contentPalette->unsetDoc(); ScCore->primaryMainWindow()->pagePalette->setView(nullptr); ScCore->primaryMainWindow()->setScriptRunning(true); inValue = Script; diff --git a/scribus/plugins/scriptplugin/svgimport.cpp b/scribus/plugins/scriptplugin/svgimport.cpp index 58e39520a..282dd0f25 100644 --- a/scribus/plugins/scriptplugin/svgimport.cpp +++ b/scribus/plugins/scriptplugin/svgimport.cpp @@ -18,7 +18,6 @@ for which a new license (GPL+exception) is in place. #include "selection.h" #include "ui/propertiespalette.h" #include "ui/propertiespalette_line.h" -#include "ui/propertiespalette_text.h" #include <QString> diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index 88ee08354..234304224 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -221,11 +221,10 @@ for which a new license (GPL+exception) is in place. #include "ui/preferencesdialog.h" #include "ui/preview.h" #include "ui/printdialog.h" +#include "ui/contentpalette.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" #include "ui/propertiespalette_line.h" #include "ui/propertiespalette_shape.h" -#include "ui/propertiespalette_text.h" #include "ui/propertiespalette_xyz.h" #include "ui/query.h" #include "ui/recoverdialog.h" @@ -248,7 +247,6 @@ for which a new license (GPL+exception) is in place. #include "ui/stylemanager.h" #include "ui/symbolpalette.h" #include "ui/tabmanager.h" -#include "ui/textpalette.h" #include "ui/transformdialog.h" #include "ui/transparencypalette.h" #include "ui/viewtoolbar.h" @@ -423,7 +421,7 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow) ToggleTips(); ToggleMouseTips(); propertiesPalette->setFontSize(); - textPalette->setFontSize(); + contentPalette->setFontSize(); if (scrActions["SaveAsDocumentTemplate"]) scrActions["SaveAsDocumentTemplate"]->setEnabled(false); @@ -612,12 +610,12 @@ void ScribusMainWindow::initPalettes() emit UpdateRequest(reqDefFontListUpdate); propertiesPalette->installEventFilter(this); - textPalette = new TextPalette(this); - textPalette->setMainWindow(this); - connect( scrActions["toolsText"], SIGNAL(toggled(bool)) , textPalette, SLOT(setPaletteShown(bool))); - connect( textPalette, SIGNAL(paletteShown(bool)), scrActions["toolsText"], SLOT(setChecked(bool))); - emit UpdateRequest(reqDefFontListUpdate); - textPalette->installEventFilter(this); + contentPalette = new ContentPalette(this); + contentPalette->setMainWindow(this); + connect( scrActions["toolsContent"], &QAction::toggled, contentPalette, &ContentPalette::setPaletteShown); + connect( contentPalette, &ContentPalette::paletteShown, scrActions["toolsContent"], &QAction::setChecked); + contentPalette->installEventFilter(this); + nodePalette = new NodePalette(this); nodePalette->installEventFilter(this); layerPalette = new LayerPalette(this); @@ -1202,8 +1200,8 @@ void ScribusMainWindow::addDefaultWindowMenuItems() scrMenuMgr->addMenuItemString("windowsCascade", "Windows"); scrMenuMgr->addMenuItemString("windowsTile", "Windows"); scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); + scrMenuMgr->addMenuItemString("toolsContent", "Windows"); scrMenuMgr->addMenuItemString("toolsProperties", "Windows"); - scrMenuMgr->addMenuItemString("toolsText", "Windows"); scrMenuMgr->addMenuItemString("toolsActionHistory", "Windows"); scrMenuMgr->addMenuItemString("toolsAlignDistribute", "Windows"); scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); @@ -1455,7 +1453,7 @@ void ScribusMainWindow::setStatusBarInfoText(const QString & newText) } -//AV to be replaced with Selection::update and listener in textPalette +//AV to be replaced with Selection::update and listener in contentPalette void ScribusMainWindow::setTBvals(PageItem *currItem) { scrActions["editMark"]->setEnabled(false); @@ -1486,7 +1484,7 @@ void ScribusMainWindow::setTBvals(PageItem *currItem) doc->currentStyle.charStyle().setStyle(item->currentCharStyle()); emit TextStyle(doc->currentStyle); // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); //check if mark in cursor place and enable editMark action if (doc->appMode == modeEdit && item->itemText.cursorPosition() < item->itemText.length()) { @@ -1985,7 +1983,7 @@ void ScribusMainWindow::closeEvent(QCloseEvent *ce) } propertiesPalette->hide(); - textPalette->hide(); + contentPalette->hide(); outlinePalette->hide(); scrapbookPalette->hide(); bookmarkPalette->hide(); @@ -2663,7 +2661,7 @@ void ScribusMainWindow::SwitchWin() { updateActiveWindowCaption(doc->DocName); propertiesPalette->setDoc(doc); - textPalette->setDoc(doc); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); pagePalette->setView(view); @@ -2705,7 +2703,7 @@ void ScribusMainWindow::HaveNewDoc() //Update palettes updateActiveWindowCaption(doc->DocName); propertiesPalette->setDoc(doc); - textPalette->setDoc(doc); + contentPalette->setDoc(doc); nsEditor->setDoc(doc); marksManager->setDoc(doc); @@ -2740,7 +2738,7 @@ void ScribusMainWindow::HaveNewDoc() connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()), Qt::UniqueConnection); connect(view, SIGNAL(DocChanged()), this, SLOT(slotDocCh()), Qt::UniqueConnection); connect(view, SIGNAL(MousePos(double,double)), this, SLOT(setStatusBarMousePosition(double,double)), Qt::UniqueConnection); - connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), textPalette->textPal, SLOT(updateCharStyle(const CharStyle&)), Qt::UniqueConnection); + connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), contentPalette, SLOT(update(const CharStyle&)), Qt::UniqueConnection); connect(view, SIGNAL(ItemTextEffects(int)), this, SLOT(setStyleEffects(int)), Qt::UniqueConnection); connect(view, SIGNAL(ItemTextAlign(int)), this, SLOT(setAlignmentValue(int)), Qt::UniqueConnection); connect(view, SIGNAL(HasTextSel()), this, SLOT(EnableTxEdit()), Qt::UniqueConnection); @@ -2807,8 +2805,7 @@ void ScribusMainWindow::HaveNewSel() doc->currentStyle.setContext(curStyle.context()); doc->currentStyle = curStyle; emit TextStyle(doc->currentStyle); - // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); setStyleEffects(doc->currentStyle.charStyle().effects()); } break; @@ -2829,11 +2826,9 @@ void ScribusMainWindow::HaveNewSel() const ParagraphStyle& curStyle = currItem->itemText.defaultStyle(); doc->currentStyle.setContext(curStyle.context()); doc->currentStyle = curStyle; - textPalette->textPal->showParStyle(doc->currentStyle.parent()); - textPalette->textPal->showCharStyle(doc->currentStyle.charStyle().parent()); emit TextStyle(doc->currentStyle); // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); setStyleEffects(doc->currentStyle.charStyle().effects()); } break; @@ -3423,7 +3418,7 @@ bool ScribusMainWindow::loadPage(const QString& fileName, int Nr, bool Mpa, cons AddBookMark(ite); } propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); slotDocCh(); @@ -3962,7 +3957,7 @@ void ScribusMainWindow::slotGetContent() if (outlinePalette->isVisible()) outlinePalette->BuildTree(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); } @@ -3978,7 +3973,7 @@ void ScribusMainWindow::updateFromDrop() if (outlinePalette->isVisible()) outlinePalette->BuildTree(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); } @@ -4316,7 +4311,7 @@ bool ScribusMainWindow::DoFileClose() doc->CloseCMSProfiles(); //<<Palettes propertiesPalette->unsetDoc(); - textPalette->unsetDoc(); + contentPalette->unsetDoc(); inlinePalette->unsetDoc(); symbolPalette->unsetDoc(); pagePalette->setView(nullptr); @@ -4803,8 +4798,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -4884,8 +4879,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -4975,8 +4970,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -5577,8 +5572,8 @@ void ScribusMainWindow::ToggleAllPalettes() m_palettesStatus[PAL_ALL] = false; if (m_palettesStatus[PAL_PROPERTIES]) propertiesPalette->show(); - if (m_palettesStatus[PAL_TEXT]) - textPalette->show(); + if (m_palettesStatus[PAL_CONTENT]) + contentPalette->show(); if (m_palettesStatus[PAL_OUTLINE]) outlinePalette->show(); if (m_palettesStatus[PAL_SCRAPBOOK]) @@ -5598,7 +5593,7 @@ void ScribusMainWindow::ToggleAllPalettes() else { m_palettesStatus[PAL_PROPERTIES] = propertiesPalette->isVisible(); - m_palettesStatus[PAL_TEXT] = textPalette->isVisible(); + m_palettesStatus[PAL_CONTENT] = contentPalette->isVisible(); m_palettesStatus[PAL_OUTLINE] = outlinePalette->isVisible(); m_palettesStatus[PAL_SCRAPBOOK] = scrapbookPalette->isVisible(); m_palettesStatus[PAL_LAYER] = layerPalette->isVisible(); @@ -5608,7 +5603,7 @@ void ScribusMainWindow::ToggleAllPalettes() m_palettesStatus[PAL_VERIFIER] = docCheckerPalette->isVisible(); m_palettesStatus[PAL_DOWNLOADS] = downloadsPalette->isVisible(); propertiesPalette->hide(); - textPalette->hide(); + contentPalette->hide(); outlinePalette->hide(); scrapbookPalette->hide(); bookmarkPalette->hide(); @@ -6323,7 +6318,7 @@ void ScribusMainWindow::setItemFontSize(int fontSize) doc->itemSelection_SetFontSize(fs*10); } } - textPalette->textPal->showFontSize(fs*10); + contentPalette->updateTextFontSize(fs*10); } void ScribusMainWindow::setItemLanguage(const QString& language) @@ -6332,7 +6327,7 @@ void ScribusMainWindow::setItemLanguage(const QString& language) if (dia.exec()) doc->itemSelection_SetLanguage(language); - textPalette->textPal->showLanguage(language); + contentPalette->updateTextLanguage(language); } //CB-->Doc @@ -6341,7 +6336,7 @@ void ScribusMainWindow::setNewAlignment(int i) if (!HaveDoc) return; doc->itemSelection_SetAlignment(i); - textPalette->textPal->showAlignment(i); + contentPalette->updateTextAlignment(i); PageItem *currItem = doc->m_Selection->itemAt(0); setTBvals(currItem); } @@ -6351,7 +6346,7 @@ void ScribusMainWindow::setNewDirection(int i) if (!HaveDoc) return; doc->itemSelection_SetDirection(i); - textPalette->textPal->showDirection(i); + contentPalette->updateTextDirection(i); PageItem *currItem = doc->m_Selection->itemAt(0); setTBvals(currItem); } @@ -6376,7 +6371,7 @@ void ScribusMainWindow::setNewCharStyle(const QString& name) void ScribusMainWindow::setAlignmentValue(int i) { - textPalette->textPal->showAlignment(i); + contentPalette->updateTextAlignment(i); QString alignment[] = {"Left", "Center", "Right", "Block", "Forced"}; for (int j=0; j<5; ++j) { @@ -6388,7 +6383,7 @@ void ScribusMainWindow::setAlignmentValue(int i) void ScribusMainWindow::setDirectionValue(int i) { - textPalette->textPal->showDirection(i); + contentPalette->updateTextDirection(i); QString direction[] = {"Left", "Right"}; for (int j=0; j<2; ++j) { @@ -6794,7 +6789,7 @@ void ScribusMainWindow::slotDocSetup() int ScribusMainWindow::ShowSubs() { propertiesPalette->startup(); - textPalette->startup(); + contentPalette->startup(); outlinePalette->startup(); scrapbookPalette->startup(); bookmarkPalette->startup(); @@ -7503,7 +7498,7 @@ void ScribusMainWindow::slotChangeUnit(int unitIndex, bool draw) setCurrentComboItem(unitSwitcher, unitGetStrFromIndex(doc->unitIndex())); view->unitChange(); propertiesPalette->unitChange(); - textPalette->unitChange(); + contentPalette->unitChange(); nodePalette->unitChange(); alignDistributePalette->unitChange(); guidePalette->setupPage(); @@ -7604,7 +7599,7 @@ void ScribusMainWindow::editSymbolEnd() view->DrawNew(); pagePalette->Rebuild(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->editingFinished(); layerPalette->setEnabled(true); if (outlinePalette->isVisible()) @@ -7673,8 +7668,8 @@ void ScribusMainWindow::editInlineEnd() pagePalette->Rebuild(); propertiesPalette->unsetItem(); propertiesPalette->updateColorList(); - textPalette->unsetItem(); - textPalette->updateColorList(); + contentPalette->unsetItem(); + contentPalette->updateColorList(); inlinePalette->editingFinished(); layerPalette->setEnabled(true); if (outlinePalette->isVisible()) @@ -8136,7 +8131,7 @@ void ScribusMainWindow::recalcColors() return; doc->recalculateColors(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); } void ScribusMainWindow::ModifyAnnot() @@ -8911,7 +8906,7 @@ void ScribusMainWindow::slotEditPasteContents(int absolute) qApp->processEvents(QEventLoop::ExcludeUserInputEvents); view->DrawNew(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqCmsOptionsUpdate); currItem->emitAllToGUI(); qApp->restoreOverrideCursor(); @@ -9216,7 +9211,7 @@ void ScribusMainWindow::PutToPatterns() doc->m_Selection->clear(); doc->m_Selection->delaySignalsOff(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->updateSymbolList(); emit UpdateRequest(reqColorsUpdate); doc->minCanvasCoordinate = minSize; @@ -9247,7 +9242,7 @@ void ScribusMainWindow::ConvertToSymbol() m_undoManager->setUndoEnabled(false); doc->itemSelection_convertItemsToSymbol(patternName); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->updateSymbolList(); emit UpdateRequest(reqColorsUpdate); if (outlinePalette->isVisible()) @@ -10024,7 +10019,7 @@ void ScribusMainWindow::setPreviewToolbar() undoPalette->setEnabled(!doc->drawAsPreview); outlinePalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); propertiesPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); - textPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); + contentPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); scrMenuMgr->setMenuEnabled("Edit", !doc->drawAsPreview); scrMenuMgr->setMenuEnabled("Item", !doc->drawAsPreview); scrMenuMgr->setMenuEnabled("Insert", !doc->drawAsPreview); diff --git a/scribus/scribus.h b/scribus/scribus.h index 056cf17aa..17e4be6da 100644 --- a/scribus/scribus.h +++ b/scribus/scribus.h @@ -91,6 +91,7 @@ class PagePalette; class PageSelector; class PrefsContext; class PrefsManager; +class ContentPalette; class PropertiesPalette; class ResourceManager; class ScMWMenuManager; @@ -106,7 +107,6 @@ class SimpleState; class StoryEditor; class StyleManager; class SymbolPalette; -class TextPalette; class TOCGenerator; class UndoManager; class UndoPalette; @@ -231,7 +231,7 @@ public: GuideManager *guidePalette; CharSelect *charPalette; PropertiesPalette *propertiesPalette; - TextPalette *textPalette; + ContentPalette *contentPalette; MarksManager *marksManager; NotesStylesEditor *nsEditor; NodePalette *nodePalette; diff --git a/scribus/scribusstructs.h b/scribus/scribusstructs.h index 0297ba4e3..3422bd3c9 100644 --- a/scribus/scribusstructs.h +++ b/scribus/scribusstructs.h @@ -419,16 +419,15 @@ enum { PAL_ALL, PAL_PROPERTIES, + PAL_CONTENT, PAL_OUTLINE, PAL_SCRAPBOOK, PAL_LAYER, PAL_PAGE, PAL_BOOKMARK, - PAL_7_UNUSED, PAL_UNDO, PAL_VERIFIER, PAL_DOWNLOADS, - PAL_TEXT, PAL_MAX }; diff --git a/scribus/scribusview.cpp b/scribus/scribusview.cpp index f3715ad39..b64d502cd 100644 --- a/scribus/scribusview.cpp +++ b/scribus/scribusview.cpp @@ -114,9 +114,7 @@ for which a new license (GPL+exception) is in place. #include "ui/pageitemattributes.h" #include "ui/pageselector.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" #include "ui/propertiespalette_line.h" -#include "ui/propertiespalette_text.h" #include "ui/rulermover.h" #include "ui/scrapbookpalette.h" #include "ui/storyeditor.h" diff --git a/scribus/ui/contentpalette.cpp b/scribus/ui/contentpalette.cpp new file mode 100644 index 000000000..64de5c0ce --- /dev/null +++ b/scribus/ui/contentpalette.cpp @@ -0,0 +1,339 @@ +#include "scribus.h" // ScribusMainWindow +#include "contentpalette.h" + +#include <QWidget> +#include <QStackedWidget> + +#include "appmodehelper.h" // for AppModeChanged (if needed) + +#include "propertiespalette_image.h" +#include "propertiespalette_text.h" +#include "selection.h" +#include "pageitem_textframe.h" +#include "pageitem_imageframe.h" +#include "pageitem_table.h" +#include "styles/paragraphstyle.h" +#include "styles/charstyle.h" + +ContentPalette::ContentPalette(QWidget* parent) : + ScDockPalette(parent, "ContentPalette", nullptr) +{ + setObjectName(QString::fromLocal8Bit("ContentPalette")); + + QFont f(font()); + f.setPointSize(f.pointSize()-1); + setFont(f); + + + stackedWidget = new QStackedWidget(this); + + auto emptyPal = new QWidget(); + stackedWidget->addWidget(emptyPal); + + textPal = new PropertiesPalette_Text(this); + stackedWidget->addWidget(textPal); + + imagePal = new PropertiesPalette_Image(this); + stackedWidget->addWidget(imagePal); + + setWidget(stackedWidget); + + stackedWidget->setCurrentIndex((int) Panel::empty); + + languageChange(); +} + +void ContentPalette::setMainWindow(ScribusMainWindow *mw) +{ + m_ScMW = mw; + + textPal->setMainWindow(mw); + imagePal->setMainWindow(mw); + + connect(m_ScMW->appModeHelper, &AppModeHelper::AppModeChanged, this, &ContentPalette::AppModeChanged); +} + +void ContentPalette::setDoc(ScribusDoc *doc) +{ + if((doc == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) + return; + + if (m_doc) + { + disconnect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + disconnect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + } + + m_doc = doc; + m_item = nullptr; + setEnabled(!m_doc->drawAsPreview); + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + m_haveDoc = true; + m_haveItem = false; + + textPal->setDoc(m_doc); + imagePal->setDoc(m_doc); + + updateColorList(); + + connect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + connect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + + // Handle properties update when switching document + handleSelectionChanged(); +} + +void ContentPalette::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + disconnect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + } + + setEnabled(true); + m_haveDoc = false; + m_haveItem = false; + m_doc=nullptr; + m_item = nullptr; + + textPal->unsetItem(); + textPal->unsetDoc(); + imagePal->unsetItem(); + imagePal->unsetDoc(); + + stackedWidget->setCurrentIndex((int) Panel::empty); +} + +void ContentPalette::unsetItem() +{ + m_haveItem = false; + m_item = nullptr; + + imagePal->unsetItem(); + textPal->unsetItem(); + + handleSelectionChanged(); +} + +PageItem* ContentPalette::currentItemFromSelection() +{ + if (m_doc && m_doc->m_Selection->count() > 0) + { + return m_doc->m_Selection->itemAt(0); + } + + return nullptr; +} + +void ContentPalette::AppModeChanged() +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if ((m_haveDoc) && (m_haveItem)) + { + if (m_item->isTable()) + { + textPal->setEnabled(m_doc->appMode == modeEditTable); + if (m_doc->appMode == modeEditTable) + { + connect(m_item->asTable(), &PageItem_Table::selectionChanged, this, &ContentPalette::handleSelectionChanged); + } + else + { + disconnect(m_item->asTable(), &PageItem_Table::selectionChanged, this, &ContentPalette::handleSelectionChanged); + } + } + textPal->handleSelectionChanged(); + } +} + +void ContentPalette::setCurrentItem(PageItem *item) +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if (!item) + { + unsetItem(); + return; + } + + if (!m_doc) + { + setDoc(item->doc()); + } + + m_haveItem = true; + m_item = item; + + // TODO: in PropertiesPalette there is a a funny if for the groups: take care of it when adding the group panel + + if (!sender() || (m_doc->appMode == modeEditTable)) + { + textPal->handleSelectionChanged(); + imagePal->handleSelectionChanged(); + } +} + +void ContentPalette::handleSelectionChanged() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + auto currentPanel = (Panel) stackedWidget->currentIndex(); + auto newPanel{currentPanel}; + + PageItem* currItem = currentItemFromSelection(); + + // TODO: should me move this to setCurrentIndex()? + if (!currItem) + { + newPanel = Panel::empty; + m_haveItem = false; + } else if (m_doc->m_Selection->count() > 1) + { + newPanel = Panel::empty; + } + else + { + m_haveItem = true; + + switch (currItem->itemType()) + { + case PageItem::ImageFrame: + newPanel = Panel::image; + break; + case PageItem::TextFrame: + case PageItem::PathText: + newPanel = Panel::text; + break; + case PageItem::Table: + newPanel = m_doc->appMode == modeEditTable ? Panel::text : Panel::empty; + break; + default: + newPanel = Panel::empty; + break; + } + setCurrentItem(currItem); + } + if (currentPanel != newPanel) + { + stackedWidget->setCurrentIndex((int) newPanel); + updatePanelTitle(); + } + updateGeometry(); + ScDockPalette::update(); +} + +void ContentPalette::unitChange() +{ + if (!m_haveDoc) + return; + + bool tmp = m_haveItem; + m_haveItem = false; + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + + textPal->unitChange(); + imagePal->unitChange(); + + m_haveItem = tmp; +} + +void ContentPalette::updateColorList() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + textPal->updateColorList(); + + assert (m_doc->PageColors.document()); +} + +bool ContentPalette::userActionOn() +{ + return imagePal->userActionOn(); +} + +void ContentPalette::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + return; + } + ScDockPalette::changeEvent(e); +} + +void ContentPalette::updatePanelTitle() +{ + switch ((Panel) stackedWidget->currentIndex()) + { + case Panel::empty: + setWindowTitle( tr("Content Properties")); + break; + case Panel::text: + setWindowTitle( tr("Text Properties")); + break; + case Panel::image: + setWindowTitle( tr("Image Properties")); + break; + } +} + +void ContentPalette::languageChange() +{ + updatePanelTitle(); + textPal->languageChange(); + imagePal->languageChange(); +} + +void ContentPalette::update(PageItem_ImageFrame* image) +{ + imagePal->showScaleAndOffset(image->imageXScale(), image->imageYScale(), image->imageXOffset(), image->imageYOffset()); +} + +void ContentPalette::update(const ParagraphStyle& style) +{ + textPal->updateStyle(style); +} + +void ContentPalette::update(const CharStyle& style) +{ + textPal->updateCharStyle(style); +} + +void ContentPalette::update(PageItem_TextFrame* text) +{ +} + +void ContentPalette::updateTextStyles() +{ + textPal->updateParagraphStyles(); +} + +void ContentPalette::updateTextAlignment(int i) +{ + textPal->showAlignment(i); +} + +void ContentPalette::updateTextDirection(int i) +{ + textPal->showDirection(i); +} + +void ContentPalette::updateTextFontSize(int i) +{ + textPal->showFontSize(i); +} + +void ContentPalette::updateTextLanguage(const QString& language) +{ + textPal->showLanguage(language); +} diff --git a/scribus/ui/contentpalette.h b/scribus/ui/contentpalette.h new file mode 100644 index 000000000..36854c68b --- /dev/null +++ b/scribus/ui/contentpalette.h @@ -0,0 +1,81 @@ +#ifndef CONTENTPALETTE_H +#define CONTENTPALETTE_H + +#include "scribusapi.h" +#include "scdockpalette.h" +#include "scguardedptr.h" + +class QStackedWidget; + +class ScribusMainWindow; +class ScribusDoc; +class PageItem; + +class PropertiesPalette_Text; +class PropertiesPalette_Image; +class PageItem_TextFrame; +class PageItem_ImageFrame; +class ParagraphStyle; +class CharStyle; + +class SCRIBUS_API ContentPalette : public ScDockPalette +{ + Q_OBJECT + + public: + ContentPalette(QWidget* parent); + ~ContentPalette() {} + + void updateColorList(); + bool userActionOn(); + virtual void changeEvent(QEvent *e) override; + void update(PageItem_ImageFrame* image); + void update(const ParagraphStyle& style); + void update(PageItem_TextFrame* image); + void updateTextStyles(); + void updateTextAlignment(int i); + void updateTextDirection(int i); + void updateTextFontSize(int i); + void updateTextLanguage(const QString& language); + + public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *doc); + void unsetDoc(); + void unsetItem(); + void AppModeChanged(); + void setCurrentItem(PageItem *i); + PageItem* currentItemFromSelection(); + void handleSelectionChanged(); + + void update(const CharStyle& style); + + void unitChange(); + void languageChange(); + + private: + ScribusMainWindow *m_ScMW{nullptr}; + ScGuardedPtr<ScribusDoc> m_doc{nullptr}; + PageItem* m_item; + + bool m_haveDoc{false}; + bool m_haveItem{false}; + double m_unitRatio{1.0}; + int m_unitIndex{0}; + + QStackedWidget* stackedWidget; + PropertiesPalette_Text* textPal; + PropertiesPalette_Image* imagePal; + + void updatePanelTitle(); + + // the order must match the insertion of the widgets in the constructor + enum class Panel { + empty, + text, + image + }; +}; + +#endif diff --git a/scribus/ui/contextmenu.cpp b/scribus/ui/contextmenu.cpp index 55b6d3cdf..f254ea50b 100644 --- a/scribus/ui/contextmenu.cpp +++ b/scribus/ui/contextmenu.cpp @@ -543,31 +543,11 @@ void ContextMenu::createMenuItems_Selection() } if (selectedItemCount == 2 && m_doc->appMode != modeEdit) addAction(m_ScMW->scrActions["itemWeld"]); -// { -// menuWeld->addAction(m_AP->scrActions["itemWeld17"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld71"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld13"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld31"]); -// QAction *act = addMenu(menuWeld); -// act->setText( tr("Weld to last...")); -// } - //--> //<-- Add Properties addSeparator(); + addAction(m_ScMW->scrActions["toolsContent"]); addAction(m_ScMW->scrActions["toolsProperties"]); - - bool containsTextFrame = false; - if (currItem->asTextFrame()) - containsTextFrame = true; - if (m_doc->appMode == modeEditTable) - containsTextFrame = true; - if (!containsTextFrame && m_Sel.containsItemType(PageItem::TextFrame)) - containsTextFrame = true; - if (containsTextFrame) - addAction(m_ScMW->scrActions["toolsText"]); - //--> - } void ContextMenu::createMenuItems_NoSelection(double mx, double my) diff --git a/scribus/ui/outlinepalette.cpp b/scribus/ui/outlinepalette.cpp index ecb16f9a1..a67ad6fe2 100644 --- a/scribus/ui/outlinepalette.cpp +++ b/scribus/ui/outlinepalette.cpp @@ -32,12 +32,12 @@ for which a new license (GPL+exception) is in place. #include "layers.h" #include "outlinepalette.h" #include "propertiespalette.h" +#include "contentpalette.h" #include "scpage.h" #include "scribus.h" #include "scribusdoc.h" #include "scribusview.h" #include "selection.h" -#include "textpalette.h" #include "undomanager.h" #include "units.h" #include "util.h" @@ -698,7 +698,7 @@ void OutlinePalette::slotDoRename(QTreeWidgetItem *ite , int col) { item->PageItemObject->setItemName(NameNew); m_MainWindow->propertiesPalette->setCurrentItem(item->PageItemObject); - m_MainWindow->textPalette->setCurrentItem(item->PageItemObject); + m_MainWindow->contentPalette->setCurrentItem(item->PageItemObject); currDoc->setModified(true); } } diff --git a/scribus/ui/propertiespalette.cpp b/scribus/ui/propertiespalette.cpp index 4d103dcd0..8d58326cb 100644 --- a/scribus/ui/propertiespalette.cpp +++ b/scribus/ui/propertiespalette.cpp @@ -42,7 +42,6 @@ for which a new license (GPL+exception) is in place. #include "dasheditor.h" #include "pageitem_table.h" #include "propertiespalette_group.h" -#include "propertiespalette_image.h" #include "propertiespalette_line.h" #include "propertiespalette_shadow.h" #include "propertiespalette_shape.h" @@ -89,9 +88,6 @@ PropertiesPalette::PropertiesPalette( QWidget* parent) : ScDockPalette( parent, groupPal = new PropertiesPalette_Group( this ); idGroupItem = TabStack->addItem(groupPal, "Groups"); - imagePal = new PropertiesPalette_Image(this); - idImageItem=TabStack->addItem( imagePal, "&Image" ); - linePal = new PropertiesPalette_Line(this); idLineItem=TabStack->addItem( linePal, "&Line" ); @@ -161,7 +157,6 @@ void PropertiesPalette::setMainWindow(ScribusMainWindow* mw) this->shadowPal->setMainWindow(mw); this->shapePal->setMainWindow(mw); this->groupPal->setMainWindow(mw); - this->imagePal->setMainWindow(mw); this->linePal->setMainWindow(mw); this->tablePal->setMainWindow(mw); @@ -232,7 +227,6 @@ void PropertiesPalette::setDoc(ScribusDoc *d) shadowPal->setDoc(m_doc); shapePal->setDoc(m_doc); groupPal->setDoc(m_doc); - imagePal->setDoc(m_doc); linePal->setDoc(m_doc); tablePal->setDocument(m_doc); @@ -266,8 +260,6 @@ void PropertiesPalette::unsetDoc() shapePal->unsetDoc(); groupPal->unsetItem(); groupPal->unsetDoc(); - imagePal->unsetItem(); - imagePal->unsetDoc(); linePal->unsetItem(); linePal->unsetDoc(); tablePal->unsetItem(); @@ -291,12 +283,10 @@ void PropertiesPalette::unsetItem() m_item = nullptr; Cpal->setCurrentItem(nullptr); Tpal->setCurrentItem(nullptr); - imagePal->unsetItem(); tablePal->unsetItem(); shapePal->unsetItem(); groupPal->unsetItem(); shadowPal->unsetItem(); - imagePal->unsetItem(); linePal->unsetItem(); handleSelectionChanged(); } @@ -311,29 +301,12 @@ void PropertiesPalette::setTextFlowMode(PageItem::TextFlowMode mode) PageItem* PropertiesPalette::currentItemFromSelection() { - PageItem *currentItem = nullptr; - - if (m_doc) + if (m_doc && m_doc->m_Selection->count() > 0) { - if (m_doc->m_Selection->count() > 0) - currentItem = m_doc->m_Selection->itemAt(0); - /* if (m_doc->m_Selection->count() > 1) - { - int lowestItem = 999999; - for (int a=0; a<m_doc->m_Selection->count(); ++a) - { - currentItem = m_doc->m_Selection->itemAt(a); - lowestItem = qMin(lowestItem, m_doc->Items->indexOf(currentItem)); - } - currentItem = m_doc->Items->at(lowestItem); - } - else if (m_doc->m_Selection->count() == 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } */ + return m_doc->m_Selection->itemAt(0); } - return currentItem; + return nullptr; } void PropertiesPalette::AppModeChanged() @@ -420,7 +393,6 @@ void PropertiesPalette::setCurrentItem(PageItem *i) shadowPal->handleSelectionChanged(); shapePal->handleSelectionChanged(); groupPal->handleSelectionChanged(); - imagePal->handleSelectionChanged(); linePal->handleSelectionChanged(); tablePal->handleSelectionChanged(); Cpal->handleSelectionChanged(); @@ -606,7 +578,6 @@ void PropertiesPalette::unitChange() shadowPal->unitChange(); shapePal->unitChange(); groupPal->unitChange(); - imagePal->unitChange(); linePal->unitChange(); Cpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); @@ -858,10 +829,7 @@ void PropertiesPalette::updateColorList() bool PropertiesPalette::userActionOn() { - bool userActionOn = false; - userActionOn = xyzPal->userActionOn(); - userActionOn |= imagePal->userActionOn(); - return userActionOn; + return xyzPal->userActionOn(); } void PropertiesPalette::changeEvent(QEvent *e) @@ -892,7 +860,6 @@ void PropertiesPalette::languageChange() shadowPal->languageChange(); shapePal->languageChange(); groupPal->languageChange(); - imagePal->languageChange(); Cpal->languageChange(); linePal->languageChange(); tablePal->languageChange(); diff --git a/scribus/ui/propertiespalette.h b/scribus/ui/propertiespalette.h index 0f1cb6eef..c46c392a6 100644 --- a/scribus/ui/propertiespalette.h +++ b/scribus/ui/propertiespalette.h @@ -34,7 +34,6 @@ class ColorCombo; class Cpalette; class NameWidget; class PropertiesPalette_Group; -class PropertiesPalette_Image; class PropertiesPalette_Line; class PropertiesPalette_Shadow; class PropertiesPalette_Shape; @@ -71,7 +70,6 @@ public: // commmited PropertiesPalette_Group* groupPal; - PropertiesPalette_Image* imagePal; PropertiesPalette_Line* linePal; PropertiesPalette_Shadow* shadowPal; PropertiesPalette_Shape* shapePal; diff --git a/scribus/ui/textpalette.cpp b/scribus/ui/textpalette.cpp deleted file mode 100644 index 734e21562..000000000 --- a/scribus/ui/textpalette.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* -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 "textpalette.h" - -#include <QCloseEvent> -#include <QComboBox> -#include <QEvent> -#include <QFocusEvent> -#include <QKeyEvent> -#include <QTransform> -#include <QObject> -#include <QPoint> -#include <QSpacerItem> -#include <QStackedWidget> -#include <QTimer> -#include <QToolBox> -#include <QToolTip> -#include <QVBoxLayout> -#include <QValidator> -#include <QWidget> - -#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) -#define _USE_MATH_DEFINES -#endif -#include <cmath> - -#include "appmodehelper.h" -#include "appmodes.h" -#include "pageitem_table.h" -#include "pageitem_textframe.h" -#include "propertiespalette_text.h" -#include "scribus.h" -#include "scribusdoc.h" -#include "selection.h" -#include "undomanager.h" - - -TextPalette::TextPalette( QWidget* parent) : ScDockPalette( parent, "TextPalette", nullptr) -{ - undoManager = UndoManager::instance(); - m_ScMW=nullptr; - m_doc=nullptr; - m_haveDoc = false; - m_haveItem = false; - m_unitRatio = 1.0; - - setObjectName(QString::fromLocal8Bit("TextPalette")); -/// setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - - QFont f(font()); - f.setPointSize(f.pointSize()-1); - setFont(f); - - textPal = new PropertiesPalette_Text( this ); - setWidget( textPal ); - - languageChange(); - - m_haveItem = false; -} - -void TextPalette::closeEvent(QCloseEvent *closeEvent) -{ - ScDockPalette::closeEvent(closeEvent); -} - -void TextPalette::setMainWindow(ScribusMainWindow* mw) -{ - m_ScMW = mw; - - // For some reason, the mapToGlobal() / mapFromGlobal() roundtrip - // performed below does not give always good results, causing TP to - // not display in some situations. Moreover the reparenting is useless - // as TP is already created with ScribusMainWindow as parent. - /*QPoint p1 = mapToGlobal(pos()); - QPoint p2 = m_ScMW->mapFromGlobal(p1); - setParent(m_ScMW); - move(p2);*/ - - this->textPal->setMainWindow(mw); - - connect(m_ScMW->appModeHelper, SIGNAL(AppModeChanged(int,int)), this, SLOT(AppModeChanged())); -} - - -void TextPalette::setDoc(ScribusDoc *d) -{ - if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) - return; - - if (m_doc) - { - disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - } - - m_doc = d; - m_item = nullptr; - setEnabled(!m_doc->drawAsPreview); - - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); -//qt4 FIXME here - m_haveDoc = true; - m_haveItem = false; - - textPal->setDoc(m_doc); - - updateColorList(); - - connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - - // Handle properties update when switching document - handleSelectionChanged(); -} - -void TextPalette::unsetDoc() -{ - if (m_doc) - { - disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - } - setEnabled(true); - m_haveDoc = false; - m_haveItem = false; - m_doc=nullptr; - m_item = nullptr; - - textPal->unsetItem(); - textPal->unsetDoc(); - - m_haveItem = false; -} - -void TextPalette::unsetItem() -{ - m_haveItem = false; - m_item = nullptr; - textPal->unsetItem(); - handleSelectionChanged(); -} - -PageItem* TextPalette::currentItemFromSelection() -{ - PageItem *currentItem = nullptr; - - if (m_doc) - { - if (m_doc->m_Selection->count() > 0) - currentItem = m_doc->m_Selection->itemAt(0); - /* if (m_doc->m_Selection->count() > 1) - { - int lowestItem = 999999; - for (int a=0; a<m_doc->m_Selection->count(); ++a) - { - currentItem = m_doc->m_Selection->itemAt(a); - lowestItem = qMin(lowestItem, m_doc->Items->indexOf(currentItem)); - } - currentItem = m_doc->Items->at(lowestItem); - } - else if (m_doc->m_Selection->count() == 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } */ - } - - return currentItem; -} - -void TextPalette::AppModeChanged() -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - if (m_item->isTable()) - { - textPal->setEnabled(m_doc->appMode == modeEditTable); - if (m_doc->appMode == modeEditTable) - connect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - else - disconnect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - } - textPal->handleSelectionChanged(); - } -} - -void TextPalette::setCurrentItem(PageItem *i) -{ - 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 (!i) - { - unsetItem(); - return; - } - - if (!m_doc) - setDoc(i->doc()); - - m_haveItem = false; - m_item = i; - - if ((m_item->isGroup()) && (!m_item->isSingleSel)) - textPal->setEnabled(false); - - m_haveItem = true; - - if (!sender() || (m_doc->appMode == modeEditTable)) - { - textPal->handleSelectionChanged(); - } - - if (m_item->asOSGFrame()) - { - textPal->setEnabled(false); - } - if (m_item->asSymbolFrame()) - { - textPal->setEnabled(false); - } -} - -void TextPalette::handleSelectionChanged() -{ - if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - - PageItem* currItem = currentItemFromSelection(); - if (m_doc->m_Selection->count() > 1) - { - textPal->setEnabled(false); - } - else - { - int itemType = currItem ? (int) currItem->itemType() : -1; - m_haveItem = (itemType != -1); - - switch (itemType) - { - case -1: - m_haveItem = false; - textPal->setEnabled(false); - break; - case PageItem::ImageFrame: - case PageItem::LatexFrame: - case PageItem::OSGFrame: - textPal->setEnabled(false); - break; - case PageItem::TextFrame: - textPal->setEnabled(true); - break; - case PageItem::Line: - textPal->setEnabled(false); - break; - case PageItem::ItemType1: - case PageItem::ItemType3: - case PageItem::Polygon: - case PageItem::RegularPolygon: - case PageItem::Arc: - textPal->setEnabled(false); - break; - case PageItem::PolyLine: - case PageItem::Spiral: - textPal->setEnabled(false); - break; - case PageItem::PathText: - textPal->setEnabled(true); - break; - case PageItem::Symbol: - case PageItem::Group: - textPal->setEnabled(false); - break; - case PageItem::Table: - textPal->setEnabled(m_doc->appMode == modeEditTable); - break; - } - } - - updateGeometry(); - update(); - - if (currItem) - setCurrentItem(currItem); -} - -void TextPalette::unitChange() -{ - if (!m_haveDoc) - return; - bool tmp = m_haveItem; - m_haveItem = false; - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); - - textPal->unitChange(); - m_haveItem = tmp; -} - -void TextPalette::NewLineMode(int mode) -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - updateGeometry(); - repaint(); -} - -void TextPalette::updateColorList() -{ - if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - - textPal->updateColorList(); - - assert (m_doc->PageColors.document()); -} - -bool TextPalette::userActionOn() -{ - bool userActionOn = false; - return userActionOn; -} - -void TextPalette::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) - { - languageChange(); - return; - } - ScDockPalette::changeEvent(e); -} - -void TextPalette::languageChange() -{ - setWindowTitle( tr("Text Properties")); - textPal->languageChange(); -} - - diff --git a/scribus/ui/textpalette.h b/scribus/ui/textpalette.h deleted file mode 100644 index 1e8705e13..000000000 --- a/scribus/ui/textpalette.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -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 TEXTPALETTE_H -#define TEXTPALETTE_H - -#include <QListWidgetItem> -#include <QLineEdit> - -class QCloseEvent; -class QEvent; -class QFocusEvent; -class QToolBox; -class QVBoxLayout; -class QWidget; - - -#include "pageitem.h" -#include "scdockpalette.h" -#include "scribusapi.h" - -class PropertiesPalette_Text; -class ScribusDoc; -class ScribusMainWindow; -class UndoManager; - -class SCRIBUS_API TextPalette : public ScDockPalette -{ - Q_OBJECT - -public: - TextPalette(QWidget* parent); - ~TextPalette() {} - - virtual void changeEvent(QEvent *e); - virtual void closeEvent(QCloseEvent *closeEvent); - - void updateColorList(); - void endPatchAdd(); - - /** @brief Returns true if there is a user action going on at the moment of call. */ - bool userActionOn(); // not yet implemented!!! This is needed badly. - // When user releases the mouse button or arrow key, changes must be checked - // and if in ScribusView a groupTransaction has been started it must be also - // commmited - - PropertiesPalette_Text* textPal; - -private: - - PageItem* currentItemFromSelection(); - -public slots: - void setMainWindow(ScribusMainWindow *mw); - - void setDoc(ScribusDoc *d); - void AppModeChanged(); - void setCurrentItem(PageItem *i); - void unsetDoc(); - void unsetItem(); - - void handleSelectionChanged(); - - void unitChange(); - void languageChange(); - -private slots: - void NewLineMode(int mode); - - -protected: - ScribusMainWindow *m_ScMW; - - bool m_haveDoc; - bool m_haveItem; - double m_unitRatio; - int m_unitIndex; - PageItem* m_item; - UndoManager *undoManager; - - ScGuardedPtr<ScribusDoc> m_doc; - - int idTextItem; -}; - -#endif |
|
new version of the patch, fixing a forgotten reference to the image tab in the properties palette content-palette-2.diff (61,843 bytes)
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt index c21ab4927..18ca3bfab 100644 --- a/scribus/CMakeLists.txt +++ b/scribus/CMakeLists.txt @@ -340,6 +340,7 @@ set(SCRIBUS_MOC_CLASSES ui/colorlistbox.h ui/colorlistmodel.h ui/colorsandfills.h + ui/contentpalette.h ui/contextmenu.h ui/cpalette.h ui/cupsoptions.h @@ -547,7 +548,6 @@ set(SCRIBUS_MOC_CLASSES ui/tabmanager.h ui/tabpdfoptions.h ui/tabruler.h - ui/textpalette.h ui/transformdialog.h ui/transparencypalette.h tt/simpletreemodel/treemodel.h @@ -841,6 +841,7 @@ set(SCRIBUS_SOURCES ui/colorlistbox.cpp ui/colorlistmodel.cpp ui/colorsandfills.cpp + ui/contentpalette.cpp ui/contextmenu.cpp ui/cpalette.cpp ui/cupsoptions.cpp @@ -1047,7 +1048,6 @@ set(SCRIBUS_SOURCES ui/tabmanager.cpp ui/tabpdfoptions.cpp ui/tabruler.cpp - ui/textpalette.cpp ui/transformdialog.cpp ui/transparencypalette.cpp tt/simpletreemodel/treeitem.cpp diff --git a/scribus/actionmanager.cpp b/scribus/actionmanager.cpp index 9aec32c26..067ca92a6 100644 --- a/scribus/actionmanager.cpp +++ b/scribus/actionmanager.cpp @@ -794,7 +794,7 @@ void ActionManager::initToolsMenuActions() //Tool menu name="toolsProperties"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); - name="toolsText"; + name="toolsContent"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="toolsOutline"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); @@ -902,7 +902,7 @@ void ActionManager::initToolsMenuActions() #endif //Set the applicaton wide palette shortcuts (*scrActions)["toolsProperties"]->setShortcutContext(Qt::ApplicationShortcut); - (*scrActions)["toolsText"]->setShortcutContext(Qt::ApplicationShortcut); + (*scrActions)["toolsContent"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsScrapbook"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsLayers"]->setShortcutContext(Qt::ApplicationShortcut); (*scrActions)["toolsPages"]->setShortcutContext(Qt::ApplicationShortcut); @@ -916,7 +916,7 @@ void ActionManager::initToolsMenuActions() (*scrActions)["toolsProperties"]->setToggleAction(true); - (*scrActions)["toolsText"]->setToggleAction(true); + (*scrActions)["toolsContent"]->setToggleAction(true); (*scrActions)["toolsOutline"]->setToggleAction(true); (*scrActions)["toolsScrapbook"]->setToggleAction(true); (*scrActions)["toolsLayers"]->setToggleAction(true); @@ -1681,7 +1681,7 @@ void ActionManager::languageChange() //Tool menu (*scrActions)["toolsProperties"]->setTexts( tr("&Properties")); - (*scrActions)["toolsText"]->setTexts( tr("Text Properties")); + (*scrActions)["toolsContent"]->setTexts( tr("&Content Properties")); (*scrActions)["toolsOutline"]->setTexts( tr("&Outline", "Document Outline Palette")); (*scrActions)["toolsScrapbook"]->setTexts( tr("&Scrapbook")); (*scrActions)["toolsLayers"]->setTexts( tr("&Layers")); @@ -1948,7 +1948,7 @@ void ActionManager::createDefaultShortcuts() //Tool menu defKeys.insert("toolsProperties", Qt::Key_F2); - defKeys.insert("toolsText", Qt::Key_F3); + defKeys.insert("toolsContent", Qt::Key_F3); defKeys.insert("toolsLayers", Qt::Key_F6); //toolbar only items @@ -2354,7 +2354,7 @@ void ActionManager::createDefaultMenus() << "windowsCascade" << "windowsTile" << "toolsProperties" - << "toolsText" + << "toolsContent" << "toolsOutline" << "toolsScrapbook" << "toolsLayers" diff --git a/scribus/canvasmode_imageimport.cpp b/scribus/canvasmode_imageimport.cpp index a0a1ceda5..c1c165ccf 100644 --- a/scribus/canvasmode_imageimport.cpp +++ b/scribus/canvasmode_imageimport.cpp @@ -35,8 +35,7 @@ #include "scribusdoc.h" #include "scribusview.h" #include "selection.h" -#include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" +#include "ui/contentpalette.h" CanvasMode_ImageImport::CanvasMode_ImageImport(ScribusView *view) : CanvasMode(view), m_ScMW(view->m_ScMW) { @@ -238,7 +237,7 @@ void CanvasMode_ImageImport::setImage(PageItem *currItem) m_doc->loadPict(fileName, currItem, false, true); // Call to showScaleAndOffset() is now very likely unnecessary // due to mecanisms used to update properties in PP in 1.5.x+ - //m_ScMW->propertiesPalette->imagePal->showScaleAndOffset(currItem->imageXScale(), currItem->imageYScale(), currItem->imageXOffset(), currItem->imageYOffset()); + // m_ScMW->contentPalette->update(currItem->asImageFrame()); m_ScMW->repaint(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); m_view->DrawNew(); diff --git a/scribus/canvasmode_normal.cpp b/scribus/canvasmode_normal.cpp index 8eabfd951..55b1ce4bc 100644 --- a/scribus/canvasmode_normal.cpp +++ b/scribus/canvasmode_normal.cpp @@ -46,7 +46,6 @@ #include "pageitem_arc.h" #include "pageitem_line.h" #include "pageitem_regularpolygon.h" -#include "pageitem_textframe.h" #include "plugins/formatidlist.h" #include "prefscontext.h" #include "prefsfile.h" @@ -1175,7 +1174,6 @@ void CanvasMode_Normal::mouseReleaseEvent(QMouseEvent *m) m_doc->m_Selection->delaySignalsOn(); // loop over all items and select bool altPressed = m->modifiers() & Qt::AltModifier; - bool shiftPressed = m->modifiers() & Qt::ShiftModifier; for (int a = 0; a < docItemCount; ++a) { diff --git a/scribus/gtaction.cpp b/scribus/gtaction.cpp index 8290da91d..5c3c511c7 100644 --- a/scribus/gtaction.cpp +++ b/scribus/gtaction.cpp @@ -50,8 +50,7 @@ for which a new license (GPL+exception) is in place. #include "undomanager.h" #include "util.h" #include "util_text.h" -#include "ui/textpalette.h" -#include "ui/propertiespalette_text.h" +#include "ui/contentpalette.h" #include "ui/missing.h" @@ -555,7 +554,7 @@ void gtAction::createParagraphStyle(gtParagraphStyle* pstyle) tmp.create(vg); m_textFrame->doc()->redefineStyles(tmp, false); - m_ScMW->textPalette->textPal->updateParagraphStyles(); + m_ScMW->contentPalette->updateTextStyles(); } void gtAction:: setCharStyleAttributes(gtFont *font, CharStyle& style) @@ -872,7 +871,7 @@ QString gtAction::parseColor(const QString &s) ScColor tmp; tmp.fromQColor(c); m_textFrame->doc()->PageColors.insert("FromGetText"+c.name(), tmp); - m_ScMW->textPalette->updateColorList(); + m_ScMW->contentPalette->updateColorList(); ret = "FromGetText"+c.name(); } } diff --git a/scribus/pageitem.cpp b/scribus/pageitem.cpp index 74aa708dc..2c46e6e91 100644 --- a/scribus/pageitem.cpp +++ b/scribus/pageitem.cpp @@ -75,7 +75,7 @@ for which a new license (GPL+exception) is in place. #include "text/storytext.h" #include "ui/guidemanager.h" #include "ui/propertiespalette.h" -#include "ui/textpalette.h" +#include "ui/contentpalette.h" #include "undomanager.h" #include "undostate.h" #include "units.h" @@ -9443,7 +9443,7 @@ bool PageItem::loadImage(const QString& filename, const bool reload, const int g efVal += pixm.imgInfo.duotoneColors[cc].Name+"\n"; } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); struct ImageEffect ef; if (pixm.imgInfo.duotoneColors.count() == 1) { diff --git a/scribus/plugins/colorwheel/cwdialog.cpp b/scribus/plugins/colorwheel/cwdialog.cpp index f8644be9d..60b995fe7 100644 --- a/scribus/plugins/colorwheel/cwdialog.cpp +++ b/scribus/plugins/colorwheel/cwdialog.cpp @@ -19,7 +19,7 @@ for which a new license (GPL+exception) is in place. #include "ui/cmykfw.h" #include "ui/colorlistbox.h" #include "ui/propertiespalette.h" -#include "ui/textpalette.h" +#include "ui/contentpalette.h" #include "util_color.h" @@ -343,7 +343,7 @@ void CWDialog::addButton_clicked() return; } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); accept(); } @@ -354,7 +354,7 @@ void CWDialog::replaceButton_clicked() m_Doc->PageColors[it.key()] = it.value(); } m_Doc->scMW()->propertiesPalette->updateColorList(); - m_Doc->scMW()->textPalette->updateColorList(); + m_Doc->scMW()->contentPalette->updateColorList(); accept(); } diff --git a/scribus/plugins/scripter/api_imageitem.cpp b/scribus/plugins/scripter/api_imageitem.cpp index 8d5be1a65..222cae440 100644 --- a/scribus/plugins/scripter/api_imageitem.cpp +++ b/scribus/plugins/scripter/api_imageitem.cpp @@ -10,8 +10,6 @@ for which a new license (GPL+exception) is in place. #include "undomanager.h" #include "sctextstream.h" #include "scribusview.h" -#include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" ImageAPI::ImageAPI(PageItem_ImageFrame* im) : ItemAPI(im) { @@ -205,7 +203,7 @@ void ImageAPI::scaleToFrame(bool scaleToFrame, bool proportional) // Force the braindead app to notice the changes //FIXME emit or something so we dont need this - ScCore->primaryMainWindow()->propertiesPalette->imagePal->showScaleAndOffset(item->imageXScale(), item->imageYScale(), item->imageXOffset(), item->imageYOffset()); + ScCore->primaryMainWindow()->contentPalette->update(item->asImageFrame()); item->adjustPictScale(); //ScCore->primaryMainWindow()->view->adjustPictScale(item); diff --git a/scribus/plugins/scripter/api_page.cpp b/scribus/plugins/scripter/api_page.cpp index ef32e967b..92e596608 100644 --- a/scribus/plugins/scripter/api_page.cpp +++ b/scribus/plugins/scripter/api_page.cpp @@ -12,7 +12,6 @@ for which a new license (GPL+exception) is in place. #include "../formatidlist.h" #include "loadsaveplugin.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_text.h" #include "ui/propertiespalette_line.h" #include "ui/textpalette.h" #include "scribuscore.h" diff --git a/scribus/plugins/scriptplugin/cmdmani.cpp b/scribus/plugins/scriptplugin/cmdmani.cpp index 03b7b3e0f..4220ca64b 100644 --- a/scribus/plugins/scriptplugin/cmdmani.cpp +++ b/scribus/plugins/scriptplugin/cmdmani.cpp @@ -11,8 +11,6 @@ for which a new license (GPL+exception) is in place. #include "scribusview.h" #include "sctextstream.h" #include "selection.h" -#include "ui/propertiespalette.h" //CB argh.. noooooooooooooooooooooooooooooooooooo FIXME see other FIXME -#include "ui/propertiespalette_image.h" #include "undomanager.h" diff --git a/scribus/plugins/scriptplugin/scriptercore.cpp b/scribus/plugins/scriptplugin/scriptercore.cpp index c9c8672cc..6b0dc09a8 100644 --- a/scribus/plugins/scriptplugin/scriptercore.cpp +++ b/scribus/plugins/scriptplugin/scriptercore.cpp @@ -22,12 +22,12 @@ for which a new license (GPL+exception) is in place. #include "ui/marksmanager.h" #include "ui/notesstyleseditor.h" #include "ui/propertiespalette.h" //TODO Move the calls to this to a signal +#include "ui/contentpalette.h" //TODO Move the calls to this to a signal #include "ui/pagepalette.h" //TODO Move the calls to this to a signal #include "ui/layers.h" //TODO Move the calls to this to a signal #include "ui/outlinepalette.h" //TODO Move the calls to this to a signal #include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" -#include "ui/textpalette.h" #include "pconsole.h" #include "scraction.h" #include "scribuscore.h" @@ -162,7 +162,7 @@ void ScripterCore::FinishScriptRun() if (ScMW->HaveDoc) { ScMW->propertiesPalette->setDoc(ScMW->doc); - ScMW->textPalette->setDoc(ScMW->doc); + ScMW->contentPalette->setDoc(ScMW->doc); ScMW->marksManager->setDoc(ScMW->doc); ScMW->nsEditor->setDoc(ScMW->doc); ScMW->layerPalette->setDoc(ScMW->doc); @@ -249,7 +249,7 @@ void ScripterCore::slotRunScriptFile(const QString& fileName, QStringList argume if (!inMainInterpreter) { ScCore->primaryMainWindow()->propertiesPalette->unsetDoc(); - ScCore->primaryMainWindow()->textPalette->unsetDoc(); + ScCore->primaryMainWindow()->contentPalette->unsetDoc(); ScCore->primaryMainWindow()->pagePalette->setView(nullptr); ScCore->primaryMainWindow()->setScriptRunning(true); qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -394,7 +394,7 @@ void ScripterCore::slotRunScript(const QString& Script) disableMainWindowMenu(); ScCore->primaryMainWindow()->propertiesPalette->unsetDoc(); - ScCore->primaryMainWindow()->textPalette->unsetDoc(); + ScCore->primaryMainWindow()->contentPalette->unsetDoc(); ScCore->primaryMainWindow()->pagePalette->setView(nullptr); ScCore->primaryMainWindow()->setScriptRunning(true); inValue = Script; diff --git a/scribus/plugins/scriptplugin/svgimport.cpp b/scribus/plugins/scriptplugin/svgimport.cpp index 58e39520a..282dd0f25 100644 --- a/scribus/plugins/scriptplugin/svgimport.cpp +++ b/scribus/plugins/scriptplugin/svgimport.cpp @@ -18,7 +18,6 @@ for which a new license (GPL+exception) is in place. #include "selection.h" #include "ui/propertiespalette.h" #include "ui/propertiespalette_line.h" -#include "ui/propertiespalette_text.h" #include <QString> diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index 88ee08354..234304224 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -221,11 +221,10 @@ for which a new license (GPL+exception) is in place. #include "ui/preferencesdialog.h" #include "ui/preview.h" #include "ui/printdialog.h" +#include "ui/contentpalette.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" #include "ui/propertiespalette_line.h" #include "ui/propertiespalette_shape.h" -#include "ui/propertiespalette_text.h" #include "ui/propertiespalette_xyz.h" #include "ui/query.h" #include "ui/recoverdialog.h" @@ -248,7 +247,6 @@ for which a new license (GPL+exception) is in place. #include "ui/stylemanager.h" #include "ui/symbolpalette.h" #include "ui/tabmanager.h" -#include "ui/textpalette.h" #include "ui/transformdialog.h" #include "ui/transparencypalette.h" #include "ui/viewtoolbar.h" @@ -423,7 +421,7 @@ int ScribusMainWindow::initScMW(bool primaryMainWindow) ToggleTips(); ToggleMouseTips(); propertiesPalette->setFontSize(); - textPalette->setFontSize(); + contentPalette->setFontSize(); if (scrActions["SaveAsDocumentTemplate"]) scrActions["SaveAsDocumentTemplate"]->setEnabled(false); @@ -612,12 +610,12 @@ void ScribusMainWindow::initPalettes() emit UpdateRequest(reqDefFontListUpdate); propertiesPalette->installEventFilter(this); - textPalette = new TextPalette(this); - textPalette->setMainWindow(this); - connect( scrActions["toolsText"], SIGNAL(toggled(bool)) , textPalette, SLOT(setPaletteShown(bool))); - connect( textPalette, SIGNAL(paletteShown(bool)), scrActions["toolsText"], SLOT(setChecked(bool))); - emit UpdateRequest(reqDefFontListUpdate); - textPalette->installEventFilter(this); + contentPalette = new ContentPalette(this); + contentPalette->setMainWindow(this); + connect( scrActions["toolsContent"], &QAction::toggled, contentPalette, &ContentPalette::setPaletteShown); + connect( contentPalette, &ContentPalette::paletteShown, scrActions["toolsContent"], &QAction::setChecked); + contentPalette->installEventFilter(this); + nodePalette = new NodePalette(this); nodePalette->installEventFilter(this); layerPalette = new LayerPalette(this); @@ -1202,8 +1200,8 @@ void ScribusMainWindow::addDefaultWindowMenuItems() scrMenuMgr->addMenuItemString("windowsCascade", "Windows"); scrMenuMgr->addMenuItemString("windowsTile", "Windows"); scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); + scrMenuMgr->addMenuItemString("toolsContent", "Windows"); scrMenuMgr->addMenuItemString("toolsProperties", "Windows"); - scrMenuMgr->addMenuItemString("toolsText", "Windows"); scrMenuMgr->addMenuItemString("toolsActionHistory", "Windows"); scrMenuMgr->addMenuItemString("toolsAlignDistribute", "Windows"); scrMenuMgr->addMenuItemString("SEPARATOR", "Windows"); @@ -1455,7 +1453,7 @@ void ScribusMainWindow::setStatusBarInfoText(const QString & newText) } -//AV to be replaced with Selection::update and listener in textPalette +//AV to be replaced with Selection::update and listener in contentPalette void ScribusMainWindow::setTBvals(PageItem *currItem) { scrActions["editMark"]->setEnabled(false); @@ -1486,7 +1484,7 @@ void ScribusMainWindow::setTBvals(PageItem *currItem) doc->currentStyle.charStyle().setStyle(item->currentCharStyle()); emit TextStyle(doc->currentStyle); // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); //check if mark in cursor place and enable editMark action if (doc->appMode == modeEdit && item->itemText.cursorPosition() < item->itemText.length()) { @@ -1985,7 +1983,7 @@ void ScribusMainWindow::closeEvent(QCloseEvent *ce) } propertiesPalette->hide(); - textPalette->hide(); + contentPalette->hide(); outlinePalette->hide(); scrapbookPalette->hide(); bookmarkPalette->hide(); @@ -2663,7 +2661,7 @@ void ScribusMainWindow::SwitchWin() { updateActiveWindowCaption(doc->DocName); propertiesPalette->setDoc(doc); - textPalette->setDoc(doc); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); pagePalette->setView(view); @@ -2705,7 +2703,7 @@ void ScribusMainWindow::HaveNewDoc() //Update palettes updateActiveWindowCaption(doc->DocName); propertiesPalette->setDoc(doc); - textPalette->setDoc(doc); + contentPalette->setDoc(doc); nsEditor->setDoc(doc); marksManager->setDoc(doc); @@ -2740,7 +2738,7 @@ void ScribusMainWindow::HaveNewDoc() connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()), Qt::UniqueConnection); connect(view, SIGNAL(DocChanged()), this, SLOT(slotDocCh()), Qt::UniqueConnection); connect(view, SIGNAL(MousePos(double,double)), this, SLOT(setStatusBarMousePosition(double,double)), Qt::UniqueConnection); - connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), textPalette->textPal, SLOT(updateCharStyle(const CharStyle&)), Qt::UniqueConnection); + connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), contentPalette, SLOT(update(const CharStyle&)), Qt::UniqueConnection); connect(view, SIGNAL(ItemTextEffects(int)), this, SLOT(setStyleEffects(int)), Qt::UniqueConnection); connect(view, SIGNAL(ItemTextAlign(int)), this, SLOT(setAlignmentValue(int)), Qt::UniqueConnection); connect(view, SIGNAL(HasTextSel()), this, SLOT(EnableTxEdit()), Qt::UniqueConnection); @@ -2807,8 +2805,7 @@ void ScribusMainWindow::HaveNewSel() doc->currentStyle.setContext(curStyle.context()); doc->currentStyle = curStyle; emit TextStyle(doc->currentStyle); - // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); setStyleEffects(doc->currentStyle.charStyle().effects()); } break; @@ -2829,11 +2826,9 @@ void ScribusMainWindow::HaveNewSel() const ParagraphStyle& curStyle = currItem->itemText.defaultStyle(); doc->currentStyle.setContext(curStyle.context()); doc->currentStyle = curStyle; - textPalette->textPal->showParStyle(doc->currentStyle.parent()); - textPalette->textPal->showCharStyle(doc->currentStyle.charStyle().parent()); emit TextStyle(doc->currentStyle); // to go: (av) - textPalette->textPal->updateStyle(doc->currentStyle); + contentPalette->update(doc->currentStyle); setStyleEffects(doc->currentStyle.charStyle().effects()); } break; @@ -3423,7 +3418,7 @@ bool ScribusMainWindow::loadPage(const QString& fileName, int Nr, bool Mpa, cons AddBookMark(ite); } propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); slotDocCh(); @@ -3962,7 +3957,7 @@ void ScribusMainWindow::slotGetContent() if (outlinePalette->isVisible()) outlinePalette->BuildTree(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); } @@ -3978,7 +3973,7 @@ void ScribusMainWindow::updateFromDrop() if (outlinePalette->isVisible()) outlinePalette->BuildTree(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqArrowStylesUpdate | reqLineStylesUpdate | reqStyleComboDocUpdate | reqInlinePalUpdate); symbolPalette->updateSymbolList(); } @@ -4316,7 +4311,7 @@ bool ScribusMainWindow::DoFileClose() doc->CloseCMSProfiles(); //<<Palettes propertiesPalette->unsetDoc(); - textPalette->unsetDoc(); + contentPalette->unsetDoc(); inlinePalette->unsetDoc(); symbolPalette->unsetDoc(); pagePalette->setView(nullptr); @@ -4803,8 +4798,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -4884,8 +4879,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -4975,8 +4970,8 @@ void ScribusMainWindow::slotEditPaste() m_styleManager->setDoc(doc); propertiesPalette->unsetDoc(); propertiesPalette->setDoc(doc); - textPalette->unsetDoc(); - textPalette->setDoc(doc); + contentPalette->unsetDoc(); + contentPalette->setDoc(doc); marksManager->setDoc(doc); nsEditor->setDoc(doc); symbolPalette->unsetDoc(); @@ -5577,8 +5572,8 @@ void ScribusMainWindow::ToggleAllPalettes() m_palettesStatus[PAL_ALL] = false; if (m_palettesStatus[PAL_PROPERTIES]) propertiesPalette->show(); - if (m_palettesStatus[PAL_TEXT]) - textPalette->show(); + if (m_palettesStatus[PAL_CONTENT]) + contentPalette->show(); if (m_palettesStatus[PAL_OUTLINE]) outlinePalette->show(); if (m_palettesStatus[PAL_SCRAPBOOK]) @@ -5598,7 +5593,7 @@ void ScribusMainWindow::ToggleAllPalettes() else { m_palettesStatus[PAL_PROPERTIES] = propertiesPalette->isVisible(); - m_palettesStatus[PAL_TEXT] = textPalette->isVisible(); + m_palettesStatus[PAL_CONTENT] = contentPalette->isVisible(); m_palettesStatus[PAL_OUTLINE] = outlinePalette->isVisible(); m_palettesStatus[PAL_SCRAPBOOK] = scrapbookPalette->isVisible(); m_palettesStatus[PAL_LAYER] = layerPalette->isVisible(); @@ -5608,7 +5603,7 @@ void ScribusMainWindow::ToggleAllPalettes() m_palettesStatus[PAL_VERIFIER] = docCheckerPalette->isVisible(); m_palettesStatus[PAL_DOWNLOADS] = downloadsPalette->isVisible(); propertiesPalette->hide(); - textPalette->hide(); + contentPalette->hide(); outlinePalette->hide(); scrapbookPalette->hide(); bookmarkPalette->hide(); @@ -6323,7 +6318,7 @@ void ScribusMainWindow::setItemFontSize(int fontSize) doc->itemSelection_SetFontSize(fs*10); } } - textPalette->textPal->showFontSize(fs*10); + contentPalette->updateTextFontSize(fs*10); } void ScribusMainWindow::setItemLanguage(const QString& language) @@ -6332,7 +6327,7 @@ void ScribusMainWindow::setItemLanguage(const QString& language) if (dia.exec()) doc->itemSelection_SetLanguage(language); - textPalette->textPal->showLanguage(language); + contentPalette->updateTextLanguage(language); } //CB-->Doc @@ -6341,7 +6336,7 @@ void ScribusMainWindow::setNewAlignment(int i) if (!HaveDoc) return; doc->itemSelection_SetAlignment(i); - textPalette->textPal->showAlignment(i); + contentPalette->updateTextAlignment(i); PageItem *currItem = doc->m_Selection->itemAt(0); setTBvals(currItem); } @@ -6351,7 +6346,7 @@ void ScribusMainWindow::setNewDirection(int i) if (!HaveDoc) return; doc->itemSelection_SetDirection(i); - textPalette->textPal->showDirection(i); + contentPalette->updateTextDirection(i); PageItem *currItem = doc->m_Selection->itemAt(0); setTBvals(currItem); } @@ -6376,7 +6371,7 @@ void ScribusMainWindow::setNewCharStyle(const QString& name) void ScribusMainWindow::setAlignmentValue(int i) { - textPalette->textPal->showAlignment(i); + contentPalette->updateTextAlignment(i); QString alignment[] = {"Left", "Center", "Right", "Block", "Forced"}; for (int j=0; j<5; ++j) { @@ -6388,7 +6383,7 @@ void ScribusMainWindow::setAlignmentValue(int i) void ScribusMainWindow::setDirectionValue(int i) { - textPalette->textPal->showDirection(i); + contentPalette->updateTextDirection(i); QString direction[] = {"Left", "Right"}; for (int j=0; j<2; ++j) { @@ -6794,7 +6789,7 @@ void ScribusMainWindow::slotDocSetup() int ScribusMainWindow::ShowSubs() { propertiesPalette->startup(); - textPalette->startup(); + contentPalette->startup(); outlinePalette->startup(); scrapbookPalette->startup(); bookmarkPalette->startup(); @@ -7503,7 +7498,7 @@ void ScribusMainWindow::slotChangeUnit(int unitIndex, bool draw) setCurrentComboItem(unitSwitcher, unitGetStrFromIndex(doc->unitIndex())); view->unitChange(); propertiesPalette->unitChange(); - textPalette->unitChange(); + contentPalette->unitChange(); nodePalette->unitChange(); alignDistributePalette->unitChange(); guidePalette->setupPage(); @@ -7604,7 +7599,7 @@ void ScribusMainWindow::editSymbolEnd() view->DrawNew(); pagePalette->Rebuild(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->editingFinished(); layerPalette->setEnabled(true); if (outlinePalette->isVisible()) @@ -7673,8 +7668,8 @@ void ScribusMainWindow::editInlineEnd() pagePalette->Rebuild(); propertiesPalette->unsetItem(); propertiesPalette->updateColorList(); - textPalette->unsetItem(); - textPalette->updateColorList(); + contentPalette->unsetItem(); + contentPalette->updateColorList(); inlinePalette->editingFinished(); layerPalette->setEnabled(true); if (outlinePalette->isVisible()) @@ -8136,7 +8131,7 @@ void ScribusMainWindow::recalcColors() return; doc->recalculateColors(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); } void ScribusMainWindow::ModifyAnnot() @@ -8911,7 +8906,7 @@ void ScribusMainWindow::slotEditPasteContents(int absolute) qApp->processEvents(QEventLoop::ExcludeUserInputEvents); view->DrawNew(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); emit UpdateRequest(reqCmsOptionsUpdate); currItem->emitAllToGUI(); qApp->restoreOverrideCursor(); @@ -9216,7 +9211,7 @@ void ScribusMainWindow::PutToPatterns() doc->m_Selection->clear(); doc->m_Selection->delaySignalsOff(); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->updateSymbolList(); emit UpdateRequest(reqColorsUpdate); doc->minCanvasCoordinate = minSize; @@ -9247,7 +9242,7 @@ void ScribusMainWindow::ConvertToSymbol() m_undoManager->setUndoEnabled(false); doc->itemSelection_convertItemsToSymbol(patternName); propertiesPalette->updateColorList(); - textPalette->updateColorList(); + contentPalette->updateColorList(); symbolPalette->updateSymbolList(); emit UpdateRequest(reqColorsUpdate); if (outlinePalette->isVisible()) @@ -10024,7 +10019,7 @@ void ScribusMainWindow::setPreviewToolbar() undoPalette->setEnabled(!doc->drawAsPreview); outlinePalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); propertiesPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); - textPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); + contentPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview)); scrMenuMgr->setMenuEnabled("Edit", !doc->drawAsPreview); scrMenuMgr->setMenuEnabled("Item", !doc->drawAsPreview); scrMenuMgr->setMenuEnabled("Insert", !doc->drawAsPreview); diff --git a/scribus/scribus.h b/scribus/scribus.h index 056cf17aa..17e4be6da 100644 --- a/scribus/scribus.h +++ b/scribus/scribus.h @@ -91,6 +91,7 @@ class PagePalette; class PageSelector; class PrefsContext; class PrefsManager; +class ContentPalette; class PropertiesPalette; class ResourceManager; class ScMWMenuManager; @@ -106,7 +107,6 @@ class SimpleState; class StoryEditor; class StyleManager; class SymbolPalette; -class TextPalette; class TOCGenerator; class UndoManager; class UndoPalette; @@ -231,7 +231,7 @@ public: GuideManager *guidePalette; CharSelect *charPalette; PropertiesPalette *propertiesPalette; - TextPalette *textPalette; + ContentPalette *contentPalette; MarksManager *marksManager; NotesStylesEditor *nsEditor; NodePalette *nodePalette; diff --git a/scribus/scribusstructs.h b/scribus/scribusstructs.h index 0297ba4e3..3422bd3c9 100644 --- a/scribus/scribusstructs.h +++ b/scribus/scribusstructs.h @@ -419,16 +419,15 @@ enum { PAL_ALL, PAL_PROPERTIES, + PAL_CONTENT, PAL_OUTLINE, PAL_SCRAPBOOK, PAL_LAYER, PAL_PAGE, PAL_BOOKMARK, - PAL_7_UNUSED, PAL_UNDO, PAL_VERIFIER, PAL_DOWNLOADS, - PAL_TEXT, PAL_MAX }; diff --git a/scribus/scribusview.cpp b/scribus/scribusview.cpp index f3715ad39..b64d502cd 100644 --- a/scribus/scribusview.cpp +++ b/scribus/scribusview.cpp @@ -114,9 +114,7 @@ for which a new license (GPL+exception) is in place. #include "ui/pageitemattributes.h" #include "ui/pageselector.h" #include "ui/propertiespalette.h" -#include "ui/propertiespalette_image.h" #include "ui/propertiespalette_line.h" -#include "ui/propertiespalette_text.h" #include "ui/rulermover.h" #include "ui/scrapbookpalette.h" #include "ui/storyeditor.h" diff --git a/scribus/ui/contentpalette.cpp b/scribus/ui/contentpalette.cpp new file mode 100644 index 000000000..64de5c0ce --- /dev/null +++ b/scribus/ui/contentpalette.cpp @@ -0,0 +1,339 @@ +#include "scribus.h" // ScribusMainWindow +#include "contentpalette.h" + +#include <QWidget> +#include <QStackedWidget> + +#include "appmodehelper.h" // for AppModeChanged (if needed) + +#include "propertiespalette_image.h" +#include "propertiespalette_text.h" +#include "selection.h" +#include "pageitem_textframe.h" +#include "pageitem_imageframe.h" +#include "pageitem_table.h" +#include "styles/paragraphstyle.h" +#include "styles/charstyle.h" + +ContentPalette::ContentPalette(QWidget* parent) : + ScDockPalette(parent, "ContentPalette", nullptr) +{ + setObjectName(QString::fromLocal8Bit("ContentPalette")); + + QFont f(font()); + f.setPointSize(f.pointSize()-1); + setFont(f); + + + stackedWidget = new QStackedWidget(this); + + auto emptyPal = new QWidget(); + stackedWidget->addWidget(emptyPal); + + textPal = new PropertiesPalette_Text(this); + stackedWidget->addWidget(textPal); + + imagePal = new PropertiesPalette_Image(this); + stackedWidget->addWidget(imagePal); + + setWidget(stackedWidget); + + stackedWidget->setCurrentIndex((int) Panel::empty); + + languageChange(); +} + +void ContentPalette::setMainWindow(ScribusMainWindow *mw) +{ + m_ScMW = mw; + + textPal->setMainWindow(mw); + imagePal->setMainWindow(mw); + + connect(m_ScMW->appModeHelper, &AppModeHelper::AppModeChanged, this, &ContentPalette::AppModeChanged); +} + +void ContentPalette::setDoc(ScribusDoc *doc) +{ + if((doc == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) + return; + + if (m_doc) + { + disconnect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + disconnect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + } + + m_doc = doc; + m_item = nullptr; + setEnabled(!m_doc->drawAsPreview); + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + m_haveDoc = true; + m_haveItem = false; + + textPal->setDoc(m_doc); + imagePal->setDoc(m_doc); + + updateColorList(); + + connect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + connect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + + // Handle properties update when switching document + handleSelectionChanged(); +} + +void ContentPalette::unsetDoc() +{ + if (m_doc) + { + disconnect(m_doc->m_Selection, &Selection::selectionChanged, this, &ContentPalette::handleSelectionChanged); + disconnect(m_doc, &ScribusDoc::docChanged, this, &ContentPalette::handleSelectionChanged); + } + + setEnabled(true); + m_haveDoc = false; + m_haveItem = false; + m_doc=nullptr; + m_item = nullptr; + + textPal->unsetItem(); + textPal->unsetDoc(); + imagePal->unsetItem(); + imagePal->unsetDoc(); + + stackedWidget->setCurrentIndex((int) Panel::empty); +} + +void ContentPalette::unsetItem() +{ + m_haveItem = false; + m_item = nullptr; + + imagePal->unsetItem(); + textPal->unsetItem(); + + handleSelectionChanged(); +} + +PageItem* ContentPalette::currentItemFromSelection() +{ + if (m_doc && m_doc->m_Selection->count() > 0) + { + return m_doc->m_Selection->itemAt(0); + } + + return nullptr; +} + +void ContentPalette::AppModeChanged() +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if ((m_haveDoc) && (m_haveItem)) + { + if (m_item->isTable()) + { + textPal->setEnabled(m_doc->appMode == modeEditTable); + if (m_doc->appMode == modeEditTable) + { + connect(m_item->asTable(), &PageItem_Table::selectionChanged, this, &ContentPalette::handleSelectionChanged); + } + else + { + disconnect(m_item->asTable(), &PageItem_Table::selectionChanged, this, &ContentPalette::handleSelectionChanged); + } + } + textPal->handleSelectionChanged(); + } +} + +void ContentPalette::setCurrentItem(PageItem *item) +{ + if (!m_ScMW || m_ScMW->scriptIsRunning()) + return; + + if (!item) + { + unsetItem(); + return; + } + + if (!m_doc) + { + setDoc(item->doc()); + } + + m_haveItem = true; + m_item = item; + + // TODO: in PropertiesPalette there is a a funny if for the groups: take care of it when adding the group panel + + if (!sender() || (m_doc->appMode == modeEditTable)) + { + textPal->handleSelectionChanged(); + imagePal->handleSelectionChanged(); + } +} + +void ContentPalette::handleSelectionChanged() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + auto currentPanel = (Panel) stackedWidget->currentIndex(); + auto newPanel{currentPanel}; + + PageItem* currItem = currentItemFromSelection(); + + // TODO: should me move this to setCurrentIndex()? + if (!currItem) + { + newPanel = Panel::empty; + m_haveItem = false; + } else if (m_doc->m_Selection->count() > 1) + { + newPanel = Panel::empty; + } + else + { + m_haveItem = true; + + switch (currItem->itemType()) + { + case PageItem::ImageFrame: + newPanel = Panel::image; + break; + case PageItem::TextFrame: + case PageItem::PathText: + newPanel = Panel::text; + break; + case PageItem::Table: + newPanel = m_doc->appMode == modeEditTable ? Panel::text : Panel::empty; + break; + default: + newPanel = Panel::empty; + break; + } + setCurrentItem(currItem); + } + if (currentPanel != newPanel) + { + stackedWidget->setCurrentIndex((int) newPanel); + updatePanelTitle(); + } + updateGeometry(); + ScDockPalette::update(); +} + +void ContentPalette::unitChange() +{ + if (!m_haveDoc) + return; + + bool tmp = m_haveItem; + m_haveItem = false; + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + + textPal->unitChange(); + imagePal->unitChange(); + + m_haveItem = tmp; +} + +void ContentPalette::updateColorList() +{ + if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + textPal->updateColorList(); + + assert (m_doc->PageColors.document()); +} + +bool ContentPalette::userActionOn() +{ + return imagePal->userActionOn(); +} + +void ContentPalette::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + return; + } + ScDockPalette::changeEvent(e); +} + +void ContentPalette::updatePanelTitle() +{ + switch ((Panel) stackedWidget->currentIndex()) + { + case Panel::empty: + setWindowTitle( tr("Content Properties")); + break; + case Panel::text: + setWindowTitle( tr("Text Properties")); + break; + case Panel::image: + setWindowTitle( tr("Image Properties")); + break; + } +} + +void ContentPalette::languageChange() +{ + updatePanelTitle(); + textPal->languageChange(); + imagePal->languageChange(); +} + +void ContentPalette::update(PageItem_ImageFrame* image) +{ + imagePal->showScaleAndOffset(image->imageXScale(), image->imageYScale(), image->imageXOffset(), image->imageYOffset()); +} + +void ContentPalette::update(const ParagraphStyle& style) +{ + textPal->updateStyle(style); +} + +void ContentPalette::update(const CharStyle& style) +{ + textPal->updateCharStyle(style); +} + +void ContentPalette::update(PageItem_TextFrame* text) +{ +} + +void ContentPalette::updateTextStyles() +{ + textPal->updateParagraphStyles(); +} + +void ContentPalette::updateTextAlignment(int i) +{ + textPal->showAlignment(i); +} + +void ContentPalette::updateTextDirection(int i) +{ + textPal->showDirection(i); +} + +void ContentPalette::updateTextFontSize(int i) +{ + textPal->showFontSize(i); +} + +void ContentPalette::updateTextLanguage(const QString& language) +{ + textPal->showLanguage(language); +} diff --git a/scribus/ui/contentpalette.h b/scribus/ui/contentpalette.h new file mode 100644 index 000000000..36854c68b --- /dev/null +++ b/scribus/ui/contentpalette.h @@ -0,0 +1,81 @@ +#ifndef CONTENTPALETTE_H +#define CONTENTPALETTE_H + +#include "scribusapi.h" +#include "scdockpalette.h" +#include "scguardedptr.h" + +class QStackedWidget; + +class ScribusMainWindow; +class ScribusDoc; +class PageItem; + +class PropertiesPalette_Text; +class PropertiesPalette_Image; +class PageItem_TextFrame; +class PageItem_ImageFrame; +class ParagraphStyle; +class CharStyle; + +class SCRIBUS_API ContentPalette : public ScDockPalette +{ + Q_OBJECT + + public: + ContentPalette(QWidget* parent); + ~ContentPalette() {} + + void updateColorList(); + bool userActionOn(); + virtual void changeEvent(QEvent *e) override; + void update(PageItem_ImageFrame* image); + void update(const ParagraphStyle& style); + void update(PageItem_TextFrame* image); + void updateTextStyles(); + void updateTextAlignment(int i); + void updateTextDirection(int i); + void updateTextFontSize(int i); + void updateTextLanguage(const QString& language); + + public slots: + void setMainWindow(ScribusMainWindow *mw); + + void setDoc(ScribusDoc *doc); + void unsetDoc(); + void unsetItem(); + void AppModeChanged(); + void setCurrentItem(PageItem *i); + PageItem* currentItemFromSelection(); + void handleSelectionChanged(); + + void update(const CharStyle& style); + + void unitChange(); + void languageChange(); + + private: + ScribusMainWindow *m_ScMW{nullptr}; + ScGuardedPtr<ScribusDoc> m_doc{nullptr}; + PageItem* m_item; + + bool m_haveDoc{false}; + bool m_haveItem{false}; + double m_unitRatio{1.0}; + int m_unitIndex{0}; + + QStackedWidget* stackedWidget; + PropertiesPalette_Text* textPal; + PropertiesPalette_Image* imagePal; + + void updatePanelTitle(); + + // the order must match the insertion of the widgets in the constructor + enum class Panel { + empty, + text, + image + }; +}; + +#endif diff --git a/scribus/ui/contextmenu.cpp b/scribus/ui/contextmenu.cpp index 55b6d3cdf..f254ea50b 100644 --- a/scribus/ui/contextmenu.cpp +++ b/scribus/ui/contextmenu.cpp @@ -543,31 +543,11 @@ void ContextMenu::createMenuItems_Selection() } if (selectedItemCount == 2 && m_doc->appMode != modeEdit) addAction(m_ScMW->scrActions["itemWeld"]); -// { -// menuWeld->addAction(m_AP->scrActions["itemWeld17"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld71"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld13"]); -// menuWeld->addAction(m_AP->scrActions["itemWeld31"]); -// QAction *act = addMenu(menuWeld); -// act->setText( tr("Weld to last...")); -// } - //--> //<-- Add Properties addSeparator(); + addAction(m_ScMW->scrActions["toolsContent"]); addAction(m_ScMW->scrActions["toolsProperties"]); - - bool containsTextFrame = false; - if (currItem->asTextFrame()) - containsTextFrame = true; - if (m_doc->appMode == modeEditTable) - containsTextFrame = true; - if (!containsTextFrame && m_Sel.containsItemType(PageItem::TextFrame)) - containsTextFrame = true; - if (containsTextFrame) - addAction(m_ScMW->scrActions["toolsText"]); - //--> - } void ContextMenu::createMenuItems_NoSelection(double mx, double my) diff --git a/scribus/ui/outlinepalette.cpp b/scribus/ui/outlinepalette.cpp index ecb16f9a1..a67ad6fe2 100644 --- a/scribus/ui/outlinepalette.cpp +++ b/scribus/ui/outlinepalette.cpp @@ -32,12 +32,12 @@ for which a new license (GPL+exception) is in place. #include "layers.h" #include "outlinepalette.h" #include "propertiespalette.h" +#include "contentpalette.h" #include "scpage.h" #include "scribus.h" #include "scribusdoc.h" #include "scribusview.h" #include "selection.h" -#include "textpalette.h" #include "undomanager.h" #include "units.h" #include "util.h" @@ -698,7 +698,7 @@ void OutlinePalette::slotDoRename(QTreeWidgetItem *ite , int col) { item->PageItemObject->setItemName(NameNew); m_MainWindow->propertiesPalette->setCurrentItem(item->PageItemObject); - m_MainWindow->textPalette->setCurrentItem(item->PageItemObject); + m_MainWindow->contentPalette->setCurrentItem(item->PageItemObject); currDoc->setModified(true); } } diff --git a/scribus/ui/propertiespalette.cpp b/scribus/ui/propertiespalette.cpp index 4d103dcd0..dd9b83407 100644 --- a/scribus/ui/propertiespalette.cpp +++ b/scribus/ui/propertiespalette.cpp @@ -42,7 +42,6 @@ for which a new license (GPL+exception) is in place. #include "dasheditor.h" #include "pageitem_table.h" #include "propertiespalette_group.h" -#include "propertiespalette_image.h" #include "propertiespalette_line.h" #include "propertiespalette_shadow.h" #include "propertiespalette_shape.h" @@ -89,9 +88,6 @@ PropertiesPalette::PropertiesPalette( QWidget* parent) : ScDockPalette( parent, groupPal = new PropertiesPalette_Group( this ); idGroupItem = TabStack->addItem(groupPal, "Groups"); - imagePal = new PropertiesPalette_Image(this); - idImageItem=TabStack->addItem( imagePal, "&Image" ); - linePal = new PropertiesPalette_Line(this); idLineItem=TabStack->addItem( linePal, "&Line" ); @@ -161,7 +157,6 @@ void PropertiesPalette::setMainWindow(ScribusMainWindow* mw) this->shadowPal->setMainWindow(mw); this->shapePal->setMainWindow(mw); this->groupPal->setMainWindow(mw); - this->imagePal->setMainWindow(mw); this->linePal->setMainWindow(mw); this->tablePal->setMainWindow(mw); @@ -232,7 +227,6 @@ void PropertiesPalette::setDoc(ScribusDoc *d) shadowPal->setDoc(m_doc); shapePal->setDoc(m_doc); groupPal->setDoc(m_doc); - imagePal->setDoc(m_doc); linePal->setDoc(m_doc); tablePal->setDocument(m_doc); @@ -266,8 +260,6 @@ void PropertiesPalette::unsetDoc() shapePal->unsetDoc(); groupPal->unsetItem(); groupPal->unsetDoc(); - imagePal->unsetItem(); - imagePal->unsetDoc(); linePal->unsetItem(); linePal->unsetDoc(); tablePal->unsetItem(); @@ -291,12 +283,10 @@ void PropertiesPalette::unsetItem() m_item = nullptr; Cpal->setCurrentItem(nullptr); Tpal->setCurrentItem(nullptr); - imagePal->unsetItem(); tablePal->unsetItem(); shapePal->unsetItem(); groupPal->unsetItem(); shadowPal->unsetItem(); - imagePal->unsetItem(); linePal->unsetItem(); handleSelectionChanged(); } @@ -311,29 +301,12 @@ void PropertiesPalette::setTextFlowMode(PageItem::TextFlowMode mode) PageItem* PropertiesPalette::currentItemFromSelection() { - PageItem *currentItem = nullptr; - - if (m_doc) + if (m_doc && m_doc->m_Selection->count() > 0) { - if (m_doc->m_Selection->count() > 0) - currentItem = m_doc->m_Selection->itemAt(0); - /* if (m_doc->m_Selection->count() > 1) - { - int lowestItem = 999999; - for (int a=0; a<m_doc->m_Selection->count(); ++a) - { - currentItem = m_doc->m_Selection->itemAt(a); - lowestItem = qMin(lowestItem, m_doc->Items->indexOf(currentItem)); - } - currentItem = m_doc->Items->at(lowestItem); - } - else if (m_doc->m_Selection->count() == 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } */ + return m_doc->m_Selection->itemAt(0); } - return currentItem; + return nullptr; } void PropertiesPalette::AppModeChanged() @@ -399,7 +372,6 @@ void PropertiesPalette::setCurrentItem(PageItem *i) TabStack->setItemEnabled(idGroupItem, true); TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idColorsItem, false); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idTableItem, false); } else @@ -420,7 +392,6 @@ void PropertiesPalette::setCurrentItem(PageItem *i) shadowPal->handleSelectionChanged(); shapePal->handleSelectionChanged(); groupPal->handleSelectionChanged(); - imagePal->handleSelectionChanged(); linePal->handleSelectionChanged(); tablePal->handleSelectionChanged(); Cpal->handleSelectionChanged(); @@ -436,7 +407,6 @@ void PropertiesPalette::setCurrentItem(PageItem *i) TabStack->setItemEnabled(idColorsItem, true); TabStack->setItemEnabled(idTableItem, false); TabStack->setItemEnabled(idTransparencyItem, false); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idTableItem, false); } if (m_item->asSymbolFrame()) @@ -447,7 +417,6 @@ void PropertiesPalette::setCurrentItem(PageItem *i) TabStack->setItemEnabled(idGroupItem, true); TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idColorsItem, false); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idTransparencyItem, false); TabStack->setItemEnabled(idTableItem, false); } @@ -500,7 +469,6 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idXYZItem, false); Cpal->showGradient(0); break; - case PageItem::ImageFrame: case PageItem::LatexFrame: case PageItem::OSGFrame: if (currItem->asOSGFrame()) @@ -512,27 +480,23 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idColorsItem, true); TabStack->setItemEnabled(idTransparencyItem, false); - TabStack->setItemEnabled(idImageItem, false); } else { TabStack->setItemEnabled(idXYZItem, true); TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, true); TabStack->setItemEnabled(idLineItem, true); } break; case PageItem::TextFrame: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, true); break; case PageItem::Line: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, false); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, true); break; case PageItem::ItemType1: @@ -542,27 +506,23 @@ void PropertiesPalette::handleSelectionChanged() case PageItem::Arc: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, true); break; case PageItem::PolyLine: case PageItem::Spiral: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, true); break; case PageItem::PathText: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, true); break; case PageItem::Symbol: case PageItem::Group: TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, false); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idGroupItem, true); TabStack->setItemEnabled(idColorsItem, false); @@ -572,7 +532,6 @@ void PropertiesPalette::handleSelectionChanged() TabStack->setItemEnabled(idTableItem, true); TabStack->setItemEnabled(idShadowItem, true); TabStack->setItemEnabled(idShapeItem, true); - TabStack->setItemEnabled(idImageItem, false); TabStack->setItemEnabled(idLineItem, false); TabStack->setItemEnabled(idGroupItem, false); TabStack->setItemEnabled(idColorsItem, false); @@ -606,7 +565,6 @@ void PropertiesPalette::unitChange() shadowPal->unitChange(); shapePal->unitChange(); groupPal->unitChange(); - imagePal->unitChange(); linePal->unitChange(); Cpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex()); @@ -858,10 +816,7 @@ void PropertiesPalette::updateColorList() bool PropertiesPalette::userActionOn() { - bool userActionOn = false; - userActionOn = xyzPal->userActionOn(); - userActionOn |= imagePal->userActionOn(); - return userActionOn; + return xyzPal->userActionOn(); } void PropertiesPalette::changeEvent(QEvent *e) @@ -879,7 +834,6 @@ void PropertiesPalette::languageChange() setWindowTitle( tr("Properties")); TabStack->setItemText(idXYZItem, tr("X, Y, &Z")); - TabStack->setItemText(idImageItem, tr("&Image")); TabStack->setItemText(idShadowItem, tr("Drop Shadow")); TabStack->setItemText(idShapeItem, tr("&Shape")); TabStack->setItemText(idLineItem, tr("&Line")); @@ -892,7 +846,6 @@ void PropertiesPalette::languageChange() shadowPal->languageChange(); shapePal->languageChange(); groupPal->languageChange(); - imagePal->languageChange(); Cpal->languageChange(); linePal->languageChange(); tablePal->languageChange(); diff --git a/scribus/ui/propertiespalette.h b/scribus/ui/propertiespalette.h index 0f1cb6eef..ad16dbbf5 100644 --- a/scribus/ui/propertiespalette.h +++ b/scribus/ui/propertiespalette.h @@ -34,7 +34,6 @@ class ColorCombo; class Cpalette; class NameWidget; class PropertiesPalette_Group; -class PropertiesPalette_Image; class PropertiesPalette_Line; class PropertiesPalette_Shadow; class PropertiesPalette_Shape; @@ -71,7 +70,6 @@ public: // commmited PropertiesPalette_Group* groupPal; - PropertiesPalette_Image* imagePal; PropertiesPalette_Line* linePal; PropertiesPalette_Shadow* shadowPal; PropertiesPalette_Shape* shapePal; @@ -129,7 +127,6 @@ protected: int idXYZItem; int idShapeItem; int idTableItem; - int idImageItem; int idLineItem; int idColorsItem; int idTransparencyItem; diff --git a/scribus/ui/textpalette.cpp b/scribus/ui/textpalette.cpp deleted file mode 100644 index 734e21562..000000000 --- a/scribus/ui/textpalette.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* -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 "textpalette.h" - -#include <QCloseEvent> -#include <QComboBox> -#include <QEvent> -#include <QFocusEvent> -#include <QKeyEvent> -#include <QTransform> -#include <QObject> -#include <QPoint> -#include <QSpacerItem> -#include <QStackedWidget> -#include <QTimer> -#include <QToolBox> -#include <QToolTip> -#include <QVBoxLayout> -#include <QValidator> -#include <QWidget> - -#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) -#define _USE_MATH_DEFINES -#endif -#include <cmath> - -#include "appmodehelper.h" -#include "appmodes.h" -#include "pageitem_table.h" -#include "pageitem_textframe.h" -#include "propertiespalette_text.h" -#include "scribus.h" -#include "scribusdoc.h" -#include "selection.h" -#include "undomanager.h" - - -TextPalette::TextPalette( QWidget* parent) : ScDockPalette( parent, "TextPalette", nullptr) -{ - undoManager = UndoManager::instance(); - m_ScMW=nullptr; - m_doc=nullptr; - m_haveDoc = false; - m_haveItem = false; - m_unitRatio = 1.0; - - setObjectName(QString::fromLocal8Bit("TextPalette")); -/// setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - - QFont f(font()); - f.setPointSize(f.pointSize()-1); - setFont(f); - - textPal = new PropertiesPalette_Text( this ); - setWidget( textPal ); - - languageChange(); - - m_haveItem = false; -} - -void TextPalette::closeEvent(QCloseEvent *closeEvent) -{ - ScDockPalette::closeEvent(closeEvent); -} - -void TextPalette::setMainWindow(ScribusMainWindow* mw) -{ - m_ScMW = mw; - - // For some reason, the mapToGlobal() / mapFromGlobal() roundtrip - // performed below does not give always good results, causing TP to - // not display in some situations. Moreover the reparenting is useless - // as TP is already created with ScribusMainWindow as parent. - /*QPoint p1 = mapToGlobal(pos()); - QPoint p2 = m_ScMW->mapFromGlobal(p1); - setParent(m_ScMW); - move(p2);*/ - - this->textPal->setMainWindow(mw); - - connect(m_ScMW->appModeHelper, SIGNAL(AppModeChanged(int,int)), this, SLOT(AppModeChanged())); -} - - -void TextPalette::setDoc(ScribusDoc *d) -{ - if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) - return; - - if (m_doc) - { - disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - } - - m_doc = d; - m_item = nullptr; - setEnabled(!m_doc->drawAsPreview); - - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); -//qt4 FIXME here - m_haveDoc = true; - m_haveItem = false; - - textPal->setDoc(m_doc); - - updateColorList(); - - connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - - // Handle properties update when switching document - handleSelectionChanged(); -} - -void TextPalette::unsetDoc() -{ - if (m_doc) - { - disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - } - setEnabled(true); - m_haveDoc = false; - m_haveItem = false; - m_doc=nullptr; - m_item = nullptr; - - textPal->unsetItem(); - textPal->unsetDoc(); - - m_haveItem = false; -} - -void TextPalette::unsetItem() -{ - m_haveItem = false; - m_item = nullptr; - textPal->unsetItem(); - handleSelectionChanged(); -} - -PageItem* TextPalette::currentItemFromSelection() -{ - PageItem *currentItem = nullptr; - - if (m_doc) - { - if (m_doc->m_Selection->count() > 0) - currentItem = m_doc->m_Selection->itemAt(0); - /* if (m_doc->m_Selection->count() > 1) - { - int lowestItem = 999999; - for (int a=0; a<m_doc->m_Selection->count(); ++a) - { - currentItem = m_doc->m_Selection->itemAt(a); - lowestItem = qMin(lowestItem, m_doc->Items->indexOf(currentItem)); - } - currentItem = m_doc->Items->at(lowestItem); - } - else if (m_doc->m_Selection->count() == 1) - { - currentItem = m_doc->m_Selection->itemAt(0); - } */ - } - - return currentItem; -} - -void TextPalette::AppModeChanged() -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - if ((m_haveDoc) && (m_haveItem)) - { - if (m_item->isTable()) - { - textPal->setEnabled(m_doc->appMode == modeEditTable); - if (m_doc->appMode == modeEditTable) - connect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - else - disconnect(m_item->asTable(), SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - } - textPal->handleSelectionChanged(); - } -} - -void TextPalette::setCurrentItem(PageItem *i) -{ - 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 (!i) - { - unsetItem(); - return; - } - - if (!m_doc) - setDoc(i->doc()); - - m_haveItem = false; - m_item = i; - - if ((m_item->isGroup()) && (!m_item->isSingleSel)) - textPal->setEnabled(false); - - m_haveItem = true; - - if (!sender() || (m_doc->appMode == modeEditTable)) - { - textPal->handleSelectionChanged(); - } - - if (m_item->asOSGFrame()) - { - textPal->setEnabled(false); - } - if (m_item->asSymbolFrame()) - { - textPal->setEnabled(false); - } -} - -void TextPalette::handleSelectionChanged() -{ - if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - - PageItem* currItem = currentItemFromSelection(); - if (m_doc->m_Selection->count() > 1) - { - textPal->setEnabled(false); - } - else - { - int itemType = currItem ? (int) currItem->itemType() : -1; - m_haveItem = (itemType != -1); - - switch (itemType) - { - case -1: - m_haveItem = false; - textPal->setEnabled(false); - break; - case PageItem::ImageFrame: - case PageItem::LatexFrame: - case PageItem::OSGFrame: - textPal->setEnabled(false); - break; - case PageItem::TextFrame: - textPal->setEnabled(true); - break; - case PageItem::Line: - textPal->setEnabled(false); - break; - case PageItem::ItemType1: - case PageItem::ItemType3: - case PageItem::Polygon: - case PageItem::RegularPolygon: - case PageItem::Arc: - textPal->setEnabled(false); - break; - case PageItem::PolyLine: - case PageItem::Spiral: - textPal->setEnabled(false); - break; - case PageItem::PathText: - textPal->setEnabled(true); - break; - case PageItem::Symbol: - case PageItem::Group: - textPal->setEnabled(false); - break; - case PageItem::Table: - textPal->setEnabled(m_doc->appMode == modeEditTable); - break; - } - } - - updateGeometry(); - update(); - - if (currItem) - setCurrentItem(currItem); -} - -void TextPalette::unitChange() -{ - if (!m_haveDoc) - return; - bool tmp = m_haveItem; - m_haveItem = false; - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); - - textPal->unitChange(); - m_haveItem = tmp; -} - -void TextPalette::NewLineMode(int mode) -{ - if (!m_ScMW || m_ScMW->scriptIsRunning()) - return; - updateGeometry(); - repaint(); -} - -void TextPalette::updateColorList() -{ - if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - - textPal->updateColorList(); - - assert (m_doc->PageColors.document()); -} - -bool TextPalette::userActionOn() -{ - bool userActionOn = false; - return userActionOn; -} - -void TextPalette::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) - { - languageChange(); - return; - } - ScDockPalette::changeEvent(e); -} - -void TextPalette::languageChange() -{ - setWindowTitle( tr("Text Properties")); - textPal->languageChange(); -} - - diff --git a/scribus/ui/textpalette.h b/scribus/ui/textpalette.h deleted file mode 100644 index 1e8705e13..000000000 --- a/scribus/ui/textpalette.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -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 TEXTPALETTE_H -#define TEXTPALETTE_H - -#include <QListWidgetItem> -#include <QLineEdit> - -class QCloseEvent; -class QEvent; -class QFocusEvent; -class QToolBox; -class QVBoxLayout; -class QWidget; - - -#include "pageitem.h" -#include "scdockpalette.h" -#include "scribusapi.h" - -class PropertiesPalette_Text; -class ScribusDoc; -class ScribusMainWindow; -class UndoManager; - -class SCRIBUS_API TextPalette : public ScDockPalette -{ - Q_OBJECT - -public: - TextPalette(QWidget* parent); - ~TextPalette() {} - - virtual void changeEvent(QEvent *e); - virtual void closeEvent(QCloseEvent *closeEvent); - - void updateColorList(); - void endPatchAdd(); - - /** @brief Returns true if there is a user action going on at the moment of call. */ - bool userActionOn(); // not yet implemented!!! This is needed badly. - // When user releases the mouse button or arrow key, changes must be checked - // and if in ScribusView a groupTransaction has been started it must be also - // commmited - - PropertiesPalette_Text* textPal; - -private: - - PageItem* currentItemFromSelection(); - -public slots: - void setMainWindow(ScribusMainWindow *mw); - - void setDoc(ScribusDoc *d); - void AppModeChanged(); - void setCurrentItem(PageItem *i); - void unsetDoc(); - void unsetItem(); - - void handleSelectionChanged(); - - void unitChange(); - void languageChange(); - -private slots: - void NewLineMode(int mode); - - -protected: - ScribusMainWindow *m_ScMW; - - bool m_haveDoc; - bool m_haveItem; - double m_unitRatio; - int m_unitIndex; - PageItem* m_item; - UndoManager *undoManager; - - ScGuardedPtr<ScribusDoc> m_doc; - - int idTextItem; -}; - -#endif |
|
Failed previously build, Second try has also failed. FWIW ----------------------------------------------------------------------------- LinuxMint 1.5.5.svn Build ID c-t-f-c1.15.10-64bit Rev 22867 GS9.26 Applied patch content-palette-2.diff (61,843 bytes) build failed as follows; ================================================================================ Scanning dependencies of target scribus [ 32%] Building CXX object scribus/CMakeFiles/scribus.dir/moc_actionmanager.cpp.o [ 32%] Building CXX object scribus/CMakeFiles/scribus.dir/moc_appmodehelper.cpp.o ... ... [ 51%] Building CXX object scribus/CMakeFiles/scribus.dir/canvasmode_nodeedit.cpp.o [ 52%] Building CXX object scribus/CMakeFiles/scribus.dir/canvasmode_normal.cpp.o /build/Scribus150/Scribus-Modded/scribus/canvasmode_normal.cpp: In member function ‘virtual void CanvasMode_Normal::mouseReleaseEvent(QMouseEvent*)’: /build/Scribus150/Scribus-Modded/scribus/canvasmode_normal.cpp:1186:30: error: ‘shiftPressed’ was not declared in this scope else if (is_selected && shiftPressed && select) // shift selection - invert selection ^~~~~~~~~~~~ /build/Scribus150/Scribus-Modded/scribus/canvasmode_normal.cpp:1186:30: note: suggested alternative: ‘altPressed’ else if (is_selected && shiftPressed && select) // shift selection - invert selection ^~~~~~~~~~~~ altPressed /build/Scribus150/Scribus-Modded/scribus/canvasmode_normal.cpp:1177:11: warning: unused variable ‘redrawSelection’ [-Wunused-variable] bool redrawSelection = false; ^~~~~~~~~~~~~~~ scribus/CMakeFiles/scribus.dir/build.make:10738: recipe for target 'scribus/CMakeFiles/scribus.dir/canvasmode_normal.cpp.o' failed make[2]: *** [scribus/CMakeFiles/scribus.dir/canvasmode_normal.cpp.o] Error 1 CMakeFiles/Makefile2:192: recipe for target 'scribus/CMakeFiles/scribus.dir/all' failed make[1]: *** [scribus/CMakeFiles/scribus.dir/all] Error 2 Makefile:151: recipe for target 'all' failed make: *** [all] Error 2 =============================================================================== |
|
shiftPressed was unused at the time i wrote my patch and i my patch is removing it. about one week after i've submitted my patch, the code was changed by jean (https://github.com/scribusproject/scribus/commit/1d2195598595827b03a54d844c7caea6c35976b9) any you have now to remove the following lines from my patch: @@ -1175,7 +1174,6 @@ void CanvasMode_Normal::mouseReleaseEvent(QMouseEvent *m) m_doc->m_Selection->delaySignalsOn(); // loop over all items and select bool altPressed = m->modifiers() & Qt::AltModifier; - bool shiftPressed = m->modifiers() & Qt::ShiftModifier; for (int a = 0; a < docItemCount; ++a) { does it work then? |
|
Thanks ale, all good now. I will use that build for the time being to evaluate the new PP, just first impressions is that it is good. � |
|
nice to hear! |
|
Can you now feedback some experience owencook ? |
|
I appreciated the fact that "Right clicking" in a text or image frame activated the Content options option for that frame. Excellant. So far so good. The PP is more manageable now with images removed. Anyone else trying this? |
|
I was reviewing the patch and noticed that void TextPalette::NewLineMode(int mode) disappeared? Plus the patch doesn't remove the usage of this in the connect statement in propertiespalette.cpp. Was this a miss? No big deal, just trying to understand and therefore need to review all the potential missing code. |
|
... hard to say, height months later... i will need to look at it in detail. |
|
that was painful, @cbradney! i had to manually reapply the diff because to much has changed since the the patch has been created. we urgently need to move to gitlab (so that only one person has to manually reapply the patch and everybody can then use the new patch) and we also need to vastly speed up the review process. |
|
ok, i could check for the usage of NewLineMode. it was indeed defined in both the ui/propertiespalette.cpp and ui/textpalette.cpp but it is only used in ui/propertiespalette.cpp for signals on this. as far as i can tell, the one in TextPalette is never called. and since there is no doc, no chance for me to say if what it was supposed to do and if it should stay. |
|
and, now, i've created a pull request on gitlab: https://gitlab.com/scribus/scribus/merge_requests/7 please use it for your review. |
|
Tested, works. Thanks! |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-01-24 08:54 | ale | New Issue | |
2019-01-24 09:19 | ale | Additional Information Updated | |
2019-01-24 10:18 | ale | File Added: content-palette.diff | |
2019-01-24 10:18 | ale | Note Added: 0045850 | |
2019-01-24 10:18 | ale | Tag Attached: patch | |
2019-01-24 10:19 | ale | Summary | Content Palette with Text and Image Properties => [Patch] Content Palette with Text and Image Properties |
2019-01-24 10:19 | ale | Assigned To | => ale |
2019-01-24 10:19 | ale | Status | new => assigned |
2019-01-24 12:09 | ale | Description Updated | |
2019-01-24 12:58 | ale | File Added: content-palette-2.diff | |
2019-01-24 12:58 | ale | Note Added: 0045853 | |
2019-01-25 09:58 | ale | Relationship added | related to 0009126 |
2019-03-01 18:17 | JLuc | Patch | No => Yes |
2019-03-02 08:27 | owencook | Note Added: 0045949 | |
2019-03-02 09:56 | ale | Note Added: 0045950 | |
2019-03-02 09:58 | ale | Note Edited: 0045950 | |
2019-03-03 01:38 | owencook | Note Added: 0045951 | |
2019-03-04 07:43 | ale | Note Added: 0045955 | |
2019-03-04 16:21 | JLuc | Note Added: 0045957 | |
2019-03-04 16:21 | JLuc | Note Edited: 0045957 | |
2019-03-05 22:56 | owencook | Note Added: 0045966 | |
2019-09-20 21:09 | cbradney | Note Added: 0046681 | |
2019-09-21 07:45 | ale | Note Added: 0046684 | |
2019-10-15 13:29 | ale | Note Added: 0046783 | |
2019-10-15 13:58 | ale | Note Added: 0046784 | |
2019-10-15 14:03 | ale | Note Added: 0046785 | |
2019-10-15 14:04 | JLuc | Note View State: 0046784: private | |
2019-10-15 14:04 | JLuc | Note View State: 0046784: public | |
2019-10-28 06:57 | cbradney | Status | assigned => resolved |
2019-10-28 06:57 | cbradney | Resolution | open => fixed |
2019-10-28 06:57 | cbradney | Fixed in Version | => 1.5.6.svn |
2019-10-28 16:11 | jghali | Summary | [Patch] Content Palette with Text and Image Properties => Content Palette with Text and Image Properties |
2019-10-28 18:43 | christoph_s | Status | resolved => closed |
2019-10-28 18:43 | christoph_s | Note Added: 0046865 |