PostScriptDrv::PostScriptDrv()
{
  ncopies = 1;          // Print at least one copy of this document
  landscape = 0;        // Use portrait mode by default
  use_header = 0;       // Do not use headers and trailers by default
  use_lr_margin = 0;    // Do not use left and right margins by default  
  use_tb_margin = 0;    // Do not use top and bottom margins by default
  document_name = 0;    // Name of this document
  date_string = 0;      // Time and date this document was printed
  draw_header_line = 0; // Do not draw line between header and document 

  tabstop = DEFAULT_TAB_SIZE;
  page_count = 0;
  SetFont(COURIER, 10);
  DocumentSetup();
  row = start_y;
  line_count = lines_per_page;
  SetHeaderFont(COURIER_BOLD, 15);
}
示例#2
0
//--------------------------------------------------------------------------------------
//! Defines the NDP2k network device page (shows the devices)
//--------------------------------------------------------------------------------------
tNDP2kDevicePage::tNDP2kDevicePage(tNDP2k& ndp2k, QWidget* pParent, bool showButtons, const QList<eColumns> customColumnList )
    : tDialog(tDialog::Full, pParent)
    , m_pNDP2k( &ndp2k )
    , m_FirstRefresh ( true )
    , m_FirstRun( true )
    , m_tableRefreshMode( false )
    , m_ShowNameColumn( false ) // For debugging purposes 
    , m_ShowButtons( showButtons )
{
    setWindowTitle( tr( "Device List", "NDP2k device list dialog title" ) );

    m_ColumnName[addressColumn] = tr("Address");
    m_ColumnName[modelIdColumn] = tr("Model ID");
    m_ColumnName[manufacturerColumn] = tr("Manufacturer");
    m_ColumnName[productCodeColumn] = tr("Product Code");
    m_ColumnName[classFunctionColumn] = tr("Class/Function");
    m_ColumnName[nameColumn] = tr("ISO Name");
    m_ColumnName[busUsageColumn] = tr("Bus %");
    m_ColumnName[deviceInstanceColumn] = tr("Instance");
    m_ColumnName[serialNumberColumn] = tr("Serial No.");

    // keep name last - it is hidden & not in sort list.
    if( false == customColumnList.isEmpty() )
    {
        m_DisplayColumns = customColumnList;
    }
    else
    {
        m_DisplayColumns = (QList<eColumns>() << modelIdColumn << serialNumberColumn);
    }

    if( tNdp2kSettings::Instance()->GetDebugEnabled() )
    {
        m_DisplayColumns << addressColumn;
        m_ShowNameColumn = true;
    }
    m_DisplayColumns << nameColumn;

    assert(m_DisplayColumns.contains(nameColumn));
    m_NameColumn = m_DisplayColumns.indexOf(nameColumn);

    m_SortOptionList = QStringList();
    m_SortOption = 0;
    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        if( m_DisplayColumns[i] != nameColumn || m_ShowNameColumn )
        {
            m_SortOptionList << m_ColumnName[m_DisplayColumns[i]];
        }
    }

    // if we have a SKB keys don't have focus, else hide keys 
    m_NumKeys = 0;
    if ( HasSoftKeyBar() )
    {
        m_NumKeys = SoftKeyBar()->numSoftKeys(); 
        SoftKeyBar()->SetSoftKeyFocusPolicy(Qt::NoFocus);
    }
    else
    {
        SoftKeyBar()->ExplicitHide();
    }
    CreateActions();
    Connect( this, SIGNAL( CloseRequested() ), this, SLOT( accept() ) );

    m_pTableWidget = new tTableWidget(0, m_DisplayColumns.count(), this);
    m_pTableWidget->setFocusPolicy(Qt::StrongFocus);
    m_pTableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
    m_pTableWidget->verticalHeader()->hide();
    m_pTableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    m_pTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_pTableWidget->SetSoleFocus( true );
    m_pTableWidget->SetWrapping( true );

    if( tUiSettings::Instance()->ShowTouchToolTips() == true )
    {
        m_pTableWidget->setToolTip( tr("Tap-and-hold for more options.") );
    }
    else
    {
        m_pTableWidget->setToolTip( tr("Press %1 for more options.").arg(BUTTON_HTML(tNOSStyle::FP_ButtonImageMENU, "MENU")) ); 
    }

    Connect( m_pTableWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( SelectionChanged() ) );
    Connect( m_pTableWidget, SIGNAL( itemClicked( QTableWidgetItem* ) ), m_pDetailsAct, SLOT( trigger() ) );

    QHeaderView* pHeaderView = m_pTableWidget->horizontalHeader();
    // Prevents header bold font
    pHeaderView->setHighlightSections(false);
    pHeaderView->setDefaultAlignment(Qt::AlignLeft);
    Connect( pHeaderView, SIGNAL( sectionClicked( int ) ), this, SLOT( SetSortOption( int ) ) );
    SetHeaderFont();

    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        switch(m_DisplayColumns[i])
        {
        case addressColumn:
        case manufacturerColumn:
        case productCodeColumn:
        case busUsageColumn:
        case deviceInstanceColumn:
        case serialNumberColumn:
        default:
            {
                pHeaderView->setResizeMode(i, QHeaderView::ResizeToContents);
            }
            break;

        case modelIdColumn:
        case SwVersionColumn:
        case classFunctionColumn:
            {
                pHeaderView->setResizeMode(i, QHeaderView::Stretch);
            }
            break;

        case nameColumn:
            {
                if( m_ShowNameColumn )
                {
                    pHeaderView->setResizeMode(i, QHeaderView::Stretch);
                }
                else
                {
                    pHeaderView->setResizeMode(i, QHeaderView::Fixed);
                    pHeaderView->resizeSection(i, 0); // hide it this way. (actual hide breaks sorting.)
                }
            }
            break;
        }
    }

    QStringList headings;
    for(int i = 0; i < m_DisplayColumns.count(); i++)
    {
        headings << m_ColumnName[m_DisplayColumns[i]];
    }
    m_pTableWidget->setHorizontalHeaderLabels(headings);

    QVBoxLayout* pVLayout = new QVBoxLayout;
    pVLayout->addWidget(m_pTableWidget);
    setLayout(pVLayout);

    tNDP2k* pNDP2k = tGlobal<tNDP2k>::Instance();
    Connect(&pNDP2k->DeviceManager(), SIGNAL(DeviceListChanged(const tN2kName&)), this, SLOT(OnDeviceChanged(const tN2kName&)));

    /* Set the bus status on startup... */
    if(pNDP2k->IsBusOff())
    {
        m_IsBusOff = true;
    }
    else
    {
        m_IsBusOff = false;
    }

    m_SelectedName = "";
    
    //NSW-7687 (Work around LGC-4k unreliable response to global request for address claim...)
    // - No longer required - since we no longer do a global request for address claim.
    RefreshDeviceList();
    // initial row selected in UpdateDeviceList, when we have some content

    startTimer(1000);
    //TODO: tNotificationAndStatusMonitor::Instance()->SetVesselShow(false);

    if ( tProductSettings::Instance().GetProductFamily() == tProductSettings::MedusaFamily )
    {
        Connect( tApOperation::Instance(), SIGNAL( ApModeChanged(tPilotCommandInterface::tPilotMode) ), this, SLOT( OnApModeChanged(tPilotCommandInterface::tPilotMode) ) );
        OnApModeChanged( tApOperation::Instance()->GetApMode() ); // Init text
    }

    if( tProductSettings::Instance().ScreenPixelWidth() < 480 )
    {
        pVLayout->setMargin(0);
    }
}
示例#3
0
//--------------------------------------------------------------------------------------
//! The AIS Safety and DSC distress message page
//--------------------------------------------------------------------------------------
tVesselMessagesTabPage::tVesselMessagesTabPage( int numKeys, bool soleFocus, QWidget* pParent )
: QWidget( pParent ), m_NumKeys(numKeys)
{
    m_pTableTitle = new QLabel( tr( "Messages", "[title]" ), this );
    m_pTableTitle->hide();

    CreateActions();

    m_pMessageTable = new tTableWidget( 0, columnCount, this );
    m_pMessageTable->setFrameShape( QFrame::NoFrame );
    m_pMessageTable->SetSoleFocus( soleFocus );
    m_pMessageTable->SetWrapping( soleFocus == true );
    m_pMessageTable->hideColumn( mmsiColumn );
    m_pMessageTable->hideColumn( sourceTypeColumn );
    m_pMessageTable->hideColumn( uidColumn );
    Connect( m_pMessageTable, SIGNAL( itemClicked( QTableWidgetItem* ) ), m_pDetailsAct, SLOT( trigger() ) );

    QHeaderView* pHorizontalHeaderView = m_pMessageTable->horizontalHeader();
    pHorizontalHeaderView->setClickable( false );
    pHorizontalHeaderView->setResizeMode( timeColumn, QHeaderView::Fixed );
    pHorizontalHeaderView->setResizeMode( messageColumn, QHeaderView::Stretch );

    QString timeString = QString( tr( "Time", "[title]" ) );
    QSize headerTextSize = pHorizontalHeaderView->fontMetrics().size( 0, timeString );
    m_maxTimeWidth = headerTextSize.width() + 10;
    pHorizontalHeaderView->resizeSection( timeColumn, m_maxTimeWidth );

    QStringList headings;
    headings << timeString << tr( "Message", "[title]" );
    m_pMessageTable->setHorizontalHeaderLabels( headings );
    SetHeaderFont();

    // Prevents header bold font
    pHorizontalHeaderView->setHighlightSections( false );
    pHorizontalHeaderView->setDefaultAlignment( Qt::AlignLeft );

    QHeaderView* pVerticalHeaderView = m_pMessageTable->verticalHeader();
    pVerticalHeaderView->hide();
    pVerticalHeaderView->setResizeMode( QHeaderView::Fixed );
    pVerticalHeaderView->setDefaultSectionSize( QFontMetrics( QApplication::font() ).height() * 2 + 10 );

    QVBoxLayout* pVLayout = new QVBoxLayout( this );
    pVLayout->setContentsMargins( 0, 0, 0, 0 );

    pVLayout->addWidget( m_pTableTitle );
    pVLayout->addWidget( m_pMessageTable );

    setLayout( pVLayout );

    m_pResizeTimer = new QTimer( this );
    Connect( m_pResizeTimer, SIGNAL(timeout()), this, SLOT( Resize() ) );

    RefreshTable();
    m_pMessageTable->selectRow( 0 );

    if ( tProductSettings::Instance().AISAllowed() == true )
    {
        tAisEngine* pAisEngine = tGlobal<tAisEngine>::Instance();
        Connect( pAisEngine, SIGNAL( NewSafetyMessage( tAisSafetyMessage ) ), this, SLOT( NewAisSafetyMessage( const tAisSafetyMessage& ) ) );
        Connect( pAisEngine, SIGNAL( RemoveSafetyMessage( int ) ), this, SLOT( RemoveAisSafetyMessage( int ) ) );
    }