/**********************************************************************

	--- Qt Architect generated file ---

	File: pbmOp.cpp

    Xgfe: X Windows GUI front end to Gnuplot
    Copyright (C) 1998 David Ishee

    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
    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., 675 Mass Ave, Cambridge, MA 02139, USA.    

 *********************************************************************/

#include "pbmOp.h"

#define Inherited pbmOpData

pbmOp::pbmOp
(
	QWidget* parent,
	const char* name
)
	:
	Inherited( parent, name )
{
	setCaption( "PBM Options" );
}


pbmOp::~pbmOp()
{
}

void pbmOp::setGnuInterface(gnuInterface* gnu)
{
  gnuInt = gnu;  

  // get current options and fill in GUI
  string fontsize = gnuInt->getTermPBMFontSize();
  string colormode = gnuInt->getTermPBMColormode();
  string hSize = gnuInt->getTermPBMhSize();
  string vSize = gnuInt->getTermPBMvSize();

  if (fontsize == "small")
    fontSize->setCurrentItem(0);
  else if (fontsize == "medium")
    fontSize->setCurrentItem(1);
  else if (fontsize == "large")
    fontSize->setCurrentItem(2);

  if (colormode == "monochrome")
    colorMode->setCurrentItem(0);
  else if (colormode == "gray")
    colorMode->setCurrentItem(1);
  else if (colormode == "color")
    colorMode->setCurrentItem(2);

  horizSize->setText(hSize.c_str());
  vertSize->setText(vSize.c_str());
}

void pbmOp::setTerm()
{
  // get options
  string size = fontSize->currentText().ascii();
  string colormode = colorMode->currentText().ascii();
  string hSize = horizSize->text().ascii();
  string vSize = vertSize->text().ascii();

  gnuInt->setTermPBMFontSize(size);
  gnuInt->setTermPBMColormode(colormode);
  gnuInt->setTermPBMhSize(hSize);
  gnuInt->setTermPBMvSize(vSize);
  
  // close dialog for options
  QDialog::accept();
}



syntax highlighted by Code2HTML, v. 0.9.1