diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2018-01-07 00:39:33 +1100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-03-01 10:54:32 +0100 |
commit | c3074cb5784329eaf558c2f58d96a64085b42d48 (patch) | |
tree | 8f166e61c76fba2e6f118b4f98f615d917e7d709 /vcl/unx | |
parent | b4f3af91d344d5f8c18e060615360e2a6633b63f (diff) |
vcl: remove dead code
I have converted the debug code that causes a force
redraw/widget_queue_draw/dumpframes to be activated when using the
environment variable VCL_GTK3_PAINTDEBUG=1
Change-Id: Ia2d41dbd42b5b45f97b195efa15c91674f5956bf
Reviewed-on: https://gerrit.libreoffice.org/47493
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/salprn-gtk.cxx | 158 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 56 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5SalGraphics.cxx | 61 |
3 files changed, 34 insertions, 241 deletions
diff --git a/vcl/unx/gtk/salprn-gtk.cxx b/vcl/unx/gtk/salprn-gtk.cxx index d77a6b69d98d..a7ad04c8d6c7 100644 --- a/vcl/unx/gtk/salprn-gtk.cxx +++ b/vcl/unx/gtk/salprn-gtk.cxx @@ -67,9 +67,7 @@ public: return m_xWrapper->print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog)); } void updateControllerPrintRange(); -#if 0 - void ExportAsPDF(const OUString &rFileURL, GtkPrintSettings* pSettings) const; -#endif + ~GtkPrintDialog(); static void UIOption_CheckHdl(GtkWidget* i_pWidget, GtkPrintDialog* io_pThis) @@ -228,20 +226,7 @@ GtkSalPrinter::StartJob( m_xImpl->m_pPrinter = aDialog.getPrinter(); m_xImpl->m_pSettings = aDialog.getSettings(); -#if 0 - if (const gchar *uri = gtk_print_settings_get(m_xImpl->m_pSettings, GTK_PRINT_SETTINGS_OUTPUT_URI)) - { - const gchar *pStr = gtk_print_settings_get(m_xImpl->m_pSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); - if (pStr && !strcmp(pStr, "pdf")) - { - aDialog.ExportAsPDF(OUString((const sal_Char *)uri, strlen((const sal_Char *)uri), RTL_TEXTENCODING_UTF8), m_xImpl->m_pSettings); - bDoJob = false; - } - } - - if (!bDoJob) - return false; -#endif + bool bCollate = false; //To-Do proper name, watch for encodings sFileName = OString("/tmp/hacking.ps"); @@ -251,7 +236,7 @@ GtkSalPrinter::StartJob( //To-Do, swap ps/pdf for gtk_printer_accepts_ps()/gtk_printer_accepts_pdf() ? - return impl_doJob(&aFileName, i_rJobName, i_rAppName, io_pSetupData, /*bCollate*/false, io_rController); + return impl_doJob(&aFileName, i_rJobName, i_rAppName, io_pSetupData, bCollate, io_rController); } bool @@ -270,15 +255,6 @@ GtkSalPrinter::EndJob() std::shared_ptr<GtkPrintWrapper> const xWrapper(lcl_getGtkSalInstance().getPrintWrapper()); GtkPageSetup* pPageSetup = xWrapper->page_setup_new(); -#if 0 - //todo - gtk_page_setup_set_orientation(pPageSetup,); - gtk_page_setup_set_paper_size(pPageSetup,); - gtk_page_setup_set_top_margin(pPageSetup,); - gtk_page_setup_set_bottom_margin(pPageSetup,); - gtk_page_setup_set_left_margin(pPageSetup,); - gtk_page_setup_set_right_margin(pPageSetup,); -#endif GtkPrintJob* const pJob = xWrapper->print_job_new( OUStringToOString(m_xImpl->m_sJobName, RTL_TEXTENCODING_UTF8).getStr(), @@ -878,134 +854,6 @@ GtkPrintDialog::run() return bDoJob; } -#if 0 -void GtkPrintDialog::ExportAsPDF(const OUString &rFileURL, GtkPrintSettings *pSettings) const -{ - uno::Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - uno::Reference < XFrame > xFrame(xDesktop->getActiveFrame()); - if (!xFrame.is()) - xFrame.set(xDesktop, UNO_QUERY); - - uno::Reference < XFilter > xFilter( - ::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.PDFFilter"), - UNO_QUERY); - - if (xFilter.is()) - { - uno::Reference< XController > xController; - uno::Reference< XComponent > xDoc; - if (xFrame.is()) - xController = xFrame->getController(); - if (xController.is()) - xDoc.set(xController->getModel(), UNO_QUERY); - - SvFileStream aStream(rFileURL, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE | StreamMode::TRUNC); - uno::Reference< XOutputStream > xOStm(new utl::OOutputStreamWrapper(aStream)); - - uno::Reference< XExporter > xExport(xFilter, UNO_QUERY); - xExport->setSourceDocument(xDoc); - uno::Sequence<beans::PropertyValue> aFilterData( comphelper::InitPropertySequence({ - { "PageLayout", Any(sal_Int32(0)) }, - { "FirstPageOnLeft", Any(false) } - })); - - const gchar *pStr = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_PRINT_PAGES); - if (pStr && !strcmp(pStr, "ranges")) - { - String aRangeText; - gint num_ranges; - const GtkPageRange* pRanges = gtk_print_settings_get_page_ranges(pSettings, &num_ranges); - for (gint i = 0; i < num_ranges; ++i) - { - aRangeText.Append(OUString::number(pRanges[i].start+1)); - if (pRanges[i].start != pRanges[i].end) - { - aRangeText.AppendAscii("-"); - aRangeText.Append(OUString::number(pRanges[i].end+1)); - } - - if (i != num_ranges-1) - aRangeText.AppendAscii(","); - } - aFilterData.realloc(aFilterData.getLength()+1); - aFilterData[aFilterData.getLength()-1].Name = "PageRange"; - aFilterData[aFilterData.getLength()-1].Value <<= aRangeText; - } - else if (pStr && !strcmp(pStr, "current")) - { - try - { - uno::Reference< XSpreadsheetView > xSpreadsheetView; - uno::Reference< XSpreadsheet> xSheet; - uno::Reference< XSpreadsheetDocument > xSheetDoc; - uno::Reference< XIndexAccess > xSheets; - uno::Reference< XNamed > xName; - - if (xController.is()) - xSpreadsheetView.set(xController, UNO_QUERY); - if (xSpreadsheetView.is()) - xSheet.set(xSpreadsheetView->getActiveSheet()); - if (xSheet.is()) - xName.set(xSheet, UNO_QUERY); - if (xName.is()) - xSheetDoc.set(xController->getModel(), UNO_QUERY); - if (xSheetDoc.is()) - xSheets.set(xSheetDoc->getSheets(), UNO_QUERY); - if (xSheets.is()) - { - const OUString &rName = xName->getName(); - - sal_Int32 i; - - for (i = 0; i < xSheets->getCount(); ++i) - { - uno::Reference < XNamed > xItem = - uno::Reference < XNamed >(xSheets->getByIndex(i), UNO_QUERY); - if (rName == xItem->getName()) - break; - } - - if (i < xSheets->getCount()) - { - aFilterData.realloc(aFilterData.getLength()+1); - aFilterData[aFilterData.getLength()-1].Name = "PageRange"; - aFilterData[aFilterData.getLength()-1].Value <<= OUString::number(i + 1); - } - } - } - catch (...) {} - } - if (gtk_print_unix_dialog_get_has_selection(GTK_PRINT_UNIX_DIALOG(m_pDialog))) - { - uno::Any aSelection; - try - { - if (xController.is()) - { - uno::Reference<view::XSelectionSupplier> xView(xController, UNO_QUERY); - if (xView.is()) - xView->getSelection() >>= aSelection; - } - } - catch (const uno::RuntimeException &) - { - } - if (aSelection.hasValue()) - { - aFilterData.realloc(aFilterData.getLength()+1); - aFilterData[aFilterData.getLength()-1].Name = "Selection"; - aFilterData[aFilterData.getLength()-1].Value <<= aSelection; - } - } - uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({ - { "FilterData", Any(aFilterData) }, - { "OutputStream", Any(xOStm) } - })); - xFilter->filter(aArgs); - } -} -#endif - void GtkPrintDialog::updateControllerPrintRange() { diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 162d46286941..835748c49029 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -363,7 +363,9 @@ GetAlternateKeyCode( const sal_uInt16 nKeyCode ) return aAlternate; } +#if OSL_DEBUG_LEVEL > 0 static bool dumpframes = false; +#endif bool GtkSalFrame::doKeyCallback( guint state, guint keyval, @@ -381,29 +383,37 @@ bool GtkSalFrame::doKeyCallback( guint state, vcl::DeletionListener aDel( this ); -#if 0 - if (bDown) +#if OSL_DEBUG_LEVEL > 0 + char* pKeyDebug = nullptr; + pKeyDebug = getenv("VCL_GTK3_PAINTDEBUG"); + + if (strlen(pKeyDebug) == 1 && pKeyDebug[0] == '1') { - // shift-zero forces a re-draw and event is swallowed - if (keyval == GDK_KEY_0) - { - fprintf( stderr, "force widget_queue_draw\n"); - gtk_widget_queue_draw(GTK_WIDGET(m_pFixedContainer)); - return false; - } - else if (keyval == GDK_KEY_1) + if (bDown) { - fprintf( stderr, "force repaint all\n"); - TriggerPaintEvent(); - return false; - } - else if (keyval == GDK_KEY_2) - { - dumpframes = !dumpframes; - fprintf(stderr, "toggle dump frames to %d\n", dumpframes); - return false; + // shift-zero forces a re-draw and event is swallowed + if (keyval == GDK_KEY_0) + { + fprintf( stderr, "force widget_queue_draw\n"); + gtk_widget_queue_draw(GTK_WIDGET(m_pFixedContainer)); + return false; + } + else if (keyval == GDK_KEY_1) + { + fprintf( stderr, "force repaint all\n"); + TriggerPaintEvent(); + return false; + } + else if (keyval == GDK_KEY_2) + { + dumpframes = !dumpframes; + fprintf(stderr, "toggle dump frames to %d\n", dumpframes); + return false; + } } } + + free(pKeyDebug); #endif /* @@ -2885,6 +2895,7 @@ cairo_t* GtkSalFrame::getCairoContext() const void GtkSalFrame::damaged(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const { +#if OSL_DEBUG_LEVEL > 0 if (dumpframes) { static int frame; @@ -2893,6 +2904,7 @@ void GtkSalFrame::damaged(sal_Int32 nExtentsX, sal_Int32 nExtentsY, cairo_surface_write_to_png(cairo_get_target(cr), tmp.getStr()); cairo_destroy(cr); } +#endif gtk_widget_queue_draw_area(GTK_WIDGET(m_pFixedContainer), nExtentsX, nExtentsY, @@ -3556,12 +3568,6 @@ void GtkSalFrame::signalDragLeave(GtkWidget *pWidget, GdkDragContext * /*context return; pThis->m_bInDrag = false; gtk_drag_unhighlight(pWidget); - -#if 0 - css::datatransfer::dnd::DropTargetEvent aEvent; - aEvent.Source = static_cast<css::datatransfer::dnd::XDropTarget*>(pThis->m_pDropTarget); - pThis->m_pDropTarget->fire_dragExit(aEvent); -#endif } void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame ) diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx index a22a695955e2..39e2a8ff235c 100644 --- a/vcl/unx/kde5/KDE5SalGraphics.cxx +++ b/vcl/unx/kde5/KDE5SalGraphics.cxx @@ -603,67 +603,6 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part, returnVal = false; } - if (returnVal) - { -#if 0 -#ifdef IMAGE_BASED_PAINTING - // Create a wrapper QPixmap around the destination pixmap, allowing the use of QPainter. - // Using X11SalGraphics::CopyScreenArea() would require using QPixmap and if Qt uses - // other graphics system than native, QPixmap::handle() would be 0 (i.e. it wouldn't work), - // I have no idea how to create QPixmap with non-null handle() in such case, so go this way. - // See XRegionToQRegion() comment for a small catch (although not real hopefully). - QPixmap destPixmap = QPixmap::fromX11Pixmap( GetDrawable(), QPixmap::ExplicitlyShared ); - QPainter paint( &destPixmap ); - if (localClipRegion && mpClipRegion) - paint.setClipRegion(localClipRegion->intersected(XRegionToQRegion(mpClipRegion))); - else if (localClipRegion) - paint.setClipRegion(*localClipRegion); - else if( mpClipRegion ) - paint.setClipRegion( XRegionToQRegion( mpClipRegion )); - paint.drawImage( widgetRect.left(), widgetRect.top(), *m_image, - 0, 0, widgetRect.width(), widgetRect.height(), - Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither ); -#else - GC gc = GetFontGC(); - if( gc ) - { - Region pTempClipRegion = NULL; - if (localClipRegion) - { - pTempClipRegion = XCreateRegion(); - foreach(const QRect& r, localClipRegion->rects()) - { - XRectangle xr; - xr.x = r.x(); - xr.y = r.y(); - xr.width = r.width(); - xr.height = r.height(); - XUnionRectWithRegion( &xr, pTempClipRegion, pTempClipRegion ); - } - if( mpClipRegion ) - XIntersectRegion( pTempClipRegion, mpClipRegion, pTempClipRegion ); - XSetRegion( GetXDisplay(), gc, pTempClipRegion ); - } - QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither); - X11SalGraphics::CopyScreenArea( GetXDisplay(), - pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(), - GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(), - gc, 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top()); - - if( pTempClipRegion ) - { - if( mpClipRegion ) - XSetRegion( GetXDisplay(), gc, mpClipRegion ); - else - XSetClipMask( GetXDisplay(), gc, None ); - XDestroyRegion( pTempClipRegion ); - } - } - else - returnVal = false; -#endif -#endif - } delete localClipRegion; return returnVal; } |