Esempio n. 1
0
void wxOSXPrintData::TransferTo( wxPrintDialogData* data )
{
#if wxOSX_USE_COCOA
    UpdateToPMState();
#endif
    UInt32 minPage , maxPage ;
    PMGetPageRange( m_macPrintSettings , &minPage , &maxPage ) ;
    data->SetMinPage( minPage ) ;
    data->SetMaxPage( maxPage ) ;
    UInt32 copies ;
    PMGetCopies( m_macPrintSettings , &copies ) ;
    data->SetNoCopies( copies ) ;
    UInt32 from , to ;
    PMGetFirstPage( m_macPrintSettings , &from ) ;
    PMGetLastPage( m_macPrintSettings , &to ) ;
    if ( to >= 0x7FFFFFFF ) //  due to an OS Bug we don't get back kPMPrintAllPages
    {
        data->SetAllPages( true ) ;
        // This means all pages, more or less
        data->SetFromPage(1);
        data->SetToPage(9999);
    }
    else
    {
        data->SetFromPage( from ) ;
        data->SetToPage( to ) ;
        data->SetAllPages( false );
    }
}
Esempio n. 2
0
void wxMacCarbonPrintData::TransferTo( wxPrintDialogData* data )
{
    UInt32 minPage , maxPage ;
    PMGetPageRange( m_macPrintSettings , &minPage , &maxPage ) ;
    data->SetMinPage( minPage ) ;
    data->SetMaxPage( maxPage ) ;
    UInt32 copies ;
    PMGetCopies( m_macPrintSettings , &copies ) ;
    data->SetNoCopies( copies ) ;
    UInt32 from , to ;
    PMGetFirstPage( m_macPrintSettings , &from ) ;
    PMGetLastPage( m_macPrintSettings , &to ) ;
    data->SetFromPage( from ) ;
    data->SetToPage( to ) ;
}
Esempio n. 3
0
void QPrinter::interpret(PMPrintSettings *s)
{
  //get values
  UInt32 from, to;
  if (PMGetFirstPage(*s, &from) == noErr && PMGetLastPage(*s, &to) == noErr) {
    if (to == INT_MAX) //this means all pages!
      from = to = 0;
    setFromTo(from, to);
  }

  UInt32 copies;
  if (PMGetCopies(*s, &copies) == noErr)
    setNumCopies(copies);

  UInt32 max, min;
  if (PMGetPageRange(*s, &min, &max) == noErr) {
    // The problem here is that Apple's print dialog will always show a one even when you pass
    // it a zero. So take care of that. The other problem is that we can also call this because
    // we need to interpret the default settings, in that case, the min and max will both be
    // zero. In that case, leave them "as is" as some other functions will reset the max and
    // make everything OK when the dialog is actually called.
    int newMin = min;
    int newMax = max;

    if (newMin < 1 && newMax != 0)
      newMin = 1;
    setMinMax(newMin, newMax);
  }

  PMColorMode cm;
  if (PMGetColorMode(*s, &cm) == noErr)
    setColorMode(cm == kPMGray ? GrayScale : Color);
  // Get the current Printer Name
  CFIndex currPrinterIndex;
  PMPrinter currPrinter;
  CFArrayRef printerArray;
  OSStatus err = PMSessionCreatePrinterList(psession, &printerArray,
                                            &currPrinterIndex, &currPrinter);
  if (err != noErr)
    qWarning("Qt: QPrinter::interpret problem creating printer list %ld", err);
  if (printerArray) {
    setPrinterName(cfstring2qstring((CFStringRef)CFArrayGetValueAtIndex(printerArray,
                                                                        currPrinterIndex)));
    CFRelease(printerArray);
  }
}