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

	--- Qt Architect generated file ---

	File: psOpt.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 "psOpt.h"

#define Inherited psOptData

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


psOpt::~psOpt()
{
}

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

  // get options and fill in GUI
  string mode = gnuInt->getTermPSmode();
  string color = gnuInt->getTermPScolor();
  string dashed = gnuInt->getTermPSdashed();
  string fontName = gnuInt->getTermPSfont();
  string fontSize = gnuInt->getTermPSfontSize();
  string enhanced = gnuInt->getTermPSenhanced();
  string hSize = gnuInt->getTermPShSize();
  string vSize = gnuInt->getTermPSvSize();

  if (mode == "landscape")
    modeList->setCurrentItem(0);
  else if (mode == "portrait")
    modeList->setCurrentItem(1);
  else if (mode == "eps")
    modeList->setCurrentItem(2);

  if (color == "monochrome")
    colorList->setCurrentItem(0);
  else if (color == "color")
    colorList->setCurrentItem(1);
  
  if (dashed == "dashed")
    dashedList->setCurrentItem(0);
  else if (dashed == "solid")
    dashedList->setCurrentItem(1);

  fontNameEdit->setText(fontName.c_str());
  fontSizeEdit->setText(fontSize.c_str());
  
  if (enhanced == "noenhanced")
    enhancedList->setCurrentItem(0);
  else if (enhanced == "enhanced")
    enhancedList->setCurrentItem(1);

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

void psOpt::setTerm()
{
  string mode = modeList->currentText().ascii();
  string color = colorList->currentText().ascii();
  string dashed = dashedList->currentText().ascii();
  string enhanced = enhancedList->currentText().ascii();
  string fontName = fontNameEdit->text().ascii();
  string fontSize = fontSizeEdit->text().ascii();
  string hSize = horizSize->text().ascii();
  string vSize = vertSize->text().ascii();

  gnuInt->setTermPSmode(mode);
  gnuInt->setTermPScolor(color);
  gnuInt->setTermPSdashed(dashed);
  gnuInt->setTermPSfont(fontName);
  gnuInt->setTermPSfontSize(fontSize);
  gnuInt->setTermPSenhanced(enhanced);
  gnuInt->setTermPShSize(hSize);
  gnuInt->setTermPSvSize(vSize);

  // close dialog for options
  QDialog::accept();
}


syntax highlighted by Code2HTML, v. 0.9.1