Example #1
0
// Make a popup dialog box 
PoreBoard::PoreBoard( QWidget * parent, const char * name )
    : QDialog( parent, name, FALSE, WType_TopLevel )
{
	this->setCaption( "AViz: Set Pores" );

	// Create a hboxlayout that will fill the first row
	hb1 = new QHBox( this, "hb1" );

	// Create a label 
	QLabel * poreL = new QLabel( hb1, "poreL" );
	poreL->setText( " Type: ");

	// Create a combo box that will go into the
	// second column; entries in the combo box will
	// be made later
	poreCob = new QComboBox( FALSE, hb1, "poreSelection" );

	// Define a callback for this combo box
	connect( poreCob, SIGNAL(activated(int)), SLOT(setPore()) );

	// Create a placeholder 
	QLabel * emptyL0 = new QLabel( hb1, "emptyL0" );
	emptyL0->setText("");

        // Add a check box button
        showPoreCb = new QCheckBox( hb1, "showPore" );
	showPoreCb->setText( "Show Pores" );
	showPoreCb->setChecked( TRUE );

	// Define a callback for this toggle switch
	connect( showPoreCb, SIGNAL(clicked()), this, SLOT(adjustPore()) );

        // Create a hboxlayout that will fill the next row
        hb2 = new QHBox( this, "hb2" );

        // Add a label and color labels
        colorL = new QLabel( hb2, "colorL" );
        colorL->setText( " Color: " );
	colorLabel0 = new ColorLabel( hb2, "color0" );
        colorLabel1 = new ColorLabel( hb2, "color1" );
        colorLabel2 = new ColorLabel( hb2, "color2" );
        colorLabel3 = new ColorLabel( hb2, "color3" );
        colorLabel4 = new ColorLabel( hb2, "color4" );
        colorLabel5 = new ColorLabel( hb2, "color5" );
        colorLabel0->setFixedHeight( LABEL_HEIGHT );
        colorLabel1->setFixedHeight( LABEL_HEIGHT );
        colorLabel2->setFixedHeight( LABEL_HEIGHT );
        colorLabel3->setFixedHeight( LABEL_HEIGHT );
        colorLabel4->setFixedHeight( LABEL_HEIGHT );
        colorLabel5->setFixedHeight( LABEL_HEIGHT );
        colorLabel0->setColor( 1.0, 1.0, 1.0);
        colorLabel1->setColor( 1.0, 1.0, 1.0);
        colorLabel2->setColor( 1.0, 1.0, 1.0);
        colorLabel3->setColor( 1.0, 1.0, 1.0);
        colorLabel4->setColor( 1.0, 1.0, 1.0);
        colorLabel5->setColor( 1.0, 1.0, 1.0);

        // Add a push button
        colorButton = new QPushButton( hb2, "colorButton" );
        colorButton->setText( "Set Color..." );

        // Define a callback for this button
        QObject::connect( colorButton, SIGNAL(clicked()), this, SLOT(setColorCb(
)) );

	// Create a hboxlayout that will fill the next row
	sizeBox = new SizeBox( this, "sizeBox" );

	// Create a hboxlayout that will fill the next row
	hb4 = new QHBox( this, "hb4" );
	
	// Add radiobuttons and a label
        modeL = new QLabel( hb4, "modeL" );
	modeL->setText( " Color Criterion: " ); 

	colorMode = new QButtonGroup( 3, QGroupBox::Horizontal, hb4, "colorMode" );
	colorMode0 = new QRadioButton( colorMode, "type" );
	colorMode0->setText( "Type" );
	colorMode1 = new QRadioButton( colorMode, "position" );
	colorMode1->setText( "Position" );
	colorMode2 = new QRadioButton( colorMode, "property" );
	colorMode2->setText( "Property" );
	colorMode3 = new QRadioButton( colorMode, "colorcode" );
	colorMode3->setText( "ColorCode" );
	colorMode->insert( colorMode0, 0 );
	colorMode->insert( colorMode1, 1 );
	colorMode->insert( colorMode2, 2 );
	colorMode->insert( colorMode3, 3 );

	// Define a callback for these radio buttons
	connect( colorMode, SIGNAL(clicked(int)), this, SLOT(adjustCriterion()) );

	// Create hboxlayouts that will fill the next row; these
	// are shown only when appropriate
	positionBox = new PositionBox( this, "positionBox" );
	propertyBox = new PropertyBox( this, "positionBox" );
	codeBox = new CodeBox( this, "codeBox" );
	typeColorNumberBox = new TypeColorNumberBox( this, "typeColorNumberBox", 2 );

	// Create a box that will fill the next row
	lineTypeBox = new LineTypeBox( this, "lineTypeBox" );
	
	// Create a hboxlayout that will fill the lowest row
	hb5 = new QHBox( this, "hb5" );
        
	// Create a placeholder 
	QLabel * emptyL1 = new QLabel( hb5, "emptyL1" );

	// Create pushbuttons that will go into the lowest row
	QPushButton * done = new QPushButton( hb5, "done" );
	done->setText( "Done" ); 

	 // Define a callback for that button
        QObject::connect( done, SIGNAL(clicked()), this, SLOT(bdone()) );

	QPushButton * apply = new QPushButton( hb5, "apply" );
	apply->setText( "Apply" ); 

	 // Define a callback for that button
        QObject::connect( apply, SIGNAL(clicked()), this, SLOT(bapply()) );

	QPushButton * cancel = new QPushButton( hb5, "cancel" );
	cancel->setText( "Cancel" ); 

	 // Define a callback for that button
        QObject::connect( cancel, SIGNAL(clicked()), this, SLOT(bcancel()) );

	hb5->setStretchFactor( emptyL1, 10 );

	// Clear the board pointer
	poreBox = NULL;

	// Clear the color board pointer
	cb = NULL;

	// Clear internal variables
        colors = 1;
        colorPosX = colorPosY = 0;
        showColorBoard = FALSE;
	poreRenderStyle = PLINE;
	renderQuality = LOW;

	// Set defaults appropriate for startup without data
	colorButton->setDisabled( TRUE );
	sizeBox->setDisabled( TRUE );
	modeL->setDisabled( TRUE );
	colorMode->setDisabled( TRUE );
	colorMode0->setChecked( TRUE );
	
	// Build default layout
	this->buildLayout( TYPE );
}
Example #2
0
// Make a popup dialog box 
FileListBoard::FileListBoard( QWidget * parent, const char * name )
    : QDialog( parent, name, FALSE, WType_TopLevel )
{
	this->setCaption( "AViz: File List Control" );

	// Insert a grid that will hold control buttons
	const int numCols = 5;
        const int numRows = 4;
        QGridLayout * fileListBox = new QGridLayout( this, numCols, numRows, SPACE, SPACE, "fileListBox" );

	// Create buttons
	QPushButton * singleStepPb = new QPushButton( this, "singleStep" );
	singleStepPb->setText( "SingleStep" );
	fileListBox->addWidget( singleStepPb, 0, 0);

	QPushButton * fastStepPb = new QPushButton( this, "fastStep" );
	fastStepPb->setText( "FastStep" );
	fileListBox->addWidget( fastStepPb, 0, 1);

	QPushButton * cyclePb = new QPushButton( this, "cycle" );
	cyclePb->setText( "Cycle" );
	cyclePb->setToggleButton( TRUE );
	fileListBox->addWidget( cyclePb, 0, 2);

	// Construct the cycle timer
	cycleTimer = new QTimer( this );

	// Define a callback for these pushbuttons
        connect( singleStepPb, SIGNAL(clicked()), SLOT(bsingleStep()) );
        connect( fastStepPb, SIGNAL(clicked()), SLOT(bfastStep()) );
        connect( cyclePb, SIGNAL(clicked()), SLOT(bcycle()) );

	// Create radio buttons to choose direction
	direction = new QButtonGroup( 2, QGroupBox::Horizontal, this, "direction" );
	fileListBox->addMultiCellWidget( direction, 0, 0, 3, 4 );
	forwardRb = new QRadioButton( direction, "forward" );
	forwardRb->setText( "Forward" );
	backwardRb = new QRadioButton( direction, "backward" );
	backwardRb->setText( "Backward" );

	// Define a callback for these radio buttons
        connect( direction, SIGNAL(clicked(int)), this, SLOT(bdirection(int)) );

	// Create pushbuttons to jump to start 
	QPushButton * startPb = new QPushButton( this, "start" );
	startPb->setText( "Jump To Start" );
	fileListBox->addWidget( startPb, 1, 0);

        // Define a callback for that button
	QObject::connect( startPb, SIGNAL(clicked()), this, SLOT(start()) );

	// Create pushbuttons to jump to end
	QPushButton * endPb = new QPushButton( this, "end" );
	endPb->setText( "Jump To End" );
	fileListBox->addWidget( endPb, 1, 1);

        // Define a callback for that button
	QObject::connect( endPb, SIGNAL(clicked()), this, SLOT(end()) );

	// Create a checkbox
	keepViewScaleCb = new QCheckBox( this, "keepViewScale" );
	fileListBox->addWidget( keepViewScaleCb, 1, 4);
	keepViewScaleCb->setText( "Keep ViewScale" );
	this->resetKeepViewScale();

        // Define a callback for that check box 
	QObject::connect( keepViewScaleCb, SIGNAL(clicked()), this, SLOT(keepViewScaleChanged()) );

	// Create a label
	QLabel * lineL = new QLabel( this, "lineL ");
	lineL->setText( " File List: " );
	fileListBox->addWidget( lineL, 2, 0 );

	// Create a text window
	fileLine = new QLineEdit( this, "fileLine" );
	fileLine->setText("--");
	fileLine->setReadOnly( TRUE );
	fileListBox->addMultiCellWidget( fileLine, 2, 2, 1, 4 );

	// Create a pushbutton
	QPushButton * tracksPb = new QPushButton( this, "tracks" );
	tracksPb->setText( "Tracks..." );
	fileListBox->addWidget( tracksPb, 3, 0);

        // Define a callback for that button
	QObject::connect( tracksPb, SIGNAL(clicked()), this, SLOT(launchTrack()) );

	// Create more pushbuttons that will go into the lowest row
	QPushButton * done = new QPushButton( this, "done" );
	fileListBox->addWidget( done, 3, 4);
	done->setText( "Done" ); 

	 // Define a callback for that button
        QObject::connect( done, SIGNAL(clicked()), this, SLOT(bdone()) );

	// Set defaults
	cycleMode = FALSE;
	thisDirection = FORWARD;
	forwardRb->setChecked (TRUE );	

	// Reset the pointers
	mainForm = NULL;

	// Set a flag
	haveFileList = FALSE;
}
Example #3
0
// Make a popup dialog box 
SpinBoard::SpinBoard(MainForm *mainForm, QWidget * parent)
    : QDialog(parent), mainForm(mainForm)
{
    setWindowTitle( "AViz: Set Spins" );

    {
        // Create a hboxlayout that will fill the first row
        hb1 = new QWidget(this);

        // Create a combo box that will go into the
        // second column; entries in the combo box will
        // be made later
        spinCob = new QComboBox();
        connect( spinCob, SIGNAL(activated(int)), SLOT(setSpin()) );

        // Add a check box button
        showSpinCb = new QCheckBox("Show Spins");
        showSpinCb->setChecked(true);

        // Define a callback for this toggle switch
        connect( showSpinCb, SIGNAL(clicked()), this, SLOT(adjustSpin()) );

        QHBoxLayout *hbox = new QHBoxLayout(hb1);
        hbox->addWidget(new QLabel(" Type: "));
        hbox->addWidget(spinCob);
        hbox->addStretch(1);
        hbox->addWidget(showSpinCb);
    }

    {
        // Create a hboxlayout that will fill the next row
        hb2 = new QWidget(this);

        // Add color labels
        colorLabel0 = new ColorLabel(hb2);
        colorLabel1 = new ColorLabel(hb2);
        colorLabel2 = new ColorLabel(hb2);
        colorLabel3 = new ColorLabel(hb2);
        colorLabel4 = new ColorLabel(hb2);
        colorLabel5 = new ColorLabel(hb2);
        colorLabel0->setFixedHeight( LABEL_HEIGHT );
        colorLabel1->setFixedHeight( LABEL_HEIGHT );
        colorLabel2->setFixedHeight( LABEL_HEIGHT );
        colorLabel3->setFixedHeight( LABEL_HEIGHT );
        colorLabel4->setFixedHeight( LABEL_HEIGHT );
        colorLabel5->setFixedHeight( LABEL_HEIGHT );

        // Add a push button
        colorButton = new QPushButton("Set Color...");

        // Define a callback for this button
        connect(colorButton, SIGNAL(clicked()), SLOT(setColorCb()));

        QHBoxLayout *hbox = new QHBoxLayout(hb2);
        hbox->setSpacing(0);
        hbox->addWidget(new QLabel(" Color: "));
        hbox->addWidget(colorLabel0);
        hbox->addWidget(colorLabel1);
        hbox->addWidget(colorLabel2);
        hbox->addWidget(colorLabel3);
        hbox->addWidget(colorLabel4);
        hbox->addWidget(colorLabel5);
        hbox->addWidget(colorButton);
    }


    // Create a hboxlayout that will fill the next row
    sizeBox = new SizeBox(this);

    {
        // Create a hboxlayout that will fill the next row
        hb4 = new QWidget(this);

        // Add radiobuttons and a label
        modeL = new QLabel(" Color Criterion: ");

        colorMode = new QGroupBox();
        QHBoxLayout *colorModeLayout = new QHBoxLayout(colorMode);

        colorMode0 = new QRadioButton("Type");
        colorMode1 = new QRadioButton("Position");
        colorMode2 = new QRadioButton("Property");
        colorMode3 = new QRadioButton("ColorCode");
        colorModeLayout->addWidget(colorMode0);
        colorModeLayout->addWidget(colorMode1);
        colorModeLayout->addWidget(colorMode2);
        colorModeLayout->addWidget(colorMode3);

        QButtonGroup *colorModeButtonGroup = new QButtonGroup(this);
        colorModeButtonGroup->addButton(colorMode0);
        colorModeButtonGroup->addButton(colorMode1);
        colorModeButtonGroup->addButton(colorMode2);
        colorModeButtonGroup->addButton(colorMode3);

        // Define a callback for these radio buttons
        connect(colorModeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(adjustCriterion()) );

        QHBoxLayout *hBox = new QHBoxLayout(hb4);
        hBox->addWidget(modeL);
        hBox->addWidget(colorMode);
    }

    // Create hboxlayouts that will fill the next row; these
    // are shown only when appropriate
    positionBox = new PositionBox(this);
    propertyBox = new PropertyBox(this);
    codeBox = new CodeBox(this);

    // Create a box that will fill the next row
    lineTypeBox = new LineTypeBox( this );

    {
        hb5 = new DoneApplyCancelWidget(this);
        connect(hb5, SIGNAL(done()), this, SLOT(bdone()) );
        connect(hb5, SIGNAL(applied()), this, SLOT(bapply()) );
        connect(hb5, SIGNAL(canceled()), this, SLOT(bcancel()));
    }

    // Clear the board pointer
    spinBox = NULL;

    // Clear the color board pointer
    cb = NULL;

    // Clear internal variables
    colors = 1;
    colorPosX = colorPosY = 0;
    showColorBoard = false;
    spinRenderStyle = SLINE;
    renderQuality = LOW;

    // Set defaults
    lineTypeBox->setDisabled(true);

    // Set defaults appropriate for startup without data
    colorButton->setDisabled(true);
    sizeBox->setDisabled(true);
    modeL->setDisabled(true);
    colorMode->setDisabled(true);
    colorMode0->setChecked(true);

    // Build default layout
    this->buildLayout( TYPE );
}