From 5b112b6fc2cd9391b9539a81d83a26f4fee7ad38 Mon Sep 17 00:00:00 2001 From: nitramr Date: Sun, 23 Oct 2016 20:19:01 +0200 Subject: [PATCH] expander disabled --- README.md | 63 +++++++++++++------------------- Scribus.pro.user | 2 +- scribus/scribus.cpp | 36 +++++++++--------- scribus/ui/aligndistribute.cpp | 2 +- scribus/ui/indigodock.cpp | 2 +- scribus/ui/indigodockmanager.cpp | 2 +- scribus/ui/indigopanel.cpp | 31 ++++++++++++++-- scribus/ui/indigopanel.h | 14 ++++--- scribus/ui/indigotabbar.cpp | 6 +++ 9 files changed, 90 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index de919ff..dacd4c8 100644 --- a/README.md +++ b/README.md @@ -20,56 +20,45 @@ For Bugs and patches: please send them to the [Scribus Bugtracker](http://bugs.s |IRC | irc://scribus@chat.freenode.net | -## IndigoDock integration +## Source Code Compiling (Linux) -Following files has been updated to integrate the IndigoDock +The best way to compile Scribus is via Cmake. -ui/scdockpalette.h -ui/scdockpalette.cpp -- change type to IndigoPanel +If Cmake is not installed on your system open terminal and type in following command and press enter (you have to input your admin password afterwards): ```C++ -ScDockPalette::ScDockPalette( QWidget * parent, const QString& prefsContext, Qt::WindowFlags f) - - : IndigoPanel(prefsContext ), - - palettePrefs(0), - prefsContextName(QString::null), - visibleOnStartup(false) -{ -... +sudo apt-get install cmake ``` -scribus.h -scribus.cpp -- add function initIndigoDock() -- add Panels to Indigodock in initPalettes() +If Cmake is already installed do following steps. +1. Download Scribus-Indigo to your local system or clone the git repository +2. Create a new folder "Scribus" on your desktop +3. Unzip the downloaded project into your Scribus folder on desktop (Desktop/Scribus/scribus-indigo-master) +4. Create a new folder "bin" in your Scribus folder on desktop (Desktop/Scribus/bin) +5. Open terminal and enter following commands to compile the source code: + ```C++ -void ScribusMainWindow::initIndigoDock() -{ +cd ~/Desktop/Scribus/bin +cmake --debug-output ../scribus-indigo-master +make -j4 +``` + +After compiling was successfully you have to install the compiled file and necessary resources. Enter following command: - // install IndigoDockManager - wdg_indigoDockManager = new IndigoDockManager(this); - wdg_indigoDockManager->setMinimumPanelSize(QSize(180,100)); - wdg_indigoDock = new IndigoDock(); +```C++ +sudo make install +``` +You can find Scribus in following location: +./user/local/bin/ - // Add IndigoDock - wdg_indigoDockManager->addIndigoDock(wdg_indigoDock, Qt::RightDockWidgetArea ); -} -``` +For uninstalling use following commands: ```C++ -void ScribusMainWindow::initPalettes() -{ +cd ~/Desktop/Scribus/bin +sudo make uninstall +``` - //CB TODO hide the publicly available members of some palettes - // these must be filtered too as they take control of the palettes events - outlinePalette = new OutlinePalette(this); - outlinePalette->setMainWindow(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, outlinePalette); -... -``` diff --git a/Scribus.pro.user b/Scribus.pro.user index 29df147..45ab388 100644 --- a/Scribus.pro.user +++ b/Scribus.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index 3a6809b..2ff203d 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -651,7 +651,7 @@ void ScribusMainWindow::initPalettes() // Properties propertiesPalette = new PropertiesPalette(this); propertiesPalette->setMainWindow(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, propertiesPalette, IndigoPanel::Docked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, propertiesPalette); connect( scrActions["toolsProperties"], SIGNAL(toggled(bool)) , propertiesPalette, SLOT(setPaletteShown(bool)) ); connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool))); emit UpdateRequest(reqDefFontListUpdate); @@ -659,7 +659,7 @@ void ScribusMainWindow::initPalettes() // Aligment alignDistributePalette = new AlignDistributePalette(this, "AlignDistributePalette"); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, alignDistributePalette, IndigoPanel::Docked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, alignDistributePalette); connect( scrActions["toolsAlignDistribute"], SIGNAL(toggled(bool)) , alignDistributePalette, SLOT(setPaletteShown(bool)) ); connect( alignDistributePalette, SIGNAL(paletteShown(bool)), scrActions["toolsAlignDistribute"], SLOT(setChecked(bool))); connect( alignDistributePalette, SIGNAL(documentChanged()), this, SLOT(slotDocCh())); @@ -667,14 +667,14 @@ void ScribusMainWindow::initPalettes() // Pages pagePalette = new PagePalette(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, pagePalette, IndigoPanel::Docked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, pagePalette); connect( scrActions["toolsPages"], SIGNAL(toggled(bool)) , pagePalette, SLOT(setPaletteShown(bool)) ); connect( pagePalette, SIGNAL(paletteShown(bool)), scrActions["toolsPages"], SLOT(setChecked(bool))); pagePalette->installEventFilter(this); // Layers layerPalette = new LayerPalette(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, layerPalette, IndigoPanel::Docked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, layerPalette); connect( scrActions["toolsLayers"], SIGNAL(toggled(bool)) , layerPalette, SLOT(setPaletteShown(bool)) ); connect( layerPalette, SIGNAL(paletteShown(bool)), scrActions["toolsLayers"], SLOT(setChecked(bool))); layerPalette->installEventFilter(this); @@ -684,7 +684,7 @@ void ScribusMainWindow::initPalettes() // Outline outlinePalette = new OutlinePalette(this); outlinePalette->setMainWindow(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, outlinePalette, IndigoPanel::HiddenDocked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, outlinePalette); connect( scrActions["toolsOutline"], SIGNAL(toggled(bool)) , outlinePalette, SLOT(setPaletteShown(bool)) ); connect( outlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsOutline"], SLOT(setChecked(bool))); connect(outlinePalette, SIGNAL(selectElementByItem(PageItem *, bool)), this, SLOT(selectItemsFromOutlines(PageItem *, bool))); @@ -695,7 +695,7 @@ void ScribusMainWindow::initPalettes() // Inline inlinePalette = new InlinePalette(this); inlinePalette->setMainWindow(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, inlinePalette, IndigoPanel::HiddenDocked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, inlinePalette); connect(scrActions["toolsInline"], SIGNAL(toggled(bool)), inlinePalette, SLOT(setPaletteShown(bool))); connect(inlinePalette, SIGNAL(paletteShown(bool)), scrActions["toolsInline"], SLOT(setChecked(bool))); connect(inlinePalette, SIGNAL(startEdit(int)), this, SLOT(editInlineStart(int))); @@ -705,7 +705,7 @@ void ScribusMainWindow::initPalettes() // Bookmarks bookmarkPalette = new BookPalette(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, bookmarkPalette, IndigoPanel::HiddenDocked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, bookmarkPalette); connect( scrActions["toolsBookmarks"], SIGNAL(toggled(bool)) , bookmarkPalette, SLOT(setPaletteShown(bool)) ); connect( bookmarkPalette, SIGNAL(paletteShown(bool)), scrActions["toolsBookmarks"], SLOT(setChecked(bool))); bookmarkPalette->installEventFilter(this); @@ -716,7 +716,7 @@ void ScribusMainWindow::initPalettes() // Symbol symbolPalette = new SymbolPalette(this); symbolPalette->setMainWindow(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, symbolPalette, IndigoPanel::HiddenDocked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, symbolPalette); connect(scrActions["toolsSymbols"], SIGNAL(toggled(bool)), symbolPalette, SLOT(setPaletteShown(bool))); connect(symbolPalette, SIGNAL(paletteShown(bool)), scrActions["toolsSymbols"], SLOT(setChecked(bool))); connect(symbolPalette, SIGNAL(startEdit(QString)), this, SLOT(editSymbolStart(QString))); @@ -726,13 +726,21 @@ void ScribusMainWindow::initPalettes() // Scapebook scrapbookPalette = new Biblio(this); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, scrapbookPalette, IndigoPanel::HiddenDocked, true); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, scrapbookPalette); connect( scrActions["toolsScrapbook"], SIGNAL(toggled(bool)) , scrapbookPalette, SLOT(setPaletteShown(bool)) ); connect( scrapbookPalette, SIGNAL(paletteShown(bool)), scrActions["toolsScrapbook"], SLOT(setChecked(bool))); connect( scrapbookPalette, SIGNAL(pasteToActualPage(QString)), this, SLOT(pasteFromScrapbook(QString))); connect( scrapbookPalette, SIGNAL(scrapbookListChanged()), this, SLOT(rebuildScrapbookMenu())); scrapbookPalette->installEventFilter(this); + // Undo + undoPalette = new UndoPalette(this, "undoPalette"); + wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, undoPalette); + undoPalette->installEventFilter(this); + m_undoManager->registerGui(undoPalette); + connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); + connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); + // Node nodePalette = new NodePalette(this); nodePalette->installEventFilter(this); @@ -769,15 +777,7 @@ void ScribusMainWindow::initPalettes() connect(docCheckerPalette, SIGNAL(selectPage(int)), this, SLOT(selectPagesFromOutlines(int))); connect(docCheckerPalette, SIGNAL(selectMasterPage(QString)), this, SLOT(editMasterPagesStart(QString))); - // Undo - undoPalette = new UndoPalette(this, "undoPalette"); - wdg_indigoDockManager->addIndigoPanel(wdg_indigoDock, undoPalette, IndigoPanel::HiddenDocked, true); - undoPalette->installEventFilter(this); - m_undoManager->registerGui(undoPalette); - connect(undoPalette, SIGNAL(paletteShown(bool)), this, SLOT(setUndoPalette(bool))); - connect(undoPalette, SIGNAL(objectMode(bool)), this, SLOT(setUndoMode(bool))); - - // initializing style manager here too even it's not strictly a palette + // initializing style manager here too even it's not strictly a palette m_styleManager = new StyleManager(this, "styleManager"); SMCharacterStyle *tmpCS = new SMCharacterStyle(); m_styleManager->addStyle(new SMParagraphStyle(tmpCS)); diff --git a/scribus/ui/aligndistribute.cpp b/scribus/ui/aligndistribute.cpp index 217aac9..7dd8f7a 100644 --- a/scribus/ui/aligndistribute.cpp +++ b/scribus/ui/aligndistribute.cpp @@ -53,7 +53,7 @@ AlignDistributePalette::AlignDistributePalette( QWidget* parent, const char* nam //setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); currDoc=NULL; guideDirection=-1; - setObjectName(name); + setObjectName(name); //hide spare controls toolButtonDummy1->hide(); diff --git a/scribus/ui/indigodock.cpp b/scribus/ui/indigodock.cpp index d75c666..138b0f0 100644 --- a/scribus/ui/indigodock.cpp +++ b/scribus/ui/indigodock.cpp @@ -307,7 +307,7 @@ void IndigoDock::updateMinHeight(){ // reset size limit setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); - update(); + update(); } } diff --git a/scribus/ui/indigodockmanager.cpp b/scribus/ui/indigodockmanager.cpp index 19fd4f4..8937680 100644 --- a/scribus/ui/indigodockmanager.cpp +++ b/scribus/ui/indigodockmanager.cpp @@ -55,7 +55,7 @@ void IndigoDockManager::setPrefsContext(QString context) prefsContextName=context; if (!prefsContextName.isEmpty()) { - palettePrefs = PrefsManager::instance()->prefsFile->getContext(prefsContextName); + palettePrefs = PrefsManager::instance()->prefsFile->getContext(prefsContextName); } else{ palettePrefs = NULL; diff --git a/scribus/ui/indigopanel.cpp b/scribus/ui/indigopanel.cpp index 59de771..862d902 100644 --- a/scribus/ui/indigopanel.cpp +++ b/scribus/ui/indigopanel.cpp @@ -84,6 +84,7 @@ IndigoPanelHandle::IndigoPanelHandle(QWidget *parent) : setLayout(mainLayout); setObjectName("IndigoPanelHandle"); + enableExpander(false); // Actions connect(wdg_btnClose, SIGNAL (clicked()), parent, SLOT (hide())); @@ -179,6 +180,17 @@ void IndigoPanelHandle::setExpanderState(IndigoExpanderState expanderState){ } + +void IndigoPanelHandle::enableExpander(bool visible){ + bool_showExpander = visible; + + if(bool_showExpander){ + wdg_btnExpander->show(); + }else wdg_btnExpander->hide(); + +} + + /*##################### # # @@ -192,7 +204,8 @@ IndigoPanel::IndigoPanel(QString name, QWidget *dock) : QFrame(dock), palettePrefs(0), prefsContextName(QString::null), - bool_visibleOnStartup(false) + bool_visibleOnStartup(false), + bool_showExpander(false) { int int_padding = 5; @@ -242,7 +255,7 @@ IndigoPanel::IndigoPanel(QString name, QWidget *dock) : // Extended Properties int_index = -1; - m_state = IndigoPanel::None; + m_state = IndigoPanel::Docked; m_expander = IndigoPanelHandle::Normal; // General Properties @@ -256,6 +269,7 @@ IndigoPanel::IndigoPanel(QString name, QWidget *dock) : setObjectName(name); setIcon(icon, 0); setHandleWidth(int_handleWidth); + enableExpander(bool_showExpander); setPrefsContext(name); } @@ -851,7 +865,7 @@ void IndigoPanel::setDockState(IndigoPanel::IndigoDockState state){ switch(state){ case IndigoPanel::HiddenDocked: - QFrame::hide(); + QFrame::hide(); break; case IndigoPanel::Floating: @@ -863,7 +877,7 @@ void IndigoPanel::setDockState(IndigoPanel::IndigoDockState state){ case IndigoPanel::Docked: case IndigoPanel::None: default: - QFrame::show(); + QFrame::show(); break; } @@ -977,3 +991,12 @@ int IndigoPanel::dockWidth(){ return int_dockWidth; } + + + +void IndigoPanel::enableExpander(bool visible) +{ + bool_showExpander = visible; + wdg_handle->enableExpander(visible); + +} diff --git a/scribus/ui/indigopanel.h b/scribus/ui/indigopanel.h index a8028e3..324b532 100644 --- a/scribus/ui/indigopanel.h +++ b/scribus/ui/indigopanel.h @@ -60,6 +60,7 @@ class IndigoPanelHandle : public QWidget void setCaption(QString title, int fontSize); void setIcon(QIcon icon, int iconSize); void setExpanderState(IndigoExpanderState expanderState); + void enableExpander(bool visible); protected: void paintEvent(QPaintEvent *event); @@ -71,6 +72,7 @@ class IndigoPanelHandle : public QWidget int int_fontSize; QToolButton * wdg_btnClose; QToolButton * wdg_btnExpander; + bool bool_showExpander; signals: @@ -88,12 +90,12 @@ class IndigoPanel : public QFrame public: enum IndigoDockState{ - HiddenDocked = 0, - Floating = 1, - Docked = 2, - None = 3 + HiddenDocked = 0, + Floating = 1, + Docked = 2, + None = 3 - }; + }; @@ -124,6 +126,7 @@ class IndigoPanel : public QFrame IndigoPanelHandle::IndigoExpanderState expanderState(); void setExpanderState(IndigoPanelHandle::IndigoExpanderState expanderState); void setExpanderState(int expanderState); + void enableExpander(bool visible); void setOrientation(Qt::Orientation orientation); void setHandleWidth(int width); @@ -175,6 +178,7 @@ class IndigoPanel : public QFrame int int_index; IndigoDockState m_state; IndigoPanelHandle::IndigoExpanderState m_expander; + bool bool_showExpander; Qt::Orientation m_orientation; int int_handleWidth; diff --git a/scribus/ui/indigotabbar.cpp b/scribus/ui/indigotabbar.cpp index 3187f19..fae8d54 100644 --- a/scribus/ui/indigotabbar.cpp +++ b/scribus/ui/indigotabbar.cpp @@ -226,6 +226,8 @@ void IndigoTabBar::insertTab(QIcon icon, int index, QString toolTip){ void IndigoTabBar::removeTab(int index){ + if(lst_TabList.size() == 0) return; + if(index >= 0 && index <= lst_TabList.size()){ lst_TabList.removeAt(index); @@ -255,6 +257,8 @@ void IndigoTabBar::moveTab(){ void IndigoTabBar::hideTab(int index){ + if(lst_TabList.size() == 0) return; + if(index >= 0 && index <= lst_TabList.size()){ lst_TabList.at(index)->setDisplayState(IndigoTab::Hidden); calculateSize(); @@ -266,6 +270,8 @@ void IndigoTabBar::hideTab(int index){ void IndigoTabBar::showTab(int index){ + if(lst_TabList.size() == 0) return; + if(index >= 0 && index <= lst_TabList.size()){ lst_TabList.at(index)->setDisplayState(IndigoTab::Visible); calculateSize();