Index: trunk/koffice/kivio/kiviopart/kivio_view.cpp =================================================================== --- trunk/koffice/kivio/kiviopart/kivio_view.cpp (revision 219195) +++ trunk/koffice/kivio/kiviopart/kivio_view.cpp (revision 219196) @@ -1,1923 +1,1924 @@ /* * Kivio - Visual Modelling and Flowcharting * Copyright (C) 2000-2001 theKompany.com & Dave Marotti * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include // has to be first #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kivio_view.h" #include "kivio_dlg_pageshow.h" #include "kivio_factory.h" #include "kivio_map.h" #include "kivio_page.h" #include "kivio_doc.h" #include "kivio_canvas.h" #include "kivio_stencil_spawner.h" #include "kivio_tabbar.h" #include "kivio_zoomaction.h" #include "kivio_grid_data.h" #include "kivio_config.h" #include "tkcoloractions.h" #include "kivio_lineendsaction.h" #include "tkfloatspinboxaction.h" #include "tk2floatspinboxaction.h" #include "tkcombobox.h" #include "tooldockmanager.h" #include "tooldockbase.h" #include "kivio_protection_panel.h" #include "kivio_stencil_geometry_panel.h" #include "kivio_viewmanager_panel.h" #include "kivio_layer_panel.h" #include "kivio_birdeye_panel.h" #include "export_page_dialog.h" #include "aligndialog.h" #include "kiviooptionsdialog.h" #include "stencilbardockmanager.h" -#include "add_spawner_set_dlg.h" #include "kivio_common.h" #include "kivio_painter.h" #include "kivio_rect.h" #include "kivio_stencil.h" #include "kivio_stencil_spawner_set.h" #include "kivio_screen_painter.h" #include "kivio_ps_printer.h" #include "tool_controller.h" #include "handler.h" #include "kivio_stackbar.h" #include "kivio_icon_view.h" #include "kivio_paragraph_action.h" #include "KIvioViewIface.h" #include "kivio_command.h" +#include "kiviostencilsetaction.h" #include #define TOGGLE_ACTION(X) ((KToggleAction*)actionCollection()->action(X)) #define MOUSEPOS_TEXT 1000 using namespace Kivio; KivioView::KivioView( QWidget *_parent, const char *_name, KivioDoc* doc ) : KoView( doc, _parent, _name ) { m_zoomHandler = new KoZoomHandler(); zoomHandler()->setZoomAndResolution(100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY()); m_pDoc = doc; m_pActivePage = 0; dcop = 0; dcopObject(); // build it KStatusBar* sb = statusBar(); if(sb) { QString unit = KoUnit::unitName(m_pDoc->units()); KoPoint xy(0, 0); QString text = i18n("X: %1 %3 Y: %2 %4").arg(KGlobal::_locale->formatNumber(xy.x(), 2)) .arg(KGlobal::_locale->formatNumber(xy.y(), 2)).arg(unit).arg(unit); sb->insertItem(text, MOUSEPOS_TEXT, 0, true); } bool isModified = doc->isModified(); m_pTools = new ToolController(this); m_pDockManager = new StencilBarDockManager(this); m_pDockManager->setDoc( doc ); // QGridLayout for the entire view QGridLayout *viewGrid = new QGridLayout(this); viewGrid->addWidget(m_pDockManager, 0, 0); // Load any already-loaded stencils into the stencil dock if( m_pDoc->isReadWrite() ) // only if not embedded in Konqueror { KivioStencilSpawnerSet *pSet; pSet = m_pDoc->spawnerSets()->first(); while( pSet ) { addSpawnerToStackBar( pSet ); pSet = m_pDoc->spawnerSets()->next(); } } // A widget to hold the entire right side (old view) QWidget *pRightSide = new QWidget(m_pDockManager); m_pDockManager->setView(pRightSide); // Split tabbar and Horz. Scroll Bar QSplitter* tabSplit = new QSplitter(pRightSide); // Tab Bar m_pTabBar = new KivioTabBar(tabSplit,this); connect( m_pTabBar, SIGNAL(tabChanged(const QString&)), SLOT( changePage(const QString&))); // Scroll Bar QScrollBar* vertScrollBar = new QScrollBar(QScrollBar::Vertical,pRightSide); QScrollBar* horzScrollBar = new QScrollBar(QScrollBar::Horizontal,tabSplit); // Tab Bar Button m_pTabBarFirst = newIconButton("tab_first", false, pRightSide); connect( m_pTabBarFirst, SIGNAL(clicked()), m_pTabBar, SLOT(scrollFirst())); m_pTabBarLeft = newIconButton("tab_left", false, pRightSide); connect( m_pTabBarLeft, SIGNAL(clicked()), m_pTabBar, SLOT(scrollLeft())); m_pTabBarRight = newIconButton("tab_right", false, pRightSide); connect( m_pTabBarRight, SIGNAL(clicked()), m_pTabBar, SLOT(scrollRight())); m_pTabBarLast = newIconButton("tab_last", false, pRightSide); connect( m_pTabBarLast, SIGNAL(clicked()), m_pTabBar, SLOT(scrollLast())); QHBoxLayout* tabLayout = new QHBoxLayout(); tabLayout->addWidget(m_pTabBarFirst); tabLayout->addWidget(m_pTabBarLeft); tabLayout->addWidget(m_pTabBarRight); tabLayout->addWidget(m_pTabBarLast); tabLayout->addWidget(tabSplit); // The widget on which we display the page QWidgetStack* canvasBase = new QWidgetStack(pRightSide); m_pCanvas = new KivioCanvas(canvasBase,this,doc,m_pTools,vertScrollBar,horzScrollBar/*,vRuler,hRuler*/); canvasBase->addWidget(m_pCanvas,0); canvasBase->raiseWidget(m_pCanvas); m_pCanvas->setFocusPolicy(QWidget::StrongFocus); // Ruler's vRuler = new KoRuler(pRightSide, m_pCanvas, Qt::Vertical, m_pDoc->config() ->defaultPageLayout(), KoRuler::F_HELPLINES, m_pDoc->units()); vRuler->showMousePos(true); vRuler->setMinimumWidth(34); vRuler->setMaximumWidth(34); vRuler->setZoom(zoomHandler()->zoomedResolutionY()); hRuler = new KoRuler(pRightSide, m_pCanvas, Qt::Horizontal, m_pDoc->config() ->defaultPageLayout(), KoRuler::F_HELPLINES, m_pDoc->units()); hRuler->showMousePos(true); hRuler->setMinimumHeight(34); hRuler->setMaximumHeight(34); hRuler->setZoom(zoomHandler()->zoomedResolutionX()); connect(vertScrollBar, SIGNAL(valueChanged(int)), SLOT(setRulerVOffset(int))); connect(horzScrollBar, SIGNAL(valueChanged(int)), SLOT(setRulerHOffset(int))); connect(vRuler, SIGNAL(unitChanged(QString)), SLOT(rulerChangedUnit(QString))); connect(hRuler, SIGNAL(unitChanged(QString)), SLOT(rulerChangedUnit(QString))); connect(vRuler, SIGNAL(openPageLayoutDia()), SLOT(paperLayoutDlg())); connect(hRuler, SIGNAL(openPageLayoutDia()), SLOT(paperLayoutDlg())); connect( m_pDoc, SIGNAL(unitsChanged(KoUnit::Unit)), SLOT(setRulerUnit(KoUnit::Unit)) ); QGridLayout* layout = new QGridLayout(pRightSide); layout->addWidget(hRuler, 0, 1); layout->addWidget(vRuler, 1, 0); layout->addWidget(canvasBase, 1, 1); layout->addMultiCellLayout(tabLayout, 2, 2, 0, 1); layout->addMultiCellWidget(vertScrollBar, 0, 1, 2, 2); layout->setRowStretch(1, 10); layout->setColStretch(1, 10); QWidget::setFocusPolicy( QWidget::StrongFocus ); setFocusProxy( m_pCanvas ); connect( this, SIGNAL( invalidated() ), m_pCanvas, SLOT( update() ) ); connect( this, SIGNAL( regionInvalidated( const QRegion&, bool ) ), m_pCanvas, SLOT( repaint( const QRegion&, bool ) ) ); connect(m_pCanvas, SIGNAL(zoomChanges()), SLOT(canvasZoomChanged())); m_pToolDock = new ToolDockManager(canvasBase); setInstance(KivioFactory::global()); if ( !m_pDoc->isReadWrite() ) setXMLFile("kivio_readonly.rc"); else setXMLFile("kivio.rc"); // Must be executed before setActivePage() and before setupActions() createGeometryDock(); createViewManagerDock(); createLayerDock(); createBirdEyeDock(); createProtectionDock(); setupActions(); KivioPage* page; for ( page = m_pDoc->map()->firstPage(); page; page = m_pDoc->map()->nextPage() ) addPage(page); setActivePage(m_pDoc->map()->firstPage()); connect( m_pDoc, SIGNAL( sig_selectionChanged() ), SLOT( updateToolBars() ) ); connect( m_pDoc, SIGNAL( sig_addPage(KivioPage*) ), SLOT( slotAddPage(KivioPage*) ) ); connect( m_pDoc, SIGNAL( sig_addSpawnerSet(KivioStencilSpawnerSet*) ), SLOT(addSpawnerToStackBar(KivioStencilSpawnerSet*)) ); connect( m_pDoc, SIGNAL( sig_updateView(KivioPage*) ), SLOT(slotUpdateView(KivioPage*)) ); connect( m_pDoc, SIGNAL( sig_pageNameChanged(KivioPage*,const QString&)), SLOT(slotPageRenamed(KivioPage*,const QString&)) ); connect( m_pDoc, SIGNAL( sig_updateGrid()),SLOT(slotUpdateGrid())); initActions(); m_pCanvas->centerPage(); m_pDoc->setModified(isModified); } KivioView::~KivioView() { delete dcop; delete m_zoomHandler; } DCOPObject* KivioView::dcopObject() { if ( !dcop ) { dcop = new KIvioViewIface( this ); } return dcop; } void KivioView::createGeometryDock() { m_pStencilGeometryPanel = new KivioStencilGeometryPanel(this); ToolDockBase* stencilGeometryBase = toolDockManager()->createToolDock(m_pStencilGeometryPanel,i18n("Geometry")); stencilGeometryBase->move(0,0); connect( m_pStencilGeometryPanel, SIGNAL(positionChanged(double, double)), this, SLOT(slotChangeStencilPosition(double, double)) ); connect( m_pStencilGeometryPanel, SIGNAL(sizeChanged(double, double)), this, SLOT(slotChangeStencilSize(double, double)) ); connect( m_pDoc, SIGNAL(unitsChanged(KoUnit::Unit)), m_pStencilGeometryPanel, SLOT(setUnit(KoUnit::Unit)) ); KToggleAction* showStencilGeometry = new KToggleAction( i18n("Stencil Geometry Panel"), "stencil_geometry", 0, actionCollection(), "stencilGeometry" ); connect( showStencilGeometry, SIGNAL(toggled(bool)), stencilGeometryBase, SLOT(makeVisible(bool))); connect( stencilGeometryBase, SIGNAL(visibleChange(bool)), SLOT(toggleStencilGeometry(bool))); } void KivioView::createViewManagerDock() { m_pViewManagerPanel = new KivioViewManagerPanel(this, this); ToolDockBase* viewManagerBase = toolDockManager()->createToolDock(m_pViewManagerPanel,i18n("View Manager")); viewManagerBase->move(0,0); KToggleAction* showViewManager = new KToggleAction( i18n("View Manager"), "view_manager", 0, actionCollection(), "viewManager" ); connect( showViewManager, SIGNAL(toggled(bool)), viewManagerBase, SLOT(makeVisible(bool))); connect( viewManagerBase, SIGNAL(visibleChange(bool)), SLOT(toggleViewManager(bool))); } void KivioView::createBirdEyeDock() { m_pBirdEyePanel = new KivioBirdEyePanel(this, this); ToolDockBase* birdEyeBase = toolDockManager()->createToolDock(m_pBirdEyePanel,i18n("Bird's Eye")); birdEyeBase->move(0,0); KToggleAction* showBirdEye = new KToggleAction( i18n("Bird's Eye"), 0, actionCollection(), "birdEye" ); connect( showBirdEye, SIGNAL(toggled(bool)), birdEyeBase, SLOT(makeVisible(bool))); connect( birdEyeBase, SIGNAL(visibleChange(bool)), SLOT(toggleBirdEyePanel(bool))); } void KivioView::createLayerDock() { m_pLayersPanel = new KivioLayerPanel( this, this); ToolDockBase* layersBase = toolDockManager()->createToolDock(m_pLayersPanel,i18n("Layers")); layersBase->move(0,0); KToggleAction* showLayers = new KToggleAction( i18n("Layers Manager"), CTRL+Key_L, actionCollection(), "layersPanel" ); connect( showLayers, SIGNAL(toggled(bool)), layersBase, SLOT(makeVisible(bool))); connect( layersBase, SIGNAL(visibleChange(bool)), SLOT(toggleLayersPanel(bool))); } void KivioView::createProtectionDock() { m_pProtectionPanel = new KivioProtectionPanel(this,this); ToolDockBase* protectionBase = toolDockManager()->createToolDock(m_pProtectionPanel,i18n("Protection")); protectionBase->move(0,0); KToggleAction *showProtection = new KToggleAction( i18n("Protection"), CTRL+SHIFT+Key_P, actionCollection(), "protection" ); connect( showProtection, SIGNAL(toggled(bool)), protectionBase, SLOT(makeVisible(bool))); connect( protectionBase, SIGNAL(visibleChange(bool)), SLOT(toggleProtectionPanel(bool))); } void KivioView::setupActions() { - //FIXME: Port to KOffice! - AddSpawnerSetAction* addSpSet = new AddSpawnerSetAction( i18n("Add Stencil Set"), "open_stencilset", 0, actionCollection(), "addStencilSet" ); + KivioStencilSetAction* addSpSet = new KivioStencilSetAction( i18n("Add Stencil Set"), + "open_stencilset", actionCollection(), "addStencilSet" ); connect(addSpSet,SIGNAL(activated(const QString&)),SLOT(addStencilSet(const QString&))); - (void) new KAction( i18n("Align && Distribute..."), ALT+Key_A, this, SLOT(alignStencilsDlg()), actionCollection(), "alignStencils" ); + (void) new KAction( i18n("Align && Distribute..."), ALT+Key_A, this, + SLOT(alignStencilsDlg()), actionCollection(), "alignStencils" ); KStdAction::cut( this, SLOT(cutStencil()), actionCollection(), "cutStencil" ); m_editCopy=KStdAction::copy( this, SLOT(copyStencil()), actionCollection(), "copyStencil" ); KStdAction::paste( this, SLOT(pasteStencil()), actionCollection(), "pasteStencil" ); m_selectAll=KStdAction::selectAll( this, SLOT( selectAllStencils() ), actionCollection(), "selectAllStencils" ); m_selectNone=new KAction( i18n("Select None"), CTRL+SHIFT+Key_A, this, SLOT(unselectAllStencils()), actionCollection(), "unselectAllStencils" ); (void) new KAction( i18n("Group Selected Stencils"), "group_stencils", CTRL+Key_G, this, SLOT(groupStencils()), actionCollection(), "groupStencils" ); (void) new KAction( i18n("Ungroup Selected Stencils"), "ungroup_stencils", CTRL+SHIFT+Key_G, this, SLOT(ungroupStencils()), actionCollection(), "ungroupStencils" ); (void) new KAction( i18n("Bring to Front"), "bring_stencil_to_front", 0, this, SLOT(bringStencilToFront()), actionCollection(), "bringStencilToFront" ); (void) new KAction( i18n("Send to Back"), "send_stencil_to_back", 0, this, SLOT(sendStencilToBack()), actionCollection(), "sendStencilToBack" ); /* Create the fg color button */ //FIXME: Port to KOffice! m_setFGColor = new TKSelectColorAction( i18n("Set Foreground Color"), TKSelectColorAction::LineColor, actionCollection(), "setFGColor" ); connect(m_setFGColor,SIGNAL(activated()),SLOT(setFGColor())); m_setBGColor = new TKSelectColorAction( i18n("Set Background Color"), TKSelectColorAction::FillColor, actionCollection(), "setBGColor" ); connect(m_setBGColor,SIGNAL(activated()),SLOT(setBGColor())); // Text bar m_setFontFamily = new KFontAction( i18n( "Set Font Family" ), 0, actionCollection(), "setFontFamily" ); connect( m_setFontFamily, SIGNAL(activated(const QString&)), SLOT(setFontFamily(const QString&)) ); m_setFontSize = new KFontSizeAction( i18n( "Set Font Size" ), 0, actionCollection(), "setFontSize" ); connect( m_setFontSize, SIGNAL( fontSizeChanged( int ) ), this, SLOT( setFontSize(int ) ) ); m_setTextColor = new TKSelectColorAction( i18n("Set Text Color"), TKSelectColorAction::TextColor, actionCollection(), "setTextColor" ); connect( m_setTextColor, SIGNAL(activated()), SLOT(setTextColor()) ); m_setBold = new KToggleAction( i18n("Toggle Bold Text"), "font_bold", 0, actionCollection(), "setFontBold" ); connect( m_setBold, SIGNAL(toggled(bool)), SLOT(toggleFontBold(bool)) ); m_setItalics = new KToggleAction( i18n("Toggle Italics Text"), "font_italic", 0, actionCollection(), "setFontItalics" ); connect( m_setItalics, SIGNAL(toggled(bool)), SLOT(toggleFontItalics(bool)) ); m_setUnderline = new KToggleAction( i18n("Toggle Underline Text"), "font_under", 0, actionCollection(), "setFontUnderline" ); connect( m_setUnderline, SIGNAL(toggled(bool)), SLOT(toggleFontUnderline(bool))); //FIXME: Port to KOffice! m_setHTextAlignment = new KivioParagraphAction( false, actionCollection(), "setHTextAlignment" ); m_setVTextAlignment = new KivioParagraphAction( true, actionCollection(), "setVTextAlignment" ); connect( m_setHTextAlignment, SIGNAL(activated(int)), SLOT(setHParaAlign(int)) ); connect( m_setVTextAlignment, SIGNAL(activated(int)), SLOT(setVParaAlign(int)) ); QWidget* lineWidthWidget = new QWidget(this, "kde toolbar widget"); QLabel* lineWidthLbl = new QLabel(lineWidthWidget, "kde toolbar widget"); lineWidthLbl->setPixmap(kapp->iconLoader()->loadIcon("linewidth", KIcon::Toolbar, 22)); m_setLineWidth = new KoUnitDoubleSpinBox(lineWidthWidget, 0.0, 1000.0, 0.1, 1.0, m_pDoc->units(), 2, "kde toolbar widget"); QHBoxLayout* lwl = new QHBoxLayout(lineWidthWidget); lwl->addWidget(lineWidthLbl); lwl->addWidget(m_setLineWidth); (void*) new KWidgetAction(lineWidthWidget, i18n( "Set Line Width" ), 0, this, SLOT( setLineWidth() ), actionCollection(), "setLineWidth" ); connect(m_setLineWidth, SIGNAL(valueChanged(double)), SLOT(setLineWidth())); connect(m_pDoc, SIGNAL(unitsChanged(KoUnit::Unit)), SLOT(setLineWidthUnit(KoUnit::Unit))); m_paperLayout = new KAction( i18n("Paper Layout..."), 0, this, SLOT(paperLayoutDlg()), actionCollection(), "paperLayout" ); m_insertPage = new KAction( i18n("Insert Page"),"item_add", 0, this, SLOT(insertPage()), actionCollection(), "insertPage" ); m_removePage = new KAction( i18n("Remove Page"), "item_remove",0,this, SLOT(removePage()), actionCollection(), "removePage" ); m_renamePage = new KAction( i18n("Rename Page..."), "item_rename",0,this, SLOT(renamePage()), actionCollection(), "renamePage" ); m_showPage = new KAction( i18n("Show Page..."),0 ,this,SLOT(showPage()), actionCollection(), "showPage" ); m_hidePage = new KAction( i18n("Hide Page"),0 ,this,SLOT(hidePage()), actionCollection(), "hidePage" ); m_exportPage = new KAction( i18n("Export Page..."),0,this,SLOT(exportPage()), actionCollection(), "exportPage"); showPageBorders = new KToggleAction( i18n("Show Page Borders"), BarIcon("view_pageborder",KivioFactory::global()), CTRL+Key_B, actionCollection(), "showPageBorders" ); connect( showPageBorders, SIGNAL(toggled(bool)), SLOT(togglePageBorders(bool))); showPageMargins = new KToggleAction( i18n("Show Page Margins"), "view_margins", 0, actionCollection(), "showPageMargins" ); connect( showPageMargins, SIGNAL(toggled(bool)), SLOT(togglePageMargins(bool))); showRulers = new KToggleAction( i18n("Show Rulers"), "view_ruler", 0, actionCollection(), "showRulers" ); connect( showRulers, SIGNAL(toggled(bool)), SLOT(toggleShowRulers(bool))); // Grid actions showGrid = new KToggleAction( i18n("Show Grid"), "view_grid", 0, actionCollection(), "showGrid" ); connect( showGrid, SIGNAL(toggled(bool)), SLOT(toggleShowGrid(bool))); KToggleAction* snapGrid = new KToggleAction( i18n("Snap Grid"), "view_grid", 0, actionCollection(), "snapGrid" ); connect( snapGrid, SIGNAL(toggled(bool)), SLOT(toggleSnapGrid(bool))); // Guides actions showGuides = new KToggleAction( i18n("Show Guides"), 0, actionCollection(), "showGuides" ); connect( showGuides, SIGNAL(toggled(bool)), SLOT(toggleShowGuides(bool))); KToggleAction* snapGuides = new KToggleAction( i18n("Snap Guides"), 0, actionCollection(), "snapGuides" ); connect( snapGuides, SIGNAL(toggled(bool)), SLOT(toggleSnapGuides(bool))); //-- m_viewZoom = new KSelectAction(i18n("Zoom &Level"), "viewmag", 0, actionCollection(), "viewZoom"); m_viewZoom->setEditable(true); connect(m_viewZoom, SIGNAL(activated(const QString&)), SLOT(viewZoom(const QString&))); changeZoomMenu(); // FIXME: Port to KOffice! m_setEndArrow = new LineEndsAction( false, actionCollection(), "endArrowHead" ); m_setStartArrow = new LineEndsAction( true, actionCollection(), "startArrowHead" ); connect( m_setEndArrow, SIGNAL(activated(int)), SLOT(slotSetEndArrow(int))); connect( m_setStartArrow, SIGNAL(activated(int)), SLOT(slotSetStartArrow(int))); m_setEndArrowSize = new TKSizeAction(actionCollection(), "endArrowSize"); m_setStartArrowSize = new TKSizeAction(actionCollection(), "startArrowSize"); connect( m_pDoc, SIGNAL(unitsChanged(int)), m_setEndArrowSize, SLOT(setUnit(int)) ); connect( m_setEndArrowSize, SIGNAL(activated()), SLOT(slotSetEndArrowSize())); connect( m_pDoc, SIGNAL(unitsChanged(int)), m_setStartArrowSize, SLOT(setUnit(int)) ); connect( m_setStartArrowSize, SIGNAL(activated()), SLOT(slotSetStartArrowSize())); connect( m_pDoc, SIGNAL(unitsChanged(KoUnit::Unit)), SLOT(setRulerUnit(KoUnit::Unit)) ); KStdAction::preferences(this, SLOT(optionsDialog()), actionCollection(), "options" ); } void KivioView::initActions() { togglePageBorders(true); togglePageMargins(true); toggleShowRulers(true); updateButton(); viewZoom(zoomHandler()->zoom()); //m_unitAct->setCurrentItem(m_pDoc->units()); //m_unitAct->activate(m_pDoc->units()); } void KivioView::viewGUIActivated( bool active ) { if ( active ) m_pTools->activateView(this); } QButton* KivioView::newIconButton( const char* file, bool kbutton, QWidget* parent ) { if (!parent) parent = this; QPixmap *pixmap = new QPixmap(BarIcon(file,KivioFactory::global())); QButton *pb; if (!kbutton) pb = new QPushButton(parent); else pb = new QToolButton(parent); if (pixmap) pb->setPixmap(*pixmap); pb->setFixedSize(16,16); delete pixmap; return pb; } void KivioView::updateReadWrite( bool readwrite ) { QValueList actions = actionCollection()->actions(); QValueList::ConstIterator aIt = actions.begin(); QValueList::ConstIterator aEnd = actions.end(); for (; aIt != aEnd; ++aIt ) (*aIt)->setEnabled( readwrite ); if ( !readwrite ) { showPageBorders->setEnabled( true ); showPageMargins->setEnabled( true ); showRulers->setEnabled( true ); showGrid->setEnabled( true ); showGuides->setEnabled( true ); m_selectAll->setEnabled( true ); m_selectNone->setEnabled( true ); m_editCopy->setEnabled( true ); } m_showPage->setEnabled( true ); m_hidePage->setEnabled( true ); updateMenuPage(); } void KivioView::addPage( KivioPage* page ) { insertPage( page ); QObject::connect( page, SIGNAL( sig_PageHidden( KivioPage* ) ), this, SLOT( slotPageHidden( KivioPage* ) ) ); QObject::connect( page, SIGNAL( sig_PageShown( KivioPage* ) ), this, SLOT( slotPageShown( KivioPage* ) ) ); } void KivioView::insertPage( KivioPage* page ) { if( !page->isHidden() ) { m_pTabBar->addTab(page->pageName()); setActivePage(page); } else { m_pTabBar->addHiddenTab(page->pageName()); } } void KivioView::removePage( KivioPage *_t ) { QString m_pageName=_t->pageName(); m_pTabBar->removeTab( _t->pageName() ); setActivePage( m_pDoc->map()->findPage( m_pTabBar->listshow().first() )); } void KivioView::renamePage() { m_pTabBar->slotRename(); } void KivioView::setActivePage( KivioPage* page ) { if ( page == m_pActivePage ) return; disconnect(m_pActivePage, SIGNAL(sig_pageLayoutChanged(const KoPageLayout&)), this, 0); m_pActivePage = page; m_pTabBar->setActiveTab(page->pageName()); updateToolBars(); m_pLayersPanel->reset(); m_pDoc->updateView(m_pActivePage); setRulerPageLayout(m_pActivePage->paperLayout()); connect(m_pActivePage, SIGNAL(sig_pageLayoutChanged(const KoPageLayout&)), SLOT(setRulerPageLayout(const KoPageLayout&))); } void KivioView::setActiveSpawnerSet( KivioStencilSpawnerSet *set ) { if( set == m_pActiveSpawnerSet ) return; m_pActiveSpawnerSet = set; } void KivioView::slotPageRenamed( KivioPage* page, const QString& old_name ) { m_pTabBar->renameTab( old_name, page->pageName() ); } void KivioView::changePage( const QString& name ) { if ( m_pActivePage->pageName() == name ) return; KivioPage *t = m_pDoc->map()->findPage(name); if (!t) return; setActivePage(t); } void KivioView::insertPage() { KivioPage * t =m_pDoc->createPage(); m_pDoc->addPage(t); KivioAddPageCommand * cmd = new KivioAddPageCommand(i18n("Insert Page"), t); m_pDoc->addCommand( cmd ); } void KivioView::hidePage() { if (!m_pActivePage) return; m_pTabBar->hidePage(); } void KivioView::showPage() { KivioPageShow* dlg = new KivioPageShow(this,"Page show"); dlg->exec(); delete dlg; } int KivioView::leftBorder() const { return 0; } int KivioView::rightBorder() const { return 0; } int KivioView::topBorder() const { return 0; } int KivioView::bottomBorder() const { return 0; } void KivioView::paperLayoutDlg() { doc()->config()->paperLayoutSetup(this); } void KivioView::removePage() { if ( doc()->map()->count() <= 1 || m_pTabBar->listshow().count()<=1 ) { QApplication::beep(); KMessageBox::sorry( this, i18n("You cannot delete the only page of the document."), i18n("Remove Page") ); return; } QApplication::beep(); int ret = KMessageBox::warningYesNo(this,i18n("You are going to remove the active page.\nDo you want to continue?"),i18n("Remove Page")); if ( ret == 3 ) { KivioPage* tbl = m_pActivePage; KivioRemovePageCommand *cmd = new KivioRemovePageCommand(i18n("Remove Page"), tbl); cmd->execute(); doc()->addCommand( cmd ); //doc()->map()->removePage( tbl ); //removePage(tbl); //delete tbl; } } void KivioView::slotAddPage( KivioPage* page ) { addPage(page); } void KivioView::slotUpdateView( KivioPage* page ) { if (page && page != m_pActivePage) return; if (!page) { // global view updates (toolbar, statusbar.... actions...) updateToolBars(); } m_pCanvas->update(); m_pCanvas->updateScrollBars(); vRuler->update(); hRuler->update(); } void KivioView::paintContent( KivioPainter&, const QRect&, bool) { // m_pDoc->paintContent( painter, rect, transparent, m_pActivePage ); // temporary m_pCanvas->update(); } QWidget *KivioView::canvas() { return canvasWidget(); } int KivioView::canvasXOffset() const { return canvasWidget()->xOffset(); } int KivioView::canvasYOffset() const { return canvasWidget()->yOffset(); } void KivioView::print(KPrinter& ptr) { /*********** * The old way of printing ***********/ /* KivioPage *pPage; KivioPSPrinter p; int i=0; if ( m_pActivePage ) { p.start("/test.ps", m_pDoc->map()->pageList().count() ); // Iterate through all the pages // FIXME: Make it adhere to those chosen in the dialog pPage = m_pDoc->map()->firstPage(); while( pPage ) { p.startPage( i+1 ); pPage->print( &p ); p.stopPage(); i++; pPage = m_pDoc->map()->nextPage(); } p.stop(); */ ptr.setFullPage(TRUE); m_pDoc->printContent( ptr ); /* KivioScreenPainter sp; ptr.setFullPage(TRUE); sp.start(&ptr); QRect r; QPoint p0; m_pActivePage->paintContent( sp, r, false, p0, 1.0f ); sp.stop(); */ // page->paintContent(painter,rect,transparent,p0,(float)zoom/100.0); // prt.setFullPage( TRUE ); // QPainter painter; // painter.begin( &prt ); // m_pActivePage->print( painter, &prt ); // painter.end(); // } // return; } void KivioView::viewZoom(int zoom) { zoomHandler()->setZoomAndResolution(zoom, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY()); m_pCanvas->update(); m_pCanvas->updateScrollBars(); vRuler->setZoom(zoomHandler()->zoomedResolutionY()); hRuler->setZoom(zoomHandler()->zoomedResolutionX()); KoPageLayout l = activePage()->paperLayout(); vRuler->setFrameStartEnd(zoomHandler()->zoomItY(l.ptTop), zoomHandler()->zoomItY(l.ptHeight - l.ptBottom)); hRuler->setFrameStartEnd(zoomHandler()->zoomItX(l.ptLeft), zoomHandler()->zoomItX(l.ptWidth - l.ptRight)); changeZoomMenu(zoom); showZoom(zoom); } void KivioView::canvasZoomChanged() { changeZoomMenu(zoomHandler()->zoom()); showZoom(zoomHandler()->zoom()); vRuler->setZoom(zoomHandler()->zoomedResolutionY()); hRuler->setZoom(zoomHandler()->zoomedResolutionX()); KoPageLayout l = activePage()->paperLayout(); vRuler->setFrameStartEnd(zoomHandler()->zoomItY(l.ptTop), zoomHandler()->zoomItY(l.ptHeight - l.ptBottom)); hRuler->setFrameStartEnd(zoomHandler()->zoomItX(l.ptLeft), zoomHandler()->zoomItX(l.ptWidth - l.ptRight)); } KivioPage* KivioView::activePage() { return m_pActivePage; } void KivioView::togglePageBorders(bool b) { TOGGLE_ACTION("showPageBorders")->setChecked(b); m_bShowPageBorders = b; m_pCanvas->update(); } void KivioView::togglePageMargins(bool b) { TOGGLE_ACTION("showPageMargins")->setChecked(b); m_bShowPageMargins = b; m_pCanvas->update(); } void KivioView::toggleShowRulers(bool b) { TOGGLE_ACTION("showRulers")->setChecked(b); m_bShowRulers = b; if(b) { hRuler->show(); vRuler->show(); } else { hRuler->hide(); vRuler->hide(); } } void KivioView::toggleShowGuides(bool b) { TOGGLE_ACTION("showGuides")->setChecked(b); m_bShowGuides = b; m_pCanvas->update(); } void KivioView::toggleSnapGuides(bool b) { TOGGLE_ACTION("snapGuides")->setChecked(b); m_bSnapGuides = b; } void KivioView::toggleShowGrid(bool b) { TOGGLE_ACTION("showGrid")->setChecked(b); KivioGridData d = m_pDoc->grid(); d.isShow = b; m_pDoc->setGrid(d); m_pDoc->setModified( true ); } void KivioView::slotUpdateGrid() { m_pCanvas->update(); } void KivioView::toggleSnapGrid(bool b) { TOGGLE_ACTION("snapGrid")->setChecked(b); KivioGridData d = m_pDoc->grid(); d.isSnap = b; m_pDoc->setGrid(d); m_pDoc->setModified( true ); } void KivioView::customEvent( QCustomEvent* e ) { if (KParts::GUIActivateEvent::test(e)) { viewGUIActivated(((KParts::GUIActivateEvent*)e)->activated()); } KoView::customEvent(e); } void KivioView::addStencilSet( const QString& name ) { m_pDoc->addSpawnerSet(name); } void KivioView::addSpawnerToStackBar( KivioStencilSpawnerSet *pSpawner ) { if( !pSpawner ) { kdDebug() << "KivioView::addSpawnerToStackBar() - NULL pSpawner" << endl; return; } KivioIconView *pView = new KivioIconView(m_pDoc->isReadWrite() ); QObject::connect( pView, SIGNAL(createNewStencil(KivioStencilSpawner*)), this, SLOT(addStencilFromSpawner(KivioStencilSpawner*))); pView->setStencilSpawnerSet( pSpawner ); m_pDockManager->insertStencilSet(pView, pSpawner->name()); } void KivioView::setFGColor() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand * macro = new KMacroCommand( i18n("Change Foreground Color")); bool createMacro = false; while( pStencil ) { QColor col( m_setFGColor->color()); if ( col != pStencil->fgColor() ) { KivioChangeStencilColorCommand * cmd = new KivioChangeStencilColorCommand( i18n("Change Fg Color"), m_pActivePage, pStencil, pStencil->fgColor(), col, KivioChangeStencilColorCommand::CT_FGCOLOR); pStencil->setFGColor( col ); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::setBGColor() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand * macro = new KMacroCommand( i18n("Change Background Color")); bool createMacro = false; while( pStencil ) { QColor col( m_setBGColor->color()); if ( col != pStencil->bgColor() ) { KivioChangeStencilColorCommand * cmd = new KivioChangeStencilColorCommand( i18n("Change Bg Color"), m_pActivePage, pStencil, pStencil->bgColor(), col, KivioChangeStencilColorCommand::CT_BGCOLOR); pStencil->setBGColor( col ); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::setTextColor() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand * macro = new KMacroCommand( i18n("Change Text Color")); bool createMacro = false; while( pStencil ) { QColor col(m_setTextColor->color()); if ( col != pStencil->textColor() ) { KivioChangeStencilColorCommand * cmd = new KivioChangeStencilColorCommand( i18n("Change Text Color"), m_pActivePage, pStencil, pStencil->textColor(), col, KivioChangeStencilColorCommand::CT_TEXTCOLOR); pStencil->setTextColor( col ); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::setLineWidth() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand * macro = new KMacroCommand( i18n("Change Line Width") ); bool createMacro = false ; while( pStencil ) { int newValue = KoUnit::ptFromUnit(m_setLineWidth->value(), m_pDoc->units()); if ( newValue != pStencil->lineWidth() ) { KivioChangeLineWidthCommand * cmd = new KivioChangeLineWidthCommand( i18n("Change Line Width"), m_pActivePage, pStencil, pStencil->lineWidth(), newValue ); pStencil->setLineWidth( newValue ); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::groupStencils() { m_pActivePage->groupSelectedStencils(); KivioRect r = m_pActivePage->getRectForAllStencils(); m_pDoc->updateView(m_pActivePage); } void KivioView::ungroupStencils() { m_pActivePage->ungroupSelectedStencils(); m_pDoc->updateView(m_pActivePage); } void KivioView::selectAllStencils() { m_pActivePage->selectAllStencils(); m_pCanvas->repaint(); } void KivioView::unselectAllStencils() { m_pActivePage->unselectAllStencils(); m_pCanvas->repaint(); } QColor KivioView::fgColor() const { return m_setFGColor->color(); } QColor KivioView::bgColor() const { return m_setBGColor->color(); } int KivioView::lineWidth() const { return (int)m_setLineWidth->value(); } void KivioView::setFontFamily( const QString &str ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; QFont f; KMacroCommand * macro = 0L; while( pStencil ) { f = pStencil->textFont(); f.setFamily( str ); if ( pStencil->textFont() != f ) { if ( !macro ) macro = new KMacroCommand( i18n("Change Stencil Font")); KivioChangeStencilFontCommand *cmd = new KivioChangeStencilFontCommand( i18n("Change Stencil Font"), m_pActivePage, pStencil,pStencil->textFont(), f); pStencil->setTextFont( f ); macro->addCommand( cmd ); } pStencil = m_pActivePage->selectedStencils()->next(); } if ( macro ) m_pDoc->addCommand( macro ); m_pDoc->updateView(m_pActivePage); } void KivioView::setFontSize(int size ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; QFont f; KMacroCommand * macro = 0L; while( pStencil ) { f = pStencil->textFont(); f.setPointSize( size ); if ( pStencil->textFont() != f ) { if ( !macro ) macro = new KMacroCommand( i18n("Change Stencil Font")); KivioChangeStencilFontCommand *cmd = new KivioChangeStencilFontCommand( i18n("Change Stencil Font"), m_pActivePage, pStencil,pStencil->textFont(), f); pStencil->setTextFont( f ); macro->addCommand( cmd ); } pStencil = m_pActivePage->selectedStencils()->next(); } if ( macro ) m_pDoc->addCommand( macro ); m_pDoc->updateView(m_pActivePage); } void KivioView::toggleFontBold(bool b) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; QFont f; KMacroCommand * macro = 0L; while( pStencil ) { f = pStencil->textFont(); f.setBold(b); if ( pStencil->textFont() != f ) { if ( !macro ) macro = new KMacroCommand( i18n("Change Stencil Font")); KivioChangeStencilFontCommand *cmd = new KivioChangeStencilFontCommand( i18n("Change Stencil Font"), m_pActivePage, pStencil,pStencil->textFont(), f); pStencil->setTextFont( f ); macro->addCommand( cmd ); } pStencil = m_pActivePage->selectedStencils()->next(); } if ( macro ) m_pDoc->addCommand( macro ); m_pDoc->updateView(m_pActivePage); } void KivioView::toggleFontItalics(bool b) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; QFont f; KMacroCommand * macro = new KMacroCommand( i18n("Change Stencil Font")); while( pStencil ) { f = pStencil->textFont(); f.setItalic(b); if ( pStencil->textFont() != f ) { if ( !macro ) macro = new KMacroCommand( i18n("Change Stencil Font")); KivioChangeStencilFontCommand *cmd = new KivioChangeStencilFontCommand( i18n("Change Stencil Font"), m_pActivePage, pStencil,pStencil->textFont(), f); pStencil->setTextFont( f ); macro->addCommand( cmd ); } pStencil = m_pActivePage->selectedStencils()->next(); } if ( macro ) m_pDoc->addCommand( macro ); m_pDoc->updateView(m_pActivePage); } void KivioView::toggleFontUnderline( bool b) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand * macro = 0L; QFont f; while( pStencil ) { f = pStencil->textFont(); f.setUnderline(b); if ( pStencil->textFont() != f ) { if ( !macro ) macro = new KMacroCommand( i18n("Change Stencil Font")); KivioChangeStencilFontCommand *cmd = new KivioChangeStencilFontCommand( i18n("Change Stencil Font"), m_pActivePage, pStencil,pStencil->textFont(), f); pStencil->setTextFont( f ); macro->addCommand( cmd ); } pStencil = m_pActivePage->selectedStencils()->next(); } if ( macro ) m_pDoc->addCommand( macro ); m_pDoc->updateView(m_pActivePage); } void KivioView::updateToolBars() { KivioStencil *pStencil; pStencil = m_pActivePage->selectedStencils()->first(); if( !pStencil ) { m_setFontFamily->setFont( KoGlobal::defaultFont().family() ); m_setFontSize->setFontSize( 12 ); m_setBold->setChecked( false ); m_setItalics->setChecked( false ); m_setUnderline->setChecked( false ); m_setLineWidth->setValue( 1.0 ); m_setHTextAlignment->setCurrentItem( 1 ); m_setVTextAlignment->setCurrentItem( 1 ); m_pStencilGeometryPanel->setSize(0.0,0.0); m_pStencilGeometryPanel->setPosition(0.0,0.0); m_setStartArrow->setCurrentItem(0); m_setEndArrow->setCurrentItem(0); m_setStartArrowSize->setSize(10.0, 10.0); m_setEndArrowSize->setSize(10.0, 10.0); } else { QFont f = pStencil->textFont(); m_setFontFamily->setFont( f.family() ); m_setFontSize->setFontSize( f.pointSize() ); m_setBold->setChecked( f.bold() ); m_setItalics->setChecked( f.italic() ); m_setUnderline->setChecked( f.underline() ); m_setLineWidth->setValue( pStencil->lineWidth() ); m_setFGColor->setActiveColor(pStencil->fgColor()); m_setBGColor->setActiveColor(pStencil->bgColor()); m_setTextColor->setActiveColor(pStencil->textColor()); m_setHTextAlignment->setCurrentItem( pStencil->hTextAlign() ); m_setVTextAlignment->setCurrentItem( pStencil->vTextAlign() ); m_pStencilGeometryPanel->setSize( pStencil->w(), pStencil->h() ); m_pStencilGeometryPanel->setPosition( pStencil->x(), pStencil->y() ); m_setStartArrow->setCurrentItem( pStencil->startAHType() ); m_setEndArrow->setCurrentItem( pStencil->endAHType() ); m_setStartArrowSize->setSize( pStencil->startAHWidth(), pStencil->startAHLength() ); m_setEndArrowSize->setSize( pStencil->endAHWidth(), pStencil->endAHLength() ); } m_pProtectionPanel->updateCheckBoxes(); } void KivioView::slotSetStartArrow( int i ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand *macro = new KMacroCommand( i18n("Change Begin Arrow")); bool createMacro = false; while( pStencil ) { if (pStencil->startAHType()!=i) { pStencil->setStartAHType(i); KivioChangeBeginEndArrowCommand *cmd=new KivioChangeBeginEndArrowCommand( i18n("Change Arrow"), m_pActivePage, pStencil, pStencil->startAHType(), i, true); pStencil->setStartAHType(i); macro->addCommand( cmd ); createMacro= true; } pStencil = m_pActivePage->selectedStencils()->next(); } if (createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::slotSetEndArrow( int i ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand *macro = new KMacroCommand( i18n("Change End Arrow")); bool createMacro = false; while( pStencil ) { if (pStencil->endAHType()!=i) { KivioChangeBeginEndArrowCommand *cmd=new KivioChangeBeginEndArrowCommand( i18n("Change Arrow"), m_pActivePage, pStencil, pStencil->endAHType(), i, false); pStencil->setEndAHType(i); macro->addCommand( cmd ); createMacro= true; } pStencil = m_pActivePage->selectedStencils()->next(); } if (createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::slotSetStartArrowSize() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; float w,h; m_setStartArrowSize->size(w,h); KMacroCommand *macro = new KMacroCommand( i18n("Change Size of Begin Arrow")); bool createMacro = false; while( pStencil ) { if (pStencil->startAHLength() != h || pStencil->startAHWidth()!=w) { KivioChangeBeginEndSizeArrowCommand * cmd = new KivioChangeBeginEndSizeArrowCommand( i18n("Change Size of End Arrow"), m_pActivePage, pStencil, pStencil->startAHLength(),pStencil->startAHWidth(), h,w, true); pStencil->setStartAHWidth(w); pStencil->setStartAHLength(h); macro->addCommand( cmd ); createMacro= true; } pStencil = m_pActivePage->selectedStencils()->next(); } if (createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::slotSetEndArrowSize() { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; float w,h; m_setEndArrowSize->size(w,h); KMacroCommand *macro = new KMacroCommand( i18n("Change Size of End Arrow")); bool createMacro = false; while( pStencil ) { if ( pStencil->endAHLength() != h || pStencil->endAHWidth()!=w) { KivioChangeBeginEndSizeArrowCommand * cmd = new KivioChangeBeginEndSizeArrowCommand( i18n("Change Size of End Arrow"), m_pActivePage, pStencil, pStencil->endAHLength(),pStencil->endAHWidth(), h,w, false); pStencil->setEndAHWidth(w); pStencil->setEndAHLength(h); macro->addCommand( cmd ); createMacro= true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::setHParaAlign( int i ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand *macro = new KMacroCommand( i18n("Change Stencil Horizontal Alignment")); bool createMacro = false; while( pStencil ) { if ( pStencil->hTextAlign() != i) { KivioChangeStencilHAlignmentCommand * cmd = new KivioChangeStencilHAlignmentCommand( i18n("Change Stencil Horizontal Alignment"), m_pActivePage, pStencil, pStencil->hTextAlign(), i); pStencil->setHTextAlign(i); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if (createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::setVParaAlign( int i ) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if (!pStencil) return; KMacroCommand *macro = new KMacroCommand( i18n("Change Stencil Vertical Alignment")); bool createMacro = false; while( pStencil ) { if ( pStencil->vTextAlign() != i ) { KivioChangeStencilVAlignmentCommand * cmd = new KivioChangeStencilVAlignmentCommand( i18n("Change Stencil Vertical Alignment"), m_pActivePage, pStencil, pStencil->vTextAlign(), i); pStencil->setVTextAlign( i ); macro->addCommand( cmd ); createMacro = true; } pStencil = m_pActivePage->selectedStencils()->next(); } if ( createMacro ) m_pDoc->addCommand( macro ); else delete macro; m_pDoc->updateView(m_pActivePage); } void KivioView::bringStencilToFront() { m_pActivePage->bringToFront(); m_pDoc->updateView(m_pActivePage); } void KivioView::sendStencilToBack() { m_pActivePage->sendToBack(); m_pDoc->updateView(m_pActivePage); } void KivioView::cutStencil() { m_pActivePage->cut(); m_pDoc->updateView(m_pActivePage); } void KivioView::copyStencil() { m_pActivePage->copy(); } void KivioView::pasteStencil() { m_pActivePage->paste(); m_pDoc->updateView(m_pActivePage); } void KivioView::slotChangeStencilSize(double newW, double newH) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if ( pStencil ) { KivioRect oldPos(pStencil->rect()); pStencil->setDimensions(newW, newH); if ((oldPos.w() != pStencil->rect().w()) || (oldPos.h() != pStencil->rect().h())) { KivioMoveStencilCommand * cmd = new KivioMoveStencilCommand( i18n("Resize Stencil"), pStencil, oldPos , pStencil->rect(), m_pCanvas->activePage()); m_pDoc->updateView(m_pActivePage); m_pDoc->addCommand( cmd ); } } } void KivioView::slotChangeStencilPosition(double newW, double newH) { KivioStencil *pStencil = m_pActivePage->selectedStencils()->first(); if ( pStencil ) { KivioRect oldPos(pStencil->rect()); pStencil->setPosition(newW, newH); if ((oldPos.x() != pStencil->rect().x()) || (oldPos.y() != pStencil->rect().y())) { KivioMoveStencilCommand * cmd = new KivioMoveStencilCommand( i18n("Move Stencil"), pStencil, oldPos , pStencil->rect(), m_pCanvas->activePage()); m_pDoc->updateView(m_pActivePage); m_pDoc->addCommand( cmd ); } } } /** * When passed a spawner, this will create a new stencil at 0,0. */ void KivioView::addStencilFromSpawner( KivioStencilSpawner *pSpawner ) { KivioStencil *pStencil; // Allocate the new stencil and set it's default size/style pStencil = pSpawner->newStencil(); pStencil->setPosition( 0.0f, 0.0f ); // Only set these properties if we held ctrl down // FIXME: Make this happen! // pStencil->setFGColor( fgColor() ); // pStencil->setBGColor( bgColor() ); // pStencil->setLineWidth( (float)lineWidth() ); // Unselect everything, then the stencil to the page, and select it m_pActivePage->unselectAllStencils(); m_pActivePage->addStencil( pStencil ); m_pActivePage->selectStencil( pStencil ); // Mark the page as modified and repaint m_pDoc->updateView(m_pActivePage); } /* void KivioView::gridSetup() { GridSetupDialog* dlg = new GridSetupDialog(0,"GridSetupDialog", true); KivioGridData d = m_pDoc->grid(); int unit = (int)d.freq.unit; dlg->unitBox->setUnit(unit); dlg->unitBox->activate(); dlg->showGrid->setChecked(d.isShow); dlg->snapGrid->setChecked(d.isSnap); dlg->gridColor->setColor(d.color); dlg->freqX->setValue(d.freq.w,unit); dlg->freqY->setValue(d.freq.h,unit); dlg->distX->setValue(d.snap.w,unit); dlg->distY->setValue(d.snap.h,unit); if( dlg->exec() == QDialog::Accepted ) { unit = dlg->unitBox->currentItem(); d.color = dlg->gridColor->color(); d.isShow = dlg->showGrid->isChecked(); d.isSnap = dlg->snapGrid->isChecked(); d.freq.set(dlg->freqX->value(unit),dlg->freqY->value(unit),unit); d.snap.set(dlg->distX->value(unit),dlg->distY->value(unit),unit); m_pDoc->setGrid(d); updateToolBars(); m_pCanvas->repaint(); } delete dlg; } */ void KivioView::alignStencilsDlg() { AlignDialog* dlg = new AlignDialog(0,"AlignDialog", true); if( dlg->exec() == QDialog::Accepted ) { AlignData ad; ad.centerOfPage = dlg->aCenterPage->isChecked(); ad.v = AlignData::None; if (dlg->avtop->isChecked()) ad.v = AlignData::Top; if (dlg->avcenter->isChecked()) ad.v = AlignData::Center; if (dlg->avbottom->isChecked()) ad.v = AlignData::Bottom; ad.h = AlignData::None; if (dlg->ahleft->isChecked()) ad.h = AlignData::Left; if (dlg->ahcenter->isChecked()) ad.h = AlignData::Center; if (dlg->ahright->isChecked()) ad.h = AlignData::Right; DistributeData dd; if (dlg->dselection->isChecked()) dd.extent = DistributeData::Selection; if (dlg->dpage->isChecked()) dd.extent = DistributeData::Page; dd.v = DistributeData::None; if (dlg->dvtop->isChecked()) dd.v = DistributeData::Top; if (dlg->dvcenter->isChecked()) dd.v = DistributeData::Center; if (dlg->dvbottom->isChecked()) dd.v = DistributeData::Bottom; if (dlg->dvspacing->isChecked()) dd.v = DistributeData::Spacing; dd.h = DistributeData::None; if (dlg->dhleft->isChecked()) dd.h = DistributeData::Left; if (dlg->dhcenter->isChecked()) dd.h = DistributeData::Center; if (dlg->dhright->isChecked()) dd.h = DistributeData::Right; if (dlg->dhspacing->isChecked()) dd.h = DistributeData::Spacing; m_pActivePage->alignStencils(ad); m_pActivePage->distributeStencils(dd); m_pCanvas->repaint(); } delete dlg; } void KivioView::optionsDialog() { doc()->config()->setup(this); } void KivioView::toggleStencilGeometry(bool b) { TOGGLE_ACTION("stencilGeometry")->setChecked(b); } void KivioView::toggleViewManager(bool b) { TOGGLE_ACTION("viewManager")->setChecked(b); } void KivioView::toggleLayersPanel(bool b) { TOGGLE_ACTION("layersPanel")->setChecked(b); } void KivioView::toggleProtectionPanel(bool b) { TOGGLE_ACTION("protection")->setChecked(b); } void KivioView::toggleBirdEyePanel(bool b) { TOGGLE_ACTION("birdEye")->setChecked(b); } void KivioView::setupPrinter(KPrinter &p) { p.setMinMax(1, m_pDoc->map()->pageList().count()); p.setFromTo(1, m_pDoc->map()->pageList().count()); } void KivioView::exportPage() { // First build a filter list QString extList = i18n("Image Files: ("); char *pStr; QStrList strList; ExportPageDialog dlg(this, "Export Page Dialog"); strList = QImageIO::outputFormats(); pStr = (char *)strList.first(); while( pStr ) { extList = extList + " *." + QString(pStr).lower(); pStr = (char *)strList.next(); } extList = extList + ")"; //KFileDialog fd( this, "Export To File", true ); QString fileName = KFileDialog::getSaveFileName( "", extList ); if( fileName.isEmpty()==true ) { return; } if( dlg.exec()!=QDialog::Accepted ) { return; } if(!m_pDoc->exportPage( m_pActivePage, fileName, &dlg )) { kdDebug() << "KivioView::exportPage() failed\n"; return; } kdDebug() << "KivioView::exportPage() succeeded\n"; } void KivioView::openPopupMenuMenuPage( const QPoint & _point ) { if(!koDocument()->isReadWrite() || !factory()) return; static_cast(factory()->container("menupage_popup",this))->popup(_point); } void KivioView::updateMenuPage() { bool state = (doc()->map()->count() > 1 && m_pTabBar->listshow().count()>1); m_removePage->setEnabled(state); m_hidePage->setEnabled( state ); } void KivioView::updateButton() { toggleShowGrid(m_pDoc->grid().isShow); toggleSnapGrid(m_pDoc->grid().isSnap); toggleShowGuides(koDocument()->isReadWrite()); toggleSnapGuides(koDocument()->isReadWrite()); } void KivioView::slotPageHidden( KivioPage* page ) { m_pTabBar->hidePage( page->pageName() ); } void KivioView::slotPageShown( KivioPage* page ) { m_pTabBar->showPage( page->pageName() ); } void KivioView::resetLayerPanel() { if ( m_pLayersPanel ) { m_pLayersPanel->reset(); } } void KivioView::updateProtectPanelCheckBox() { if ( m_pProtectionPanel ) { m_pProtectionPanel->updateCheckBoxes(); } } void KivioView::setMousePos( int mx, int my ) { vRuler->setMousePos(mx, my); hRuler->setMousePos(mx, my); KStatusBar* sb = statusBar(); if(sb && (mx >= 0) && (my >= 0)) { QString unit = KoUnit::unitName(m_pDoc->units()); KoPoint xy = m_pCanvas->mapFromScreen(QPoint(mx, my)); QString text = i18n("X: %1 %3 Y: %2 %4").arg(KGlobal::_locale->formatNumber(xy.x(), 2)) .arg(KGlobal::_locale->formatNumber(xy.y(), 2)).arg(unit).arg(unit); sb->changeItem(text, MOUSEPOS_TEXT); } } void KivioView::setRulerUnit(KoUnit::Unit u) { vRuler->setUnit(u); hRuler->setUnit(u); } void KivioView::setRulerHOffset(int h) { if(hRuler) { hRuler->setOffset(h, 0); } } void KivioView::setRulerVOffset(int v) { if(vRuler) { vRuler->setOffset(0, v); } } void KivioView::rulerChangedUnit(QString u) { m_pDoc->setUnits(KoUnit::unit(u)); } KoZoomHandler* KivioView::zoomHandler() { return m_zoomHandler; } void KivioView::setRulerPageLayout(const KoPageLayout& l) { vRuler->setPageLayout(l); hRuler->setPageLayout(l); vRuler->setFrameStartEnd(zoomHandler()->zoomItY(l.ptTop), zoomHandler()->zoomItY(l.ptHeight - l.ptBottom)); hRuler->setFrameStartEnd(zoomHandler()->zoomItX(l.ptLeft), zoomHandler()->zoomItX(l.ptWidth - l.ptRight)); } void KivioView::setLineWidthUnit(KoUnit::Unit u) { m_setLineWidth->setUnit(u); } void KivioView::viewZoom(const QString& s) { QString z(s); z.replace("%", ""); z.simplifyWhiteSpace(); bool ok = false; int zoom = z.toInt(&ok); if(!ok || zoom < 10) { zoom = zoomHandler()->zoom(); } if(zoom != zoomHandler()->zoom()) { viewZoom(zoom); } } void KivioView::changeZoomMenu(int z) { QStringList zl; if(z > 0) { // This code is taken from KWords changeZoomMenu QValueList list; QString zs; int val; bool ok; QStringList itemsList = m_viewZoom->items(); for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it) { zs = (*it).replace( "%", "" ); zs = zs.simplifyWhiteSpace(); val = zs.toInt(&ok); //zoom : limit inferior=10 if(ok && val > 9 &&list.contains(val) == 0) list.append( val ); } //necessary at the beginning when we read config //this value is not in combo list if(list.contains(z) == 0) { list.append( z ); } qHeapSort( list ); for (QValueList::Iterator it = list.begin() ; it != list.end() ; ++it) { zl.append( (QString::number(*it)+'%') ); } } else { zl << "33%" << "50%" << "75%" << "100%" << "125%" << "150%" << "200%" << "250%" << "300%" << "350%" << "400%" << "450%" << "500%"; } m_viewZoom->setItems(zl); } void KivioView::showZoom(int z) { QStringList list = m_viewZoom->items(); QString zoomStr = QString::number(z) + '%'; m_viewZoom->setCurrentItem(list.findIndex(zoomStr)); } #include "kivio_view.moc" Index: trunk/koffice/kivio/kiviopart/kiviostencilsetaction.cpp =================================================================== --- trunk/koffice/kivio/kiviopart/kiviostencilsetaction.cpp (nonexistent) +++ trunk/koffice/kivio/kiviopart/kiviostencilsetaction.cpp (revision 219196) @@ -0,0 +1,261 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Peter Simonsson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "kiviostencilsetaction.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "kivio_stencil_spawner_set.h" + +static const char * default_plug_xpm[] = { +"16 16 5 1", +" c None", +". c #000000", +"+ c #C4C7FF", +"@ c #5961FF", +"# c #FFFFFF", +" ", +" ", +" ... ", +" .++.. ", +" .+@++.. ", +" .+@@@++.. ", +" .+@@@@@++.. ", +" .+@@@@@@@++.. ", +" .+@@@@@@@@@++. ", +" .+@@@@@@@@@@@.#", +" .+@@@@@@@@@@@.#", +" .+@@@@@@@@@@@.#", +" .+@@@@@@@@@@@.#", +" .+@@@@@@@@@@@.#", +" ..............#", +" ##############"}; + +KivioStencilSetAction::KivioStencilSetAction(const QString &text, const QString &pix, + KActionCollection *parent, const char *name) + : KAction(text, pix, 0, parent, name) +{ + setShortcutConfigurable( false ); + + m_childMenuList.setAutoDelete(true); + m_pathList.setAutoDelete(true); + + m_popup = new KPopupMenu(0L,"KivioStencilSetAction::popup"); + connect(m_popup, SIGNAL(aboutToShow()), SLOT(updateMenu())); +} + +KivioStencilSetAction::~KivioStencilSetAction() +{ + delete m_popup; + m_popup = 0; +} + +KPopupMenu* KivioStencilSetAction::popupMenu() const +{ + return m_popup; +} + +void KivioStencilSetAction::popup( const QPoint& global ) +{ + popupMenu()->popup(global); +} + +int KivioStencilSetAction::plug( QWidget* widget, int index) +{ + // This function is copied from KActionMenu::plug + if (kapp && !kapp->authorizeKAction(name())) + return -1; + kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis + if ( widget->inherits("QPopupMenu") ) + { + QPopupMenu* menu = static_cast( widget ); + int id; + + if ( hasIconSet() ) + id = menu->insertItem( iconSet(), text(), popupMenu(), -1, index ); + else + id = menu->insertItem( text(), popupMenu(), -1, index ); + + if ( !isEnabled() ) + menu->setItemEnabled( id, false ); + + addContainer( menu, id ); + connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); + + return containerCount() - 1; + } + else if ( widget->inherits( "KToolBar" ) ) + { + KToolBar *bar = static_cast( widget ); + + int id_ = KAction::getToolButtonID(); + + if ( icon().isEmpty() && !iconSet().isNull() ) + bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this, + SLOT( slotActivated() ), isEnabled(), plainText(), + index ); + else + { + KInstance *instance; + + if ( m_parentCollection ) + instance = m_parentCollection->instance(); + else + instance = KGlobal::instance(); + + bar->insertButton( icon(), id_, SIGNAL( clicked() ), this, + SLOT( slotActivated() ), isEnabled(), plainText(), + index, instance ); + } + + addContainer( bar, id_ ); + + if (!whatsThis().isEmpty()) + QWhatsThis::add( bar->getButton(id_), whatsThis() ); + + connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); + + bar->getButton(id_)->setPopup(popupMenu(), true ); + + return containerCount() - 1; + } + else if ( widget->inherits( "QMenuBar" ) ) + { + QMenuBar *bar = static_cast( widget ); + + int id; + + id = bar->insertItem( text(), popupMenu(), -1, index ); + + if ( !isEnabled() ) + bar->setItemEnabled( id, false ); + + addContainer( bar, id ); + connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); + + return containerCount() - 1; + } + + return -1; +} + +void KivioStencilSetAction::updateMenu() +{ + m_id = 0; + m_popup->clear(); + + m_childMenuList.clear(); + m_pathList.clear(); + + KStandardDirs *dirs = KGlobal::dirs(); + QStringList dirList = dirs->findDirs("data", "kivio/stencils"); + dirList.sort(); + + for( QStringList::Iterator it = dirList.begin(); it != dirList.end(); ++it ) + { + QString dir = (*it); + loadCollections(dir); + } +} + +void KivioStencilSetAction::loadCollections( const QString& rootDirStr ) +{ + QDir rootDir( rootDirStr ); + + rootDir.setFilter( QDir::Dirs ); + rootDir.setSorting( QDir::Name ); + + const QFileInfoList *colList = rootDir.entryInfoList(); + QFileInfoListIterator colIt( *colList ); + QFileInfo *colFInfo; + + while( (colFInfo = colIt.current()) ) + { + if( colFInfo->fileName() != ".." && + colFInfo->fileName() != "." ) + { + KPopupMenu* ch = new KPopupMenu; + connect(ch,SIGNAL(activated(int)),SLOT(slotActivated(int))); + loadSet( ch, rootDirStr + "/" + colFInfo->fileName() ); + m_popup->insertItem(QIconSet(dirtPixmap(colFInfo->absFilePath())), + KivioStencilSpawnerSet::readTitle(colFInfo->absFilePath()),ch); + m_childMenuList.append(ch); + } + ++colIt; + } +} + +void KivioStencilSetAction::loadSet( KPopupMenu* menu, const QString& rootDirStr ) +{ + QDir rootDir( rootDirStr ); + + rootDir.setFilter( QDir::Dirs ); + rootDir.setSorting( QDir::Name ); + + const QFileInfoList *setList = rootDir.entryInfoList(); + QFileInfoListIterator setIt( *setList ); + QFileInfo *setFInfo; + + while( (setFInfo = setIt.current()) ) + { + if( setFInfo->fileName() != ".." && setFInfo->fileName() != "." ) + { + menu->insertItem(QIconSet(dirtPixmap(setFInfo->absFilePath())), + KivioStencilSpawnerSet::readTitle(setFInfo->absFilePath()),m_id); + m_pathList.insert( m_id, new QString(rootDirStr + "/" + setFInfo->fileName()) ); + m_id++; + } + ++setIt; + } +} + +QPixmap KivioStencilSetAction::dirtPixmap( const QString& dir ) +{ + QFile file( dir + "/icon.xpm" ); + QFileInfo finfo( file ); + + if( finfo.exists()==false ) + { + return QPixmap( (const char **)default_plug_xpm ); + } + + return QPixmap( finfo.absFilePath() ); +} + +void KivioStencilSetAction::slotActivated(int id) +{ + if (id<0 || m_pathList.at((uint)id) == 0L ) + return; + + QString path = QString(*m_pathList.at((uint)id)); + m_pathList.clear(); + + emit activated(path); +} Property changes on: trunk/koffice/kivio/kiviopart/kiviostencilsetaction.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/x-c++src \ No newline at end of property Index: trunk/koffice/kivio/kiviopart/kivio.rc =================================================================== --- trunk/koffice/kivio/kiviopart/kivio.rc (revision 219195) +++ trunk/koffice/kivio/kiviopart/kivio.rc (revision 219196) @@ -1,124 +1,127 @@ - + + &File + + &Edit &View &Docker P&age F&ormat &Settings Stencils View Edit Colors Arrows Format Tools Index: trunk/koffice/kivio/kiviopart/kiviosdk/kivio_layer.cpp =================================================================== --- trunk/koffice/kivio/kiviopart/kiviosdk/kivio_layer.cpp (revision 219195) +++ trunk/koffice/kivio/kiviopart/kiviosdk/kivio_layer.cpp (revision 219196) @@ -1,486 +1,487 @@ /* * Kivio - Visual Modelling and Flowcharting * Copyright (C) 2000-2001 theKompany.com & Dave Marotti * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kivio_common.h" #include "kivio_connector_point.h" #include "kivio_connector_target.h" #include "kivio_group_stencil.h" #include "kivio_intra_stencil_data.h" #include "kivio_layer.h" #include "kivio_painter.h" #include "kivio_point.h" #include "kivio_stencil.h" #include "kivio_stencil_spawner.h" #include "kivio_stencil_spawner_info.h" #include "kivio_stencil_spawner_set.h" #include "KIvioLayerIface.h" #include "kivio_doc.h" #include "kivio_page.h" #include #include #include #include KivioLayer::KivioLayer( KivioPage *pPage ) :m_pStencilList(NULL) { m_pPage = pPage; m_name = i18n("Untitled Layer"); m_pStencilList = new QPtrList; m_pStencilList->setAutoDelete(true); m_pDeletedStencilList = new QPtrList; m_pDeletedStencilList->setAutoDelete(true); m_flags = 0; m_dcop = 0; setVisible(true); setConnectable(false); } DCOPObject* KivioLayer::dcopObject() { if ( !m_dcop ) m_dcop = new KIvioLayerIface( this ); return m_dcop; } KivioLayer::~KivioLayer() { kdDebug()<<"KivioLayer::~KivioLayer()***************:"<findRef(pStencil); if ( pos != -1 ) m_pDeletedStencilList->take( pos); m_pStencilList->append( pStencil ); return true; } void KivioLayer::takeStencilFromList( KivioStencil *pStencil ) { int pos=m_pStencilList->findRef(pStencil); m_pStencilList->take( pos ); m_pDeletedStencilList->append( pStencil ); } void KivioLayer::insertStencil( KivioStencil *pStencil ) { int pos=m_pDeletedStencilList->findRef(pStencil); if ( pos != -1 ) m_pDeletedStencilList->take( pos); m_pStencilList->append( pStencil ); } bool KivioLayer::removeStencil( KivioStencil *pStencil ) { return m_pStencilList->remove( pStencil ); } /** * Returns a new stencil of the type described by stencilE * * @param stencilE The XML element to load from * * This will search through all KivioStencilSpawnerSets and attempt to * locate the stencil described by stencilE. If it finds it, it allocates * a new copy of it, loads the data from stencilE into it, and returns * it. * * @returns A new, loaded stencil. */ KivioStencil *KivioLayer::loadSMLStencil( const QDomElement &stencilE ) { QString setId, _id; kdDebug() << "KivioLayer::loadSMLStencil() " << setId << " " << _id << endl; setId = XmlReadString( stencilE, "setId", "" ); _id = XmlReadString( stencilE, "id", "" ); if( setId.length() == 0 || _id.length() == 0 ) { return NULL; } // Locate the spawner set KivioStencilSpawner *pSpawner = m_pPage->doc()->findStencilSpawner(setId,_id); if( pSpawner ) { KivioStencil *pStencil = pSpawner->newStencil(); pStencil->loadXML( stencilE ); return pStencil; } return NULL; } /** * Returns a new stencil of the type described by stencilE * * @param stencilE The XML element to load from * * This will search through all KivioStencilSpawnerSets and attempt to * locate the stencil described by stencilE. If it finds it, it allocates * a new copy of it, loads the data from stencilE into it, and returns * it. * * @returns A new, loaded stencil. */ KivioStencil *KivioLayer::loadGroupStencil( const QDomElement &stencilE ) { kdDebug() << "KivioLayer::loadGroupStencil()" << endl; KivioGroupStencil *pStencil = new KivioGroupStencil(); if(pStencil->loadXML( stencilE, this )==false) { delete pStencil; return NULL; } return pStencil; } KivioStencil *KivioLayer::loadPluginStencil( const QDomElement &stencilE ) { QString setId, _id; kdDebug() << "KivioLayer::loadPluginStencil() " << setId.ascii() << " / " << _id << endl; setId = XmlReadString( stencilE, "setId", "" ); _id = XmlReadString( stencilE, "id", "" ); if( setId.length() == 0 || _id.length() == 0 ) return NULL; // Locate the spawner set KivioStencilSpawner *pSpawner = m_pPage->doc()->findStencilSpawner(setId, _id); if( pSpawner ) { KivioStencil *pStencil = pSpawner->newStencil(); pStencil->loadXML( stencilE ); return pStencil; } return NULL; } bool KivioLayer::loadXML( const QDomElement &layerE ) { m_flags = XmlReadInt( layerE, "flags", 1 ); m_name = XmlReadString( layerE, "name", "layerX" ); QDomNode node; node = layerE.firstChild(); while( !node.isNull() ) { QString name = node.nodeName(); if( name == "KivioSMLStencil" || name == "KivioPyStencil" ) { KivioStencil *pStencil = loadSMLStencil( node.toElement() ); if( pStencil ) { pStencil->updateGeometry(); m_pStencilList->append( pStencil ); } else { kdWarning() << "KivioLayer::loadXML() - Unknown KivioSMLStencil (id=" << XmlReadString( node.toElement(), "id", "" ) << " set=" << XmlReadString( node.toElement(), "setId", "" ) << ") found." << endl; } } else if( name == "KivioGroupStencil" ) { KivioStencil *pStencil = loadGroupStencil( node.toElement() ); if( pStencil ) { m_pStencilList->append(pStencil); } else { kdWarning() << "KivioLayer::loadXML() - Unable to load KivioGroupStencil" << endl; } } else if( name == "KivioPluginStencil" ) { KivioStencil *pStencil = loadPluginStencil( node.toElement() ); if( pStencil ) { m_pStencilList->append(pStencil); } else { kdWarning() << "KivioLayer - Unable to load KivioPluginStencil" << endl; kdWarning() << "KivioLayer::loadXML() - Unable to load KivioPluginStencil (id=" << XmlReadString( node.toElement(), "id", "" ) << " set=" << XmlReadString( node.toElement(), "setId", "" ) << ") found." << endl; } } node = node.nextSibling(); } return true; } QDomElement KivioLayer::saveXML( QDomDocument &doc ) { QDomElement e = doc.createElement("KivioLayer"); XmlWriteInt( e, "flags", m_flags ); XmlWriteString( e, "name", m_name ); KivioStencil *pStencil = m_pStencilList->first(); while( pStencil ) { e.appendChild( pStencil->saveXML( doc ) ); pStencil = m_pStencilList->next(); } return e; } void KivioLayer::paintContent( KivioPainter& painter, const QRect&, bool , QPoint , KoZoomHandler* zoom ) { KivioStencil *pStencil = m_pStencilList->first(); KivioIntraStencilData data; painter.setFGColor( QColor(0,0,0) ); data.painter = &painter; data.zoomHandler = zoom; while( pStencil ) { pStencil->paint( &data ); pStencil = m_pStencilList->next(); } } void KivioLayer::printContent( KivioPainter& painter ) { KivioStencil *pStencil = m_pStencilList->first(); KivioIntraStencilData data; KoZoomHandler zoomHandler; - zoomHandler.setZoomAndResolution(100, 600, 600); // FIXME: Hmmm... resolution sucks ;) + // FIXME: Hmmm... resolution sucks ;) + zoomHandler.setZoomAndResolution(100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY()); painter.setFGColor( QColor(0,0,0) ); data.painter = &painter; data.zoomHandler = &zoomHandler; data.printing = true; while( pStencil ) { pStencil->paint( &data ); pStencil = m_pStencilList->next(); } } void KivioLayer::paintConnectorTargets( KivioPainter& painter, const QRect&, bool, QPoint, KoZoomHandler* zoom ) { KivioIntraStencilData data; painter.setFGColor( QColor(0,0,0) ); data.painter = &painter; data.zoomHandler = zoom; KivioStencil *pStencil = m_pStencilList->first(); while( pStencil ) { pStencil->paintConnectorTargets( &data ); pStencil = m_pStencilList->next(); } } void KivioLayer::paintSelectionHandles( KivioPainter& painter, const QRect&, bool, QPoint, KoZoomHandler* zoom ) { KivioIntraStencilData data; painter.setFGColor( QColor(0,0,0) ); data.painter = &painter; data.zoomHandler = zoom; KivioStencil *pStencil = m_pStencilList->first(); while( pStencil ) { if( pStencil->isSelected() ) pStencil->paintSelectionHandles( &data ); pStencil = m_pStencilList->next(); } } KivioStencil *KivioLayer::checkForStencil( KivioPoint *pPoint, int *collisionType, float threshhold, bool selectedOnly ) { KivioStencil *pStencil; int colType; pStencil = m_pStencilList->last(); while( pStencil ) { // If we are only supposed to check the selected stencils, then only do that. Otherwise // check them all. if( (selectedOnly==true && pStencil->isSelected()==true) || (selectedOnly==false) ) { if( (colType = pStencil->checkForCollision( pPoint, threshhold )) != kctNone ) { // Assign the collision type and return *collisionType = colType; return pStencil; } } pStencil = m_pStencilList->prev(); } *collisionType = kctNone; return NULL; } void KivioLayer::setVisible( bool f ) { if( f==true ) { m_flags = m_flags | FLOW_LAYER_VISIBLE; } else { m_flags = m_flags & (~FLOW_LAYER_VISIBLE); } } void KivioLayer::setConnectable( bool f ) { if( f==true ) { m_flags = m_flags | FLOW_LAYER_CONNECTABLE; } else { m_flags = m_flags & (~FLOW_LAYER_CONNECTABLE); } } int KivioLayer::generateStencilIds( int next ) { KivioStencil *pStencil; pStencil = m_pStencilList->first(); while( pStencil ) { next = pStencil->generateIds( next ); pStencil = m_pStencilList->next(); } return next; } void KivioLayer::searchForConnections( KivioPage *p ) { KivioStencil *pStencil; KivioStencil *pCur; pStencil = m_pStencilList->first(); while( pStencil ) { // Backup the current list position pCur = pStencil; pStencil->searchForConnections( p ); // Restore it m_pStencilList->find( pCur ); pStencil = m_pStencilList->next(); } } KivioStencil *KivioLayer::takeStencil( KivioStencil *p ) { m_pStencilList->find( p ); return m_pStencilList->take(); } /** * Attempts to connect a KivioConnectorPoint to a KivioConnectorTarget of each stencil. * * @param p The point to attempt the connection with * @param thresh The threshold to use * @returns The KivioConnectorTarget the point connected to */ KivioConnectorTarget *KivioLayer::connectPointToTarget( KivioConnectorPoint *p, float thresh ) { KivioConnectorTarget *pTarget; KivioStencil *pStencil = m_pStencilList->last(); while( pStencil ) { // Don't allow the connector point to connect to the stencil that owns it if( pStencil != p->stencil() ) { pTarget = pStencil->connectToTarget(p, thresh); if( pTarget ) { return pTarget; } } pStencil = m_pStencilList->prev(); } return NULL; } Index: trunk/koffice/kivio/kiviopart/kivio_page.cpp =================================================================== --- trunk/koffice/kivio/kiviopart/kivio_page.cpp (revision 219195) +++ trunk/koffice/kivio/kiviopart/kivio_page.cpp (revision 219196) @@ -1,1569 +1,1570 @@ /* * Kivio - Visual Modelling and Flowcharting * Copyright (C) 2000-2001 theKompany.com & Dave Marotti * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kivio_page.h" #include "kivio_map.h" #include "kivio_doc.h" #include "kivio_canvas.h" #include "kivio_guidelines.h" #include "kivio_config.h" #include "kivio_common.h" #include "kivio_connector_point.h" #include "kivio_group_stencil.h" #include "kivio_intra_stencil_data.h" #include "kivio_layer.h" #include "kivio_painter.h" #include "kivio_point.h" #include "kivio_ps_printer.h" #include "kivio_stencil.h" #include "KIvioPageIface.h" #include "kivio_command.h" #include "kivioglobal.h" int KivioPage::s_id = 0L; QIntDict* KivioPage::s_mapPages; KivioPage::KivioPage( KivioMap *_map, const QString &pageName, const char *_name ) : QObject( _map, _name ), m_pCurLayer(NULL) { if ( s_mapPages == 0L ) s_mapPages = new QIntDict; m_id = s_id++; s_mapPages->insert( m_id, this ); m_dcop = 0; m_pMap = _map; m_pDoc = _map->doc(); // Make sure the layers auto-delete themselves m_pCurLayer = new KivioLayer(this); m_pCurLayer->setName(i18n("Layer 1")); m_lstLayers.append( m_pCurLayer ); m_lstLayers.setAutoDelete(true); m_lstSelection.setAutoDelete(false); m_strName = pageName; setHidden(false); // Get a unique name so that we can offer scripting if ( !_name ) { QCString s; s.sprintf("Page%i", s_id ); setName( s.data() ); } m_pPageLayout = m_pDoc->config()->defaultPageLayout(); gLines = new KivioGuideLines(this); } DCOPObject* KivioPage::dcopObject() { if ( !m_dcop ) m_dcop = new KIvioPageIface( this ); return m_dcop; } KivioPage::~KivioPage() { kdDebug()<<" KivioPage::~KivioPage()************ :"<remove(m_id); delete m_dcop; } KivioPage* KivioPage::find( int _id ) { if ( !s_mapPages ) return 0L; return (*s_mapPages)[ _id ]; } void KivioPage::print( KivioPSPrinter *printer ) { KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->visible() ) { pLayer->printContent( *printer ); pLayer = m_lstLayers.next(); } } } void KivioPage::print( QPainter &/*painter*/, KPrinter */*_printer*/ ) { } void KivioPage::printPage( QPainter &/*_painter*/, const QRect& /*page_range*/, const QRect& /*view*/ ) { } QDomElement KivioPage::save( QDomDocument& doc ) { // Write the name and 'hide' flag first as attributes QDomElement page = doc.createElement( "KivioPage" ); page.setAttribute( "name", m_strName ); page.setAttribute( "hide", (int)m_bPageHide ); // Create a child element for the page layout QDomElement layoutE = saveLayout( doc ); page.appendChild( layoutE ); // Save guides QDomElement guidesElement = doc.createElement("GuidesLayout"); page.appendChild(guidesElement); gLines->save(guidesElement); // Iterate through all layers saving them as child elements KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { QDomElement layerE = pLayer->saveXML(doc); if( layerE.isNull() ) { kdDebug() << "KivioPage::save() - Oh shit. KivioLayer::saveXML() returned a bad element!" << endl; } else { page.appendChild( layerE ); } pLayer = m_lstLayers.next(); } return page; } QDomElement KivioPage::saveLayout( QDomDocument &doc ) { QDomElement e = doc.createElement("PageLayout"); Kivio::savePageLayout(e, m_pPageLayout); return e; } bool KivioPage::loadLayout( const QDomElement &e ) { m_pPageLayout = Kivio::loadPageLayout(e); return true; } bool KivioPage::isLoading() { return m_pDoc->isLoading(); } bool KivioPage::loadXML( const QDomElement& pageE ) { m_strName = pageE.attribute("name"); if (m_strName.isEmpty()) return false; m_bPageHide = (int)pageE.attribute("hide").toInt(); // Clear the layer list KivioLayer *pLayer; m_lstLayers.clear(); QDomNode node = pageE.firstChild(); while( !node.isNull() ) { if( node.nodeName() == "KivioLayer" ) { pLayer = new KivioLayer(this); if( pLayer->loadXML( node.toElement() )==false ) { delete pLayer; pLayer = NULL; } else { m_lstLayers.append( pLayer ); pLayer = NULL; } } else if( node.nodeName() == "PageLayout" ) { loadLayout( node.toElement() ); } else if ( node.nodeName() == "GuidesLayout" ) { gLines->load(node.toElement()); } else { kdDebug() << "KivioLayer::loadXML() - unknown node found, " << node.nodeName() << endl; } node = node.nextSibling(); } m_pCurLayer = m_lstLayers.first(); if( !m_pCurLayer ) { kdDebug() << "KivioLayer::loadXML() - No layers loaded!! BIGGGGG PROBLEMS!" << endl; } // Now that we are done loading, fix all the connections KivioLayer *pLayerBak; pLayer = m_lstLayers.first(); while( pLayer ) { pLayerBak = pLayer; kdDebug() << "KivioLayer::loadXML() - loading layer connections" << endl; pLayer->searchForConnections(this); m_lstLayers.find( pLayerBak ); pLayer = m_lstLayers.next(); } return true; } void KivioPage::update() { } KivioPage* KivioPage::findPage( const QString& name ) { if (!m_pMap) return 0L; return m_pMap->findPage(name); } bool KivioPage::setPageName( const QString& name, bool init ) { if ( map()->findPage( name ) ) return false; if ( m_strName == name ) return true; QString old_name = m_strName; m_strName = name; if (init) return true; emit m_pDoc->sig_pageNameChanged(this, old_name); return true; } /** * Paints the page. * * An important note is that layers are drawn first to last. So the last layer is the * most visible. */ void KivioPage::paintContent( KivioPainter& painter, const QRect& rect, bool transparent, QPoint p0, KoZoomHandler* zoom, bool drawHandles ) { KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->visible() ) { pLayer->paintContent( painter, rect, transparent, p0, zoom ); } pLayer = m_lstLayers.next(); } // Now the second iteration - connection targets // Only draw targets if the zoom is higher than a certain value if( zoom->zoom() >= 50 ) { if( drawHandles ) { m_pCurLayer->paintConnectorTargets( painter, rect, transparent, p0, zoom ); pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->connectable() ) { pLayer->paintConnectorTargets( painter, rect, transparent, p0, zoom ); } pLayer = m_lstLayers.next(); } } } // Now the third iteration - selection handles if( drawHandles ) { m_pCurLayer->paintSelectionHandles( painter, rect, transparent, p0, zoom ); } } void KivioPage::printContent( KivioPainter& painter ) { KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->visible() ) { pLayer->printContent( painter ); } pLayer = m_lstLayers.next(); } } void KivioPage::printSelected( KivioPainter& painter ) { KivioStencil *pStencil; KivioIntraStencilData data; KoZoomHandler zoomHandler; - zoomHandler.setZoomAndResolution(100, 600, 600); // FIXME: Hmmm... resolution sucks ;) + // FIXME: Hmmm... resolution sucks ;) + zoomHandler.setZoomAndResolution(100, QPaintDevice::x11AppDpiX(), QPaintDevice::x11AppDpiY()); data.painter = &painter; data.zoomHandler = &zoomHandler; data.printing = true; KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->visible()==true ) { pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected(pStencil)==true ) { pStencil->paint(&data); } pStencil = pLayer->nextStencil(); } } pLayer = m_lstLayers.next(); } } bool KivioPage::addStencil( KivioStencil *pStencil ) { if( !pStencil ) { kdDebug() << "KivioPage::addStencil() - Null stencil passed" << endl; return false; } if( !m_pCurLayer ) { kdDebug() << "KivioPage::addStencil() - NULL current layer" << endl; return false; } KivioAddStencilCommand *cmd = new KivioAddStencilCommand(i18n("Add Stencil"), this, m_pCurLayer, pStencil ); m_pDoc->addCommand(cmd); return m_pCurLayer->addStencil( pStencil ); } void KivioPage::selectStencils( float x, float y, float w, float h ) { // Iterate through all stencils of this layer KivioStencil *pStencil = m_pCurLayer->stencilList()->first(); while( pStencil ) { // Is it in the rectangle? if( stencilInRect( x, y, w, h, pStencil )==true ) { selectStencil( pStencil ); // Don't allow reselection if( m_lstSelection.findRef( pStencil ) != -1 ) { } else { pStencil->select(); m_lstSelection.append( pStencil ); } } pStencil = m_pCurLayer->stencilList()->next(); } m_pDoc->slotSelectionChanged(); } bool KivioPage::stencilInRect( float x, float y, float w, float h, KivioStencil *pStencil ) { float sx, sy, sw, sh; sx = pStencil->x(); sy = pStencil->y(); sw = pStencil->w(); sh = pStencil->h(); if( sx >= x && sy >= y && sx+sw <= x+w && sy+sh <= y+h ) return true; return false; } void KivioPage::selectStencil( KivioStencil *pStencil ) { if( !pStencil ) { kdDebug() << "KivioPage::selectStencil - AHHHH! NULL STENCIL!" << endl; return; } // Don't allow reselection if( m_lstSelection.findRef( pStencil ) != -1 ) return; kdDebug() <<"KivioPage::selectStencil - Selecting stencil" << endl; pStencil->select(); m_lstSelection.append( pStencil ); m_pDoc->slotSelectionChanged(); } bool KivioPage::unselectStencil( KivioStencil *pStencil ) { pStencil->unselect(); m_pDoc->slotSelectionChanged(); return m_lstSelection.removeRef( pStencil ); } void KivioPage::selectAllStencils() { unselectAllStencils(); KivioStencil* pStencil = m_pCurLayer->stencilList()->first(); while( pStencil ) { pStencil->select(); m_lstSelection.append(pStencil); pStencil = m_pCurLayer->stencilList()->next(); } /* * The following code is commented out because selections must * remain in the current layer. */ /* KivioLayer* pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->visible() ) { pStencil = pLayer->stencilList()->first(); while( pStencil ) { pStencil->select(); m_lstSelection.append(pStencil); pStencil = pLayer->stencilList()->next(); } } pLayer = m_lstLayers.next(); } */ m_pDoc->slotSelectionChanged(); } void KivioPage::unselectAllStencils() { KivioStencil *pStencil; pStencil = m_lstSelection.first(); while( pStencil ) { pStencil->unselect(); pStencil = m_lstSelection.next(); } m_lstSelection.clear(); m_pDoc->slotSelectionChanged(); } bool KivioPage::isStencilSelected( KivioStencil *pStencil ) { return m_lstSelection.findRef( pStencil )==-1 ? false : true; } /** * Looks for stencils at a given point in the canvas * * @param pPoint The point to search with * * This will iterate through all visible layers and check * for stencils. The first one it finds will be returned. * If none are found, it will return NULL. */ KivioStencil *KivioPage::checkForStencil( KivioPoint *pPoint, int *collisionType, float threshhold, bool selectedOnly ) { KivioStencil *pStencil; int colType; /* * This code is commented out because selecting a stencil should only take place * on the current layer. The following code searches all layers. */ // Start with the last layer since it is the top /* KivioLayer* pLayer = m_lstLayers.last(); while( pLayer ) { pStencil = pLayer->checkForStencil( pPoint, &colType ); if( pStencil ) { *collisionType = colType; return pStencil; } pLayer = m_lstLayers.prev(); } */ pStencil = m_pCurLayer->checkForStencil( pPoint, &colType, threshhold, selectedOnly ); if( pStencil ) { *collisionType = colType; return pStencil; } *collisionType = kctNone; return NULL; } void KivioPage::deleteSelectedStencils() { KivioStencil *pStencil; // Make sure none of them have deletion protection pStencil = m_lstSelection.first(); while( pStencil ) { if( pStencil->protection()->at(kpDeletion)==true ) { KMessageBox::information(NULL, i18n("One of the selected stencils has protection from deletion and cannot be deleted."), i18n("Protection From Deletion") ); return; } pStencil = m_lstSelection.next(); } // Iterate through all items in the selection list m_lstSelection.first(); pStencil = m_lstSelection.take(); KMacroCommand *macro = new KMacroCommand( i18n("Remove Stencil")); bool createMacro = false; while( pStencil ) { /* * The following code is commented out because selections can only take * place on the current layer. */ // Now iterate through the layers attempting to delete the current stencil. If // true is returned, that means that the delete was successful and we can stop // looking through layers. /* KivioLayer* pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->removeStencil( pStencil )==true ) { break; } pLayer = m_lstLayers.next(); } */ /* if( m_pCurLayer->removeStencil( pStencil ) == false ) { kdDebug() << "KivioPage::deleteSelectedStencils() - Failed to locate a selected stencil in the current layer" << endl; } */ KivioRemoveStencilCommand *cmd =new KivioRemoveStencilCommand(i18n("Remove Stencil"), this, m_pCurLayer , pStencil ); createMacro = true; macro->addCommand( cmd); pStencil = m_lstSelection.take(); } if ( createMacro ) { macro->execute(); m_pDoc->addCommand( macro ); } else delete macro; } void KivioPage::groupSelectedStencils() { KivioGroupStencil *pGroup; KivioStencil *pTake; KivioStencil *pStencil; // Can't group 0 or 1 stencils if( m_lstSelection.count() <= 1 ) return; pGroup = new KivioGroupStencil(); // Iterate through all items in the selection list, taking them from the layer, then adding // them to the group pStencil = m_lstSelection.first(); while( pStencil ) { // Take the stencil out of it's layer pTake = m_pCurLayer->takeStencil( pStencil ); if( !pTake ) { kdDebug() << "KivioPage::groupSelectedStencil() - Failed to take() one of the selected stencils. CRAP!" << endl; } else { // Add it to the group pGroup->addToGroup( pTake ); } pStencil = m_lstSelection.next(); } // Unselect the old ones unselectAllStencils(); // Add the group as the selected stencil m_pCurLayer->addStencil( pGroup ); selectStencil( pGroup ); } // The following is the old implementation of groupSelectedStencils. It did // not preserve connections so a new method was devised. /* void KivioPage::groupSelectedStencils() { KivioGroupStencil *pGroup; KivioStencil *pTake; KivioStencil *pStencil; debug("*GROUP* About to group"); // Can't group 0 or 1 stencils if( m_lstSelection.count() <= 1 ) return; pGroup = new KivioGroupStencil(); // Iterate through all items in the selection list, duplicating them, then adding // them to the group pStencil = m_lstSelection.first(); while( pStencil ) { debug("*GROUP* Duplicating 1"); // Dup the stencil & group it pTake = pStencil->duplicate(); pGroup->addToGroup( pDuplicate ); pStencil = m_lstSelection.next(); } // Kill the old selections deleteSelectedStencils(); // Add the group as the selected stencil m_pCurLayer->addStencil( pGroup ); selectStencil( pGroup ); } */ void KivioPage::ungroupSelectedStencils() { KivioStencil *pSelStencil, *pStencil; QPtrList *pList; QPtrList *pSelectThese = new QPtrList; pSelectThese->setAutoDelete(false); // Iterate through all selected stencils pSelStencil = m_lstSelection.first(); while( pSelStencil ) { // If there is a list, it is a group stencil pList = pSelStencil->groupList(); if( pList ) { pList->first(); pStencil = pList->take(); while( pStencil ) { addStencil( pStencil ); pSelectThese->append( pStencil ); pStencil = pList->take(); } /* * The following is commented out because the group should be on the * current layer since selections must be on the current layer. */ // Since this was a group, it is now an empty stencil, so we remove it // from the selection list, and then remove it from the layer it came // from, but we have to search for that. /* pSelStencil = m_lstSelection.take(); KivioLayer *pLayer = m_lstLayers.first(); while( pLayer ) { if( pLayer->removeStencil( pSelStencil )==true ) break; pLayer = m_lstLayers.next(); } */ // Remove the current stencil from the selection list(the group we just disassembled) m_lstSelection.take(); // Remove it permanently from the layer if( m_pCurLayer->removeStencil( pSelStencil )==false ) { kdDebug() << "KivioPage::ungroupSelectedStencil() - Failed to locate the group shell for deletion" << endl; } } pSelStencil = m_lstSelection.next(); } // Now iterate through the selectThese list and select // those stencils pStencil = pSelectThese->first(); while( pStencil ) { selectStencil( pStencil ); pStencil = pSelectThese->next(); } delete pSelectThese; } void KivioPage::bringToFront() { KivioStencil *pStencil, *pMove; KivioLayer *pLayer; QPtrList newList; pLayer = m_pCurLayer; newList.setAutoDelete(false); /* * We iterate through all stencils since order must be maintained * amongst the selection during the move. */ pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected( pStencil )==true ) { pMove = pLayer->takeStencil(); if( pMove ) { newList.append(pMove); pStencil = pLayer->currentStencil(); } else // In the case of error, the outside else won't execute { pStencil = pLayer->nextStencil(); } } else { pStencil = pLayer->nextStencil(); } } // push them back in, in reverse order pStencil = newList.first(); while( pStencil ) { pLayer->stencilList()->append(pStencil); pStencil = newList.next(); } } void KivioPage::sendToBack() { KivioStencil *pStencil, *pMove; KivioLayer *pLayer; QPtrList newList; pLayer = m_pCurLayer; newList.setAutoDelete(false); /* * We iterate through all stencils since order must be maintained * amongst the selection during the move. */ pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected( pStencil )==true ) { pMove = pLayer->takeStencil(); if( pMove ) { newList.append(pMove); pStencil = pLayer->currentStencil(); } else // In the case of error, the outside else won't execute { pStencil = pLayer->nextStencil(); } } else { pStencil = pLayer->nextStencil(); } } // push them back in, in reverse order pStencil = newList.last(); while( pStencil ) { pLayer->stencilList()->insert(0, pStencil); pStencil = newList.prev(); } } void KivioPage::copy() { KivioGroupStencil *pGroup = new KivioGroupStencil(); KivioStencil *pStencil; KivioLayer *pLayer; if( m_lstSelection.count() <= 0 ) return; pLayer = m_pCurLayer; pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected( pStencil )==true ) { pGroup->addToGroup( pStencil->duplicate() ); } pStencil = pLayer->nextStencil(); } m_pDoc->setClipboard( pGroup ); } void KivioPage::cut() { KivioGroupStencil *pGroup = new KivioGroupStencil(); KivioStencil *pStencil; KivioLayer *pLayer; bool safe=true; if( m_lstSelection.count() <= 0 ) return; pLayer = m_pCurLayer; // Make sure none of them are protected from deletion pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected( pStencil )==true ) { if( pStencil->protection()->at(kpDeletion)==true ) { safe=false; } } pStencil = pLayer->nextStencil(); } if( safe==false ) { KMessageBox::information(NULL, i18n("One of the stencils has protection from deletion. You cannot cut or delete this stencil."), i18n("Protection From Delete") ); return; } pStencil = pLayer->firstStencil(); while( pStencil ) { if( isStencilSelected( pStencil )==true ) { pGroup->addToGroup( pStencil->duplicate() ); } pStencil = pLayer->nextStencil(); } deleteSelectedStencils(); m_pDoc->setClipboard( pGroup ); } void KivioPage::paste() { KivioStencil *pGroup; KivioStencil *pStencil, *pDup; QPtrList *pList; QPtrList *pSelectThese = new QPtrList; pSelectThese->setAutoDelete(false); pGroup = m_pDoc->clipboard(); if( !pGroup ) { delete pSelectThese; return; } // If there is a list, it is a group stencil pList = pGroup->groupList(); if( pList ) { pStencil = pList->first(); while( pStencil ) { pDup = pStencil->duplicate(); // FIXME: Make this offset configurable pDup->setPosition( pDup->x() + 10.0f, pDup->y() + 10.0f ); addStencil( pDup ); pSelectThese->append( pDup ); pStencil = pList->next(); } } unselectAllStencils(); // Now iterate through the selectThese list and select // those stencils pStencil = pSelectThese->first(); while( pStencil ) { selectStencil( pStencil ); pStencil = pSelectThese->next(); } delete pSelectThese; } int KivioPage::generateStencilIds(int next) { KivioLayer *pLayer; pLayer = m_lstLayers.first(); while( pLayer ) { next = pLayer->generateStencilIds( next ); pLayer = m_lstLayers.next(); } return next; } KivioLayer *KivioPage::firstLayer() { return m_lstLayers.first(); } KivioLayer *KivioPage::nextLayer() { return m_lstLayers.next(); } KivioLayer *KivioPage::prevLayer() { return m_lstLayers.prev(); } KivioLayer *KivioPage::lastLayer() { return m_lstLayers.last(); } bool KivioPage::removeCurrentLayer() { KivioLayer *pLayer; // NOOOOOOO! if( m_lstLayers.count() <= 1 ) return false; pLayer = m_lstLayers.first(); if( pLayer != m_pCurLayer ) { if( m_lstLayers.find( m_pCurLayer )==false ) { kdDebug() << "KivioLayer::removeCurrentLayer() - Couldn't find current layer in the list. Bad!" << endl; return false; } } pLayer = m_lstLayers.next(); if( !pLayer ) { (void)m_lstLayers.last(); pLayer = m_lstLayers.prev(); } if( !pLayer ) { kdDebug() << "KivioLayer::removeCurrentLayer() - Couldn't find a next layer." << endl; return false; } KivioRemoveLayerCommand * cmd = new KivioRemoveLayerCommand( i18n("Remove Layer"), this , m_pCurLayer , m_lstLayers.findRef(m_pCurLayer) ); doc()->addCommand( cmd ); takeLayer( m_pCurLayer ); /* if( m_lstLayers.remove( m_pCurLayer )==false ) { kdDebug() << "KivioLayer::removeCurrentLayer() - Couldn't find current layer in the list. Bad!" << endl; return false; } */ m_pCurLayer = pLayer; return true; } void KivioPage::takeLayer( KivioLayer *pLayer ) { int pos=m_lstLayers.findRef(pLayer); m_lstLayers.take( pos ); } void KivioPage::addLayer( KivioLayer *pLayer ) { m_lstLayers.append( pLayer ); } void KivioPage::insertLayer( int position, KivioLayer *pLayer ) { m_lstLayers.insert( position, pLayer ); } KivioLayer *KivioPage::layerAt( int pos ) { return m_lstLayers.at(pos); } void KivioPage::alignStencils(AlignData d) { KivioStencil* pStencil = m_lstSelection.first(); if(!pStencil) return; if (d.centerOfPage) { float w = m_pPageLayout.ptWidth; float h = m_pPageLayout.ptHeight; while( pStencil ) { pStencil->setPosition((w-pStencil->w())/2,(h-pStencil->h())/2); pStencil = m_lstSelection.next(); } return; } if (d.v != AlignData::None || d.h != AlignData::None) { float x = pStencil->x(); float y = pStencil->y(); float w = pStencil->w(); float h = pStencil->h(); while( pStencil ) { switch (d.v) { case AlignData::Top: pStencil->setY(y); break; case AlignData::Center: pStencil->setY(y+h/2-pStencil->h()/2); break; case AlignData::Bottom: pStencil->setY(y+h-pStencil->h()); break; default: break; } switch (d.h) { case AlignData::Left: pStencil->setX(x); break; case AlignData::Center: pStencil->setX(x+w/2-pStencil->w()/2); break; case AlignData::Right: pStencil->setX(x+w-pStencil->w()); break; default: break; } pStencil = m_lstSelection.next(); } } } class XYSortedStencilList : public QPtrList { public: XYSortedStencilList(bool sortX) :xsort(sortX) {}; protected: int compareItems(QPtrCollection::Item i1, QPtrCollection::Item i2) { KivioStencil* s1 = (KivioStencil*)i1; KivioStencil* s2 = (KivioStencil*)i2; if (xsort) { if (s1->x() > s2->x()) return 1; if (s1->x() < s2->x()) return -1; return 0; } if (s1->y() > s2->y()) return 1; if (s1->y() < s2->y()) return -1; return 0; } private: bool xsort; }; void KivioPage::distributeStencils(DistributeData d) { float x = 0.0; float y = 0.0; float x1 = 0.0; float y1 = 0.0; KivioStencil* pStencil = m_lstSelection.first(); if (!pStencil) return; XYSortedStencilList xSortList(true); XYSortedStencilList ySortList(false); while( pStencil ) { xSortList.append(pStencil); ySortList.append(pStencil); pStencil = m_lstSelection.next(); } xSortList.sort(); ySortList.sort(); switch (d.extent) { case DistributeData::Page: x = m_pPageLayout.ptLeft; y = m_pPageLayout.ptTop; x1 = m_pPageLayout.ptWidth - m_pPageLayout.ptRight; y1 = m_pPageLayout.ptHeight - m_pPageLayout.ptBottom; break; case DistributeData::Selection: pStencil = m_lstSelection.first(); x = pStencil->x(); y = pStencil->x(); x1 = x + pStencil->w(); y1 = y + pStencil->h(); while( pStencil ) { x = QMIN(x,pStencil->x()); y = QMIN(y,pStencil->y()); x1 = QMAX(x1,pStencil->x() + pStencil->w()); y1 = QMAX(y1,pStencil->y() + pStencil->h()); pStencil = m_lstSelection.next(); } break; default: break; } /*****************************************************/ KivioStencil* firstx = xSortList.first(); KivioStencil* lastx = xSortList.last(); float countx = (float)(xSortList.count()-1); float distx = 0.0; switch (d.h) { case DistributeData::Left: x1 = x1 - lastx->w(); distx = (x1 - x)/countx; break; case DistributeData::Center: x = x + firstx->w()/2; x1 = x1 - lastx->w()/2; distx = (x1 - x)/countx; break; case DistributeData::Spacing: { float allw = 0.0; pStencil = xSortList.first(); while( pStencil ) { allw = allw + pStencil->w(); pStencil = xSortList.next(); } distx = (x1-x-allw)/countx; break; } case DistributeData::Right: x = x + firstx->w(); distx = (x1 - x)/countx; break; default: break; } float xx = x; switch (d.h) { case DistributeData::Center: pStencil = xSortList.first(); while( pStencil ) { pStencil->setX(xx - pStencil->w()/2); xx = xx + distx; pStencil = xSortList.next(); } break; case DistributeData::Right: pStencil = xSortList.first(); while( pStencil ) { pStencil->setX(xx - pStencil->w()); xx = xx + distx; pStencil = xSortList.next(); } break; case DistributeData::Left: pStencil = xSortList.first(); while( pStencil ) { pStencil->setX(xx); xx = xx + distx; pStencil = xSortList.next(); } break; case DistributeData::Spacing: pStencil = xSortList.first(); while( pStencil ) { pStencil->setX(xx); xx = xx + pStencil->w() + distx; pStencil = xSortList.next(); } break; default: break; } /*****************************************************/ KivioStencil* firsty = ySortList.first(); KivioStencil* lasty = ySortList.last(); float county = (float)(ySortList.count()-1); float disty = 0.0; switch (d.v) { case DistributeData::Top: y1 = y1 - lasty->h(); disty = (y1 - y)/county; break; case DistributeData::Center: y = y + firsty->h()/2; y1 = y1 - lasty->h()/2; disty = (y1 - y)/countx; break; case DistributeData::Spacing: { float allh = 0.0; pStencil = ySortList.first(); while( pStencil ) { allh = allh + pStencil->h(); pStencil = ySortList.next(); } disty = (y1-y-allh)/county; break; } case DistributeData::Bottom: y = y + firsty->h(); disty = (y1 - y)/county; break; default: break; } float yy = y; switch (d.v) { case DistributeData::Center: pStencil = ySortList.first(); while( pStencil ) { pStencil->setY(yy - pStencil->h()/2); yy = yy + disty; pStencil = ySortList.next(); } break; case DistributeData::Bottom: pStencil = ySortList.first(); while( pStencil ) { pStencil->setY(yy - pStencil->h()); yy = yy + disty; pStencil = ySortList.next(); } break; case DistributeData::Top: pStencil = ySortList.first(); while( pStencil ) { pStencil->setY(yy); yy = yy + disty; pStencil = ySortList.next(); } break; case DistributeData::Spacing: pStencil = ySortList.first(); while( pStencil ) { pStencil->setY(yy); yy = yy + pStencil->h() + disty; pStencil = ySortList.next(); } break; default: break; } } /** * Returns a rectangle representing the bounds of all the selected stencils (in points). */ KivioRect KivioPage::getRectForAllSelectedStencils() { KivioRect rTotal, r; KivioStencil *pStencil = m_lstSelection.first(); // Get the rect of the first selected stencil if( pStencil ) { rTotal = pStencil->rect(); pStencil = m_lstSelection.next(); } // iterate through all the stencils uniting the rectangles while( pStencil ) { r = pStencil->rect(); rTotal = rTotal.unite( r ); pStencil = m_lstSelection.next(); } return rTotal; } /** * Returns a rectangle representing the bounds of all the selected stencils (in points). */ KivioRect KivioPage::getRectForAllStencils() { KivioRect rTotal, r; bool firstTime = true; KivioLayer *pLayer; KivioStencil *pStencil; pLayer = m_lstLayers.first(); while( pLayer ) { pStencil = pLayer->firstStencil(); while( pStencil ) { if( firstTime==true ) { rTotal = pStencil->rect(); firstTime = false; } else { r = pStencil->rect(); rTotal = rTotal.unite( r ); } pStencil = pLayer->nextStencil(); } pLayer = m_lstLayers.next(); } return rTotal; } void KivioPage::setPaperLayout(const KoPageLayout &l) { m_pPageLayout = l; doc()->updateView(this); emit sig_pageLayoutChanged(m_pPageLayout); } KivioConnectorTarget *KivioPage::connectPointToTarget( KivioConnectorPoint *p, float /*thresh*/) { float oldX, oldY; KivioLayer *pLayer, *pCurLayer; bool doneSearching = false; KivioConnectorTarget *pTarget; if( !p ) return NULL; if( p->connectable()==false ) return NULL; oldX = p->x(); oldY = p->y(); pCurLayer = curLayer(); pLayer = firstLayer(); while( pLayer && doneSearching==false ) { if( pLayer != pCurLayer ) { if( pLayer->connectable()==false || pLayer->visible()==false ) { pLayer = nextLayer(); continue; } } if( (pTarget=pLayer->connectPointToTarget(p, 8.0f )) ) { return pTarget; } pLayer = nextLayer(); } return NULL; } void KivioPage::setHidePage(bool _hide) { setHidden(_hide); if(_hide) emit sig_PageHidden(this); else emit sig_PageShown(this); } #include "kivio_page.moc" Index: trunk/koffice/kivio/kiviopart/kiviostencilsetaction.h =================================================================== --- trunk/koffice/kivio/kiviopart/kiviostencilsetaction.h (nonexistent) +++ trunk/koffice/kivio/kiviopart/kiviostencilsetaction.h (revision 219196) @@ -0,0 +1,66 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Peter Simonsson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef KIVIOSTENCILSETACTION_H +#define KIVIOSTENCILSETACTION_H + + +#include + +#include + +class KPopupMenu; +class QPixmap; + +class KivioStencilSetAction : public KAction +{ + Q_OBJECT + public: + KivioStencilSetAction(const QString &text, const QString &pix, + KActionCollection *parent, const char *name); + + virtual ~KivioStencilSetAction(); + + KPopupMenu* popupMenu() const; + void popup( const QPoint& global ); + + virtual int plug( QWidget* widget, int index = -1 ); + + public slots: + void updateMenu(); + + protected slots: + void slotActivated(int); + + signals: + void activated( const QString& ); + + protected: + QPixmap dirtPixmap( const QString& dir ); + void loadCollections( const QString& rootDirStr ); + void loadSet( KPopupMenu* menu, const QString& rootDirStr ); + + protected: + KPopupMenu* m_popup; + uint m_id; + QPtrList m_childMenuList; + QPtrList m_pathList; +}; + +#endif Property changes on: trunk/koffice/kivio/kiviopart/kiviostencilsetaction.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Index: trunk/koffice/kivio/kiviopart/Makefile.am =================================================================== --- trunk/koffice/kivio/kiviopart/Makefile.am (revision 219195) +++ trunk/koffice/kivio/kiviopart/Makefile.am (revision 219196) @@ -1,170 +1,131 @@ SUBDIRS = ui kiviosdk tklib tools pics tiles stencils . kde_module_LTLIBRARIES = libkiviopart.la libkiviopart_la_LIBADD = \ $(top_builddir)/kivio/kiviopart/tools/libtools.la\ $(top_builddir)/kivio/kiviopart/tklib/libtklib.la\ $(top_builddir)/kivio/kiviopart/kiviosdk/libkiviosdk.la\ $(top_builddir)/kivio/kiviopart/ui/libui.la \ $(LIB_KOFFICEUI) $(LIB_KOTEXT) $(LIBPYTHON) $(PYTHONLIB) INCLUDES = -I$(srcdir)/ui\ -Iui\ -I$(srcdir)/kiviosdk\ -I$(srcdir)/tklib\ -I$(srcdir)/tools\ $(KOFFICE_INCLUDES)\ $(KOTEXT_INCLUDES)\ -I$(top_srcdir)/lib/kformula\ $(all_includes) libkiviopart_la_METASOURCES = AUTO -libkiviopart_la_SOURCES = kivio_canvas.cpp \ - kivio_doc.cpp\ - kivio_factory.cpp\ - kivio_tabbar.cpp\ - kivio_view.cpp\ - kivio_map.cpp\ - kivio_page.cpp\ - kivio_dlg_pageshow.cpp\ - kivio_ruler.cpp\ - kivio_zoomaction.cpp\ - add_spawner_set_dlg.cpp\ - kivio_icon_view.cpp\ - kivio_config.cpp\ - kivio_spawner_drag.cpp\ - kivio_intra_stencil_data.cpp\ - kivio_stackbar.cpp\ - stencilbarbutton.cpp\ - stencilbardockmanager.cpp\ - stencilbarmovemanager.cpp\ - kivio_lineendsaction.cpp\ - tooldockbase.cpp\ - tooldockmanager.cpp\ - kivio_paragraph_action.cpp\ - stencil_text_dlg.cpp\ - kivio_grid_data.cpp\ - kivio_guidelines.cpp\ - kivio_stencil_geometry_panel.cpp\ - kivio_viewmanager_panel.cpp\ - KIvioViewIface.skel\ - KIvioViewIface.cc\ - KIvioDocIface.skel\ - KIvioDocIface.cc\ - KIvioMapIface.skel\ - KIvioMapIface.cc\ - KIvioPageIface.skel\ - KIvioPageIface.cc\ - kivio_command.cc\ - KIvioLayerIface.skel\ - KIvioLayerIface.cc\ - kivioglobal.cpp +libkiviopart_la_SOURCES = kivio_canvas.cpp kivio_doc.cpp kivio_factory.cpp kivio_tabbar.cpp kivio_view.cpp kivio_map.cpp kivio_page.cpp kivio_dlg_pageshow.cpp kivio_ruler.cpp kivio_zoomaction.cpp add_spawner_set_dlg.cpp kivio_icon_view.cpp kivio_config.cpp kivio_spawner_drag.cpp kivio_intra_stencil_data.cpp kivio_stackbar.cpp stencilbarbutton.cpp stencilbardockmanager.cpp stencilbarmovemanager.cpp kivio_lineendsaction.cpp tooldockbase.cpp tooldockmanager.cpp kivio_paragraph_action.cpp stencil_text_dlg.cpp kivio_grid_data.cpp kivio_guidelines.cpp kivio_stencil_geometry_panel.cpp kivio_viewmanager_panel.cpp KIvioViewIface.skel KIvioViewIface.cc KIvioDocIface.skel KIvioDocIface.cc KIvioMapIface.skel KIvioMapIface.cc KIvioPageIface.skel KIvioPageIface.cc kivio_command.cc KIvioLayerIface.skel KIvioLayerIface.cc kivioglobal.cpp kiviostencilsetaction.h kiviostencilsetaction.cpp EXTRA_DIST = \ main.cpp\ kivio_canvas.cpp\ kivio_canvas.h\ kivio_doc.cpp\ kivio_doc.h\ kivio_factory.cpp\ kivio_factory.h\ kivio_tabbar.cpp\ kivio_tabbar.h\ kivio_view.cpp\ kivio_view.h\ kivio_map.cpp\ kivio_map.h\ kivio_page.cpp\ kivio_page.h\ kivio.desktop\ x-kivio.desktop\ kivio.rc\ kivio_readonly.rc\ kivio_dlg_pageshow.cpp\ kivio_dlg_pageshow.h\ kivio_ruler.cpp\ kivio_ruler.h\ kivio_zoomaction.cpp\ kivio_zoomaction.h\ add_spawner_set_dlg.cpp\ add_spawner_set_dlg.h\ kivio_icon_view.cpp\ kivio_icon_view.h\ kivio_config.cpp\ kivio_config.h\ kivio_spawner_drag.cpp\ kivio_spawner_drag.h\ kivio_intra_stencil_data.cpp\ kivio_intra_stencil_data.h\ toolbarseparator.cpp\ toolbarseparator.h\ kivio_stackbar.cpp\ kivio_stackbar.h\ stencilbarbutton.cpp\ stencilbarbutton.h\ stencilbardockmanager.cpp\ stencilbardockmanager.h\ stencilbarmovemanager.cpp\ stencilbarmovemanager.h\ kivio_lineendsaction.cpp\ kivio_lineendsaction.h\ tooldockbase.cpp\ tooldockbase.h\ tooldockmanager.cpp\ tooldockmanager.h\ kivio_lineendspix.h\ kivio_paragraph_action.h\ kivio_paragraph_action.cpp\ stencil_text_dlg.cpp\ stencil_text_dlg.h\ lo16-app-kivio.png\ lo22-app-kivio.png\ lo32-app-kivio.png\ hi48-app-kivio.png\ hi16-app-kivio.png\ hi22-app-kivio.png\ hi32-app-kivio.png\ kivio_grid_data.cpp\ kivio_grid_data.h\ kivio_guidelines.cpp\ kivio_guidelines.h\ kivio_stencil_geometry_panel.cpp\ kivio_stencil_geometry_panel.h\ kivio_viewmanager_panel.cpp\ kivio_viewmanager_panel.h \ KIvioViewIface.skel KIvioViewIface.cc KIvioViewIface.h \ KIvioDocIface.skel KIvioDocIface.cc KIvioDocIface.h \ KIvioMapIface.skel KIvioMapIface.cc KIvioMapIface.h \ KIvioPageIface.skel KIvioPageIface.cc KIvioPageIface.h \ kivio_command.cc kivio_command.h KIvioLayerIface.cc \ KIvioLayerIface.h \ kivioglobal.h lib_LTLIBRARIES = kivio.la kivio_la_SOURCES = main.cpp kivio_la_LDFLAGS = $(all_libraries) -module -avoid-version kivio_la_LIBADD = ../../lib/kofficecore/libkofficecore.la libkiviopart_la_LDFLAGS = -avoid-version -module $(all_libraries) bin_PROGRAMS = kivio kivio_SOURCES = dummy.cpp kivio_LDFLAGS = $(all_libraries) $(KDE_RPATH) kivio_LDADD = kivio.la dummy.cpp: echo > dummy.cpp kdelnk_DATA = kivio.desktop kdelnkdir = $(kde_appsdir)/Office rc_DATA = kivio.rc kivio_readonly.rc rcdir = $(kde_datadir)/kivio KDE_ICON = kivio kivio_view.lo: ui/kivio_protection_panel_base.h \ ui/kivio_layer_panel_base.h ui/kivio_birdeye_panel_base.h \ ui/export_page_dialog_base.h \ ui/aligndialog.h