void ResourceLoader::init(const ResourceRequest& passedRequest)
{
    ASSERT(m_state != Terminated);
    ResourceRequest request(passedRequest);
    m_fetcher->willSendRequest(m_resource->identifier(), request, ResourceResponse(), m_options.initiatorInfo);
    ASSERT(m_state != Terminated);
    ASSERT(!request.isNull());
    m_originalRequest = m_request = applyOptions(request);
    m_resource->updateRequest(request);
    ASSERT(m_state != Terminated);
    m_fetcher->didInitializeResourceLoader(this);
}
Exemple #2
0
BufferedFile::BufferedFile(const char* fname, const char* mode, unsigned opts) :
	IDBDataFile( fname ),
	m_fp( 0 ),
	m_buffer( 0 )
{
	m_fp = fopen(fname, mode);
	if( m_fp == NULL )
	{
		throw std::runtime_error("unable to open Buffered file ");
	}

	applyOptions( opts );
}
void CVodesIntegrator::reinitialize(double t0, FuncEval& func)
{
    m_t0 = t0;
    m_time = t0;
    func.getState(NV_DATA_S(m_y));

    int result = CVodeReInit(m_cvode_mem, m_t0, m_y);
    if (result != CV_SUCCESS) {
        throw CanteraError("CVodesIntegrator::reinitialize",
                           "CVodeReInit failed. result = {}", result);
    }
    applyOptions();
}
void CVodesIntegrator::reinitialize(double t0, FuncEval& func)
{
    m_t0 = t0;
    m_time = t0;
    func.getInitialConditions(m_t0, static_cast<sd_size_t>(m_neq),
                              NV_DATA_S(m_y));

    int result;
    result = CVodeReInit(m_cvode_mem, m_t0, m_y);
    if (result != CV_SUCCESS) {
        throw CVodesErr("CVodeReInit failed. result = "+int2str(result));
    }
    applyOptions();
}
Exemple #5
0
KviThemedLabel::KviThemedLabel(QWidget * par, KviWindow * pWindow,const char * name)
: QLabel(par)
{
	setObjectName(name);
	m_pKviWindow = pWindow;

#if (QT_VERSION < 0x050000)
	setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
#else
	setMargin(4);
#endif
	setAutoFillBackground(false);
	applyOptions();
}
//==============================================================================
EdoChatWindowMessage::EdoChatWindowMessage (EdoChatWindow *_owner, const String &_messageText, const String &_messageAuthor, const bool _showTimestamp)
    : messageText(_messageText), messageAuthor(_messageAuthor), showTimestamp(_showTimestamp), owner(_owner),
      avatar (0),
      timestamp (0),
      uname (0),
      messageLabel (0)
{
    addAndMakeVisible (avatar = new ImageButton (T("new button")));
    avatar->addButtonListener (this);

    avatar->setImages (false, true, true,
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0),
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0),
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0));
    addAndMakeVisible (timestamp = new Label (T("new label"),
                                              T("14:42")));
    timestamp->setFont (Font (10.0000f, Font::plain));
    timestamp->setJustificationType (Justification::centred);
    timestamp->setEditable (false, false, false);
    timestamp->setColour (TextEditor::textColourId, Colours::black);
    timestamp->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (uname = new Label (T("new label"),
                                          T("Colets")));
    uname->setFont (Font (10.0000f, Font::bold));
    uname->setJustificationType (Justification::centred);
    uname->setEditable (false, false, false);
    uname->setColour (TextEditor::textColourId, Colours::black);
    uname->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (messageLabel = new Label (T("new label"),
                                                 String::empty));
    messageLabel->setFont (Font (12.0000f, Font::plain));
    messageLabel->setJustificationType (Justification::centred);
    messageLabel->setEditable (true, true, true);
    messageLabel->setColour (TextEditor::textColourId, Colours::black);
    messageLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));
    messageLabel->addListener (this);


    //[UserPreSize]
	applyOptions();
    //[/UserPreSize]

    setSize (1, 1);

    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}
bool MainWidget::initOptionsWidget()
{
    if (!this->optionsWidget && this->serial) {
        this->optionsWidget = new OptionsWidget(this->serial->listBaudRate(),
                                                this->serial->listDataBits(),
                                                this->serial->listParity(),
                                                this->serial->listStopBits(),
                                                this->serial->listFlowControl());
        if (!this->optionsWidget)
            return false;

        connect(this, SIGNAL(optionsApplied(bool,QStringList)),
                this->optionsWidget, SLOT(procAppliedOptions(bool,QStringList)));
        connect(this->optionsWidget, SIGNAL(applyOptions(QStringList)),
                this, SLOT(procApplyOptions(QStringList)));
    }
KviThemedLineEdit::KviThemedLineEdit(QWidget * par, KviWindow * pWindow, const char * name)
    : QLineEdit(par)
{
	setObjectName(name);
	m_pKviWindow = pWindow;

	setFrame(false);

	int l, t, r, b;
	getTextMargins(&l, &t, &r, &b);
	if(l < 4)
		l = 4;
	if(r < 4)
		r = 4;
	setTextMargins(l, t, r, b);

	setAutoFillBackground(false);
	applyOptions();
}
const int EdoChatWindowMessage::getMessageHeight(const int parentWidth, const Justification justification)
{
	GlyphArrangement messageGlyphs;
	float top,left,right,bottom;

	applyOptions();
	messageGlyphs.clear();

	messageGlyphs.addJustifiedText (
										EdoRestoreFont (getPropertyString(EWND_MESSAGE_FONT), Font(14)), 
										messageLabel->getText(), 
										0, 
										0, 
										(float)parentWidth, 
										justification
									);

	messageGlyphs.getBoundingBox (0, -1, left, top, right, bottom, true);

	messageHeight = roundFloatToInt ((bottom - top) + SPACER);

	// Log (String::formatted (T("EdoChatWindowMessage::getMessageHeight parentWidth: %d height: %d"), parentWidth, messageHeight));

	if (avatar->isVisible())
	{
		if (messageHeight < (avatar->getHeight()+16))
		{
			messageHeight = avatar->getHeight()+16;
			return (messageHeight+SPACER);
		}
		else
		{
			return (messageHeight+SPACER);
		}
	}
	else
	{
		return (messageHeight+SPACER);
	}
}
//==============================================================================
EdoChatWindowMessage::EdoChatWindowMessage (MessageType _messageType, EdoChatWindow *_owner, const String &_messageText, const String &_messageAuthor, const bool _showTimestamp)
    : messageText(_messageText), messageAuthor(_messageAuthor), owner(_owner), messageType(_messageType),
      avatar (0),
      messageLabel (0)
{
    addAndMakeVisible (avatar = new ImageButton (T("new button")));
    avatar->addButtonListener (this);

    avatar->setImages (false, true, true,
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0),
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0),
                       ImageCache::getFromMemory (contact_png, contact_pngSize), 1.0000f, Colour (0x0));
    addAndMakeVisible (messageLabel = new EdoTextEditor());
    messageLabel->setName (T("new component"));


    //[UserPreSize]
	messageLabel->setColour (TextEditor::backgroundColourId, Colour(0x0));
	messageLabel->setColour (TextEditor::textColourId, Colours::white);
	messageLabel->setColour (TextEditor::highlightedTextColourId, Colours::white);
	messageLabel->setColour (TextEditor::outlineColourId, Colour(0x0));
	messageLabel->setColour (TextEditor::shadowColourId, Colour(0x0));
	messageLabel->setScrollbarsShown (false);
	messageLabel->setScrollBarButtonVisibility (false);
	messageLabel->setReadOnly (true);
	messageLabel->setMultiLine (true);

	timeStamp = Time::getCurrentTime().toString (false, true, true, true);
	messageHeight = 48;
    //[/UserPreSize]

    setSize (512, 48);

    //[Constructor] You can add your own custom stuff here..
	applyOptions();
    //[/Constructor]
}
Exemple #11
0
/*
 * Create a link
 */
static asynStatus
connectIt(void *drvPvt, asynUser *pasynUser)
{
    ttyController_t *tty = (ttyController_t *)drvPvt;

    /*
     * Sanity check
     */
    assert(tty);
    if (tty->fd >= 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                              "%s: Link already open!", tty->serialDeviceName);
        return asynError;
    }
    asynPrint(pasynUser, ASYN_TRACE_FLOW,
                              "Open connection to %s\n", tty->serialDeviceName);

    /*
     * Open serial line and set configuration
     * Must open in non-blocking mode in case carrier detect is not
     * present and we plan to use the line in CLOCAL mode.
     */
    if ((tty->fd = open(tty->serialDeviceName, O_RDWR|O_NOCTTY|O_NONBLOCK, 0)) < 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                            "%s Can't open  %s",
                                    tty->serialDeviceName, strerror(errno));
        return asynError;
    }
#if defined(FD_CLOEXEC) && !defined(vxWorks)
    if (fcntl(tty->fd, F_SETFD, FD_CLOEXEC) < 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                            "Can't set %s close-on-exec flag: %s",
                                    tty->serialDeviceName, strerror(errno));
        close(tty->fd);
        tty->fd = -1;
        return asynError;
    }
#endif
    applyOptions(pasynUser, tty);
   
    /*
     * Turn off non-blocking mode
     */
#ifndef vxWorks
    tcflush(tty->fd, TCIOFLUSH);
    tty->readTimeout = -1e-99;
    tty->writeTimeout = -1e-99;
    if (fcntl(tty->fd, F_SETFL, 0) < 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                            "Can't set %s file flags: %s",
                                    tty->serialDeviceName, strerror(errno));
        close(tty->fd);
        tty->fd = -1;
        return asynError;
    }
#endif

    asynPrint(pasynUser, ASYN_TRACE_FLOW,
                          "Opened connection to %s\n", tty->serialDeviceName);
    pasynManager->exceptionConnect(pasynUser);
    return asynSuccess;
}
Exemple #12
0
static asynStatus
setOption(void *drvPvt, asynUser *pasynUser, const char *key, const char *val)
{
    ttyController_t *tty = (ttyController_t *)drvPvt;
    struct termios termiosPrev;
    int baudPrev;

    assert(tty);
    asynPrint(pasynUser, ASYN_TRACE_FLOW,
                    "%s setOption key %s val %s\n", tty->portName, key, val);
    
    /* Make a copy of tty->termios and tty->baud so we can restore them in case of errors */                
    termiosPrev = tty->termios;
    baudPrev = tty->baud;

    if (epicsStrCaseCmp(key, "baud") == 0) {
        int baud;
        if(sscanf(val, "%d", &baud) != 1) {
            epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                                                                "Bad number");
            return asynError;
        }
#ifndef vxWorks         
        {
        speed_t baudCode;
/* On this system is the baud code the actual baud rate?  
 * If so use it directly, else compare against known baud codes */
#if (defined(B300) && (B300 == 300) && defined(B9600) && (B9600 == 9600))
        baudCode = baud;
#else
        switch(baud) {
            case 50:     baudCode = B50 ;     break;
            case 75:     baudCode = B75 ;     break;
            case 110:    baudCode = B110 ;    break;
            case 134:    baudCode = B134 ;    break;
            case 150:    baudCode = B150 ;    break;
            case 200:    baudCode = B200 ;    break;
            case 300:    baudCode = B300 ;    break;
            case 600:    baudCode = B600 ;    break;
            case 1200:   baudCode = B1200 ;   break;
            case 1800:   baudCode = B1800 ;   break;
            case 2400:   baudCode = B2400 ;   break;
            case 4800:   baudCode = B4800 ;   break;
            case 9600:   baudCode = B9600 ;   break;
            case 19200:  baudCode = B19200 ;  break;
#ifdef B28800
            case 28800:  baudCode = B28800 ;  break;
#endif
            case 38400:  baudCode = B38400 ;  break;
#ifdef B57600
            case 57600:  baudCode = B57600 ;  break;
#endif
#ifdef B115200
            case 115200: baudCode = B115200 ; break;
#endif
#ifdef B230400
            case 230400: baudCode = B230400 ; break;
#endif
#ifdef B460800
            case 460800: baudCode = B460800 ; break;
#endif
#ifdef B500000
            case 500000: baudCode = B500000 ; break;
#endif
#ifdef B576000
            case 576000: baudCode = B576000 ; break;
#endif
#ifdef B921600
            case 921600: baudCode = B921600 ; break;
#endif
#ifdef B1000000
            case 1000000: baudCode = B1000000 ; break;
#endif
#ifdef B1152000
            case 1152000: baudCode = B1152000 ; break;
#endif
#ifdef B1500000
            case 1500000: baudCode = B1500000 ; break;
#endif
#ifdef B2000000
            case 2000000: baudCode = B2000000 ; break;
#endif
#ifdef B2500000
            case 2500000: baudCode = B2500000 ; break;
#endif
#ifdef B3000000
            case 3000000: baudCode = B3000000 ; break;
#endif
#ifdef B3500000
            case 3500000: baudCode = B3500000 ; break;
#endif
#ifdef B4000000
            case 4000000: baudCode = B4000000 ; break;
#endif
            default:
                epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                                      "Unsupported data rate (%d baud)", baud);
                return asynError;
        }
#endif /* Baudcode is baud */
        if(cfsetispeed(&tty->termios,baudCode) < 0 ) {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                "cfsetispeed returned %s",strerror(errno));
            return asynError;
        }
        if(cfsetospeed(&tty->termios,baudCode) < 0 ) {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                "cfsetospeed returned %s",strerror(errno));
            return asynError;
        }
        }
#endif /* vxWorks */
        tty->baud = baud;
    }
    else if (epicsStrCaseCmp(key, "bits") == 0) {
        if (epicsStrCaseCmp(val, "5") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS5;
        }
        else if (epicsStrCaseCmp(val, "6") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS6;
        }
        else if (epicsStrCaseCmp(val, "7") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS7;
        }
        else if (epicsStrCaseCmp(val, "8") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS8;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid number of bits.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "parity") == 0) {
        if (epicsStrCaseCmp(val, "none") == 0) {
            tty->termios.c_cflag &= ~PARENB;
        }
        else if (epicsStrCaseCmp(val, "even") == 0) {
            tty->termios.c_cflag |= PARENB;
            tty->termios.c_cflag &= ~PARODD;
        }
        else if (epicsStrCaseCmp(val, "odd") == 0) {
            tty->termios.c_cflag |= PARENB;
            tty->termios.c_cflag |= PARODD;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                            "Invalid parity.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "stop") == 0) {
        if (epicsStrCaseCmp(val, "1") == 0) {
            tty->termios.c_cflag &= ~CSTOPB;
        }
        else if (epicsStrCaseCmp(val, "2") == 0) {
            tty->termios.c_cflag |= CSTOPB;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                "Invalid number of stop bits.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "clocal") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_cflag |= CLOCAL;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_cflag &= ~CLOCAL;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid clocal value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "crtscts") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
/* vxWorks uses CLOCAL when it should use CRTSCTS */
#ifdef vxWorks
            tty->termios.c_cflag &= ~CLOCAL;
#else
            tty->termios.c_cflag |= CRTSCTS;
#endif
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
#ifdef vxWorks
            tty->termios.c_cflag |= CLOCAL;
#else
            tty->termios.c_cflag &= ~CRTSCTS;
#endif
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                      "Invalid crtscts value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "ixon") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
#ifdef vxWorks
            ioctl(tty->fd, FIOSETOPTIONS, ioctl(tty->fd, FIOGETOPTIONS, 0) | OPT_TANDEM);
            return asynSuccess;
#else
            tty->termios.c_iflag |= IXON;
#endif
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
#ifdef vxWorks
            ioctl(tty->fd, FIOSETOPTIONS, ioctl(tty->fd, FIOGETOPTIONS, 0) & ~OPT_TANDEM);
            return asynSuccess;
#else
            tty->termios.c_iflag &= ~IXON;
#endif
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixon value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "ixany") == 0) {
#ifdef vxWorks
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Option ixany not supported on vxWorks");
            return asynError;       
#else
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_iflag |= IXANY;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_iflag &= ~IXANY;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixany value.");
            return asynError;
        }
#endif
    }
    else if (epicsStrCaseCmp(key, "ixoff") == 0) {
#ifdef vxWorks
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Option ixoff not supported on vxWorks");
            return asynError;       
#else
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_iflag |= IXOFF;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_iflag &= ~IXOFF;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixoff value.");
            return asynError;
        }
#endif
    }
    else if (epicsStrCaseCmp(key, "") != 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                "Unsupported key \"%s\"", key);
        return asynError;
    }
    if (tty->fd >= 0) {
        if (applyOptions(pasynUser, tty) != asynSuccess) {
            /* Restore previous values of tty->baud and tty->termios */
            tty->baud = baudPrev;
            tty->termios = termiosPrev;
            return asynError;
        }
    }
    return asynSuccess;
}
Exemple #13
0
bool
QA::init(void)
{
   // Open the qa-result.nc file, when available or create
   // it from scratch. Meta data checks are performed.
   // Initialisation of time and time boundary testing.
   // Eventually, entry() is called to test the data of fields.

   notes->init();  // safe

   qaExp.setParent(this);
   qaTime.setParent(this);

   // default for the qaFile
   setFilename( pIn->file );

   // apply parsed command-line args
   applyOptions();

   std::string vName(qaExp.getVarnameFromFilename());

   if(isRequiredVariable)
     pIn->pullMetaData('V', vName);

   if(isRequiredTime && !isRequiredVariable)
     pIn->pullMetaData('T');

   if(isRequiredGlobal)
     pIn->pullMetaData('G');

   initCheckStatus();

   // check for CF Convention.
   if(isCheckCF)
   {
     cF->setDataVarName(vName);
     cF->setFilename(pIn->file);
     (void) cF->run();
   }

   // exclude user-defined data variables from any checking
   pIn->excludeVars();

   qaTime.init(optStr);
   qaExp.init(optStr);

   // DRS specifications
   if(isCheckDRS_F || isCheckDRS_P)
   {
     drs_cv_table.setParent(this);
     drs_cv_table.setPath(tablePath);
     drs_cv_table.applyOptions(optStr);
     drs_cv_table.read();
   }

   // experiment specific obj: set parent, pass over options
   // check consistency between sub-sequent files or experiments
   if(isCheckCNSTY && (fileSequenceState == 's' || fileSequenceState == 'x') )
   {
      // return true for a) no previous check available,
      //                 b) deviation from a privous check are found
      if( checkConsistency(*pIn, optStr, tablePath) )
        qaExp.run();
   }
   else
     qaExp.run();

   // check existence of any data at all
   if( pIn->ncRecBeg == 0 && pIn->ncRecEnd == 0 )
   {
      isCheckData=false;

      std::string key("6_15");
      if( notes->inq( key, fileStr) )
      {
        std::string capt("No records in the file") ;

        if( notes->operate(capt) )
        {
          notes->setCheckStatus(n_data,  n_fail );
          setExitState( notes->getExitState() ) ;
        }
      }
   }

   if( isCheckData )
   {
     if( !checkDataBody() )
     {
       isCheckData = false;
       notes->setCheckStatus(n_data, n_fail);
       setExitState(2);
//       return true;
     }
   }

   if(isCheckTimeValues && !qaTime.isTime)
      notes->setCheckStatus(n_time, "FIXED");

   if(isCheckTimeValues)
   {
      if( qaTime.isTime)
      {
         if( !checkDataBody(qaTime.name) )
         {
           // time is defined, but there is no data
           qaTime.isTime = false;
           notes->setCheckStatus(n_time, n_fail);
           setExitState(2);
         }
      }
   }

   if(isCheckData || isCheckTimeValues)
   {
     notes->setConstraintFreq( qaExp.getFrequency() );

     // enable detection of outlier and replicated records
     setProcessing();

     // open netCDF for creating, continuation or resuming qa_<varname>.nc.
     // note that this must happen before checkMetaData which uses currQARec
     openQA_Nc(*pIn);

     if( isExit() || qaExp.isUseStrict || qaTime.isNoProgress )
     {
       isCheckData=false;
       return true;
     }

   }


   if( isCheckData || isCheckTimeValues )
   {
     // set pointer to function for operating tests
//     execPtr = &IObj::entry ;
     (void) entry();
   }

   return true;  // only meta-data check
}
Exemple #14
0
void PTXOptimizer::optimize()
{		
	report("Running PTX to PTX Optimizer.");
	
	report(" Loading module '" << input << "'");
	ir::Module module( input );

	transforms::PassManager manager( &module );

	if( registerAllocationType != "none" &&
		!registerAllocationType.empty() )
	{
		transforms::Pass* pass =
			transforms::PassFactory::createPass( registerAllocationType );
		
		applyOptions( pass );
		
		manager.addPass( *pass );
	}

	for( auto name = passes.begin(); name != passes.end(); ++name )
	{
		if( name->empty() ) continue;
		
		transforms::Pass* pass =
			transforms::PassFactory::createPass( *name );
		
		applyOptions( pass );
		
		manager.addPass( *pass );
	}
	
	if( input.empty() )
	{
		std::cout << "No input file name given.  Bailing out." << std::endl;
		return;
	}

	manager.runOnModule();
	manager.destroyPasses();
	
	std::ofstream out( output.c_str() );
	
	if( !out.is_open() )
	{
		throw hydrazine::Exception( "Could not open output file " 
			+ output + " for writing." );
	}
	
	module.writeIR( out, ir::PTXEmitter::Target_NVIDIA_PTX30 );

	if(!cfg) return;
	
	for( ir::Module::KernelMap::const_iterator 
		kernel = module.kernels().begin(); 
		kernel != module.kernels().end(); ++kernel )
	{
		report(" Writing CFG for kernel '" << kernel->first << "'");
		std::ofstream out( std::string( 
			kernel->first + "_cfg.dot" ).c_str() );
	
		if( !out.is_open() )
		{
			throw hydrazine::Exception( "Could not open output file " 
				+ output + " for writing." );
		}
	
		module.getKernel( kernel->first )->cfg()->write( out );
	}
}
Exemple #15
0
void GtkFileDialog::setFilter() {
    applyOptions();
}
void CVodesIntegrator::initialize(double t0, FuncEval& func)
{
    m_neq = func.neq();
    m_t0 = t0;
    m_time = t0;

    if (m_y) {
        N_VDestroy_Serial(m_y); // free solution vector if already allocated
    }
    m_y = N_VNew_Serial(static_cast<sd_size_t>(m_neq)); // allocate solution vector
    for (size_t i = 0; i < m_neq; i++) {
        NV_Ith_S(m_y, i) = 0.0;
    }
    // check abs tolerance array size
    if (m_itol == CV_SV && m_nabs < m_neq) {
        throw CVodesErr("not enough absolute tolerance values specified.");
    }

    func.getInitialConditions(m_t0, m_neq, NV_DATA_S(m_y));

    if (m_cvode_mem) {
        CVodeFree(&m_cvode_mem);
    }

    /*
     *  Specify the method and the iteration type:
     *      Cantera Defaults:
     *         CV_BDF  - Use BDF methods
     *         CV_NEWTON - use Newton's method
     */
    m_cvode_mem = CVodeCreate(m_method, m_iter);
    if (!m_cvode_mem) {
        throw CVodesErr("CVodeCreate failed.");
    }

    int flag = CVodeInit(m_cvode_mem, cvodes_rhs, m_t0, m_y);
    if (flag != CV_SUCCESS) {
        if (flag == CV_MEM_FAIL) {
            throw CVodesErr("Memory allocation failed.");
        } else if (flag == CV_ILL_INPUT) {
            throw CVodesErr("Illegal value for CVodeInit input argument.");
        } else {
            throw CVodesErr("CVodeInit failed.");
        }
    }
    CVodeSetErrHandlerFn(m_cvode_mem, &cvodes_err, this);

    if (m_itol == CV_SV) {
        flag = CVodeSVtolerances(m_cvode_mem, m_reltol, m_abstol);
    } else {
        flag = CVodeSStolerances(m_cvode_mem, m_reltol, m_abstols);
    }
    if (flag != CV_SUCCESS) {
        if (flag == CV_MEM_FAIL) {
            throw CVodesErr("Memory allocation failed.");
        } else if (flag == CV_ILL_INPUT) {
            throw CVodesErr("Illegal value for CVodeInit input argument.");
        } else {
            throw CVodesErr("CVodeInit failed.");
        }
    }

    // pass a pointer to func in m_data
    m_fdata.reset(new FuncData(&func, func.nparams()));

    flag = CVodeSetUserData(m_cvode_mem, m_fdata.get());
    if (flag != CV_SUCCESS) {
        throw CVodesErr("CVodeSetUserData failed.");
    }
    if (func.nparams() > 0) {
        sensInit(t0, func);
        flag = CVodeSetSensParams(m_cvode_mem, m_fdata->m_pars.data(),
                                  NULL, NULL);
    }
    applyOptions();
}
static asynStatus
setOption(void *drvPvt, asynUser *pasynUser, const char *key, const char *val)
{
    ttyController_t *tty = (ttyController_t *)drvPvt;

    assert(tty);
    asynPrint(pasynUser, ASYN_TRACE_FLOW,
                    "%s setOption key %s val %s\n", tty->portName, key, val);
    if (epicsStrCaseCmp(key, "baud") == 0) {
        int baud;
        if(sscanf(val, "%d", &baud) != 1) {
            epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                                                                "Bad number");
            return asynError;
        }
#ifndef vxWorks
        {
        speed_t baudCode;
        switch(baud) {
            case 50:     baudCode = B50 ;     break;
            case 75:     baudCode = B75 ;     break;
            case 110:    baudCode = B110 ;    break;
            case 134:    baudCode = B134 ;    break;
            case 150:    baudCode = B150 ;    break;
            case 200:    baudCode = B200 ;    break;
            case 300:    baudCode = B300 ;    break;
            case 600:    baudCode = B600 ;    break;
            case 1200:   baudCode = B1200 ;   break;
            case 1800:   baudCode = B1800 ;   break;
            case 2400:   baudCode = B2400 ;   break;
            case 4800:   baudCode = B4800 ;   break;
            case 9600:   baudCode = B9600 ;   break;
            case 19200:  baudCode = B19200 ;  break;
#ifdef B28800
            case 28800:  baudCode = B28800 ;  break;
#endif
            case 38400:  baudCode = B38400 ;  break;
            case 57600:  baudCode = B57600 ;  break;
            case 115200: baudCode = B115200 ; break;
            case 230400: baudCode = B230400 ; break;
            default:
                epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
                                      "Unsupported data rate (%d baud)", baud);
                return asynError;
        }
        if(cfsetispeed(&tty->termios,baudCode) < 0 ) {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                "cfsetispeed returned %s\n",strerror(errno));
            return asynError;
        }
        if(cfsetospeed(&tty->termios,baudCode) < 0 ) {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                "cfsetospeed returned %s\n",strerror(errno));
            return asynError;
        }
        }
#endif
        tty->baud = baud;
    }
    else if (epicsStrCaseCmp(key, "bits") == 0) {
        if (epicsStrCaseCmp(val, "5") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS5;
        }
        else if (epicsStrCaseCmp(val, "6") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS6;
        }
        else if (epicsStrCaseCmp(val, "7") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS7;
        }
        else if (epicsStrCaseCmp(val, "8") == 0) {
            tty->termios.c_cflag = (tty->termios.c_cflag & ~CSIZE) | CS8;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid number of bits.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "parity") == 0) {
        if (epicsStrCaseCmp(val, "none") == 0) {
            tty->termios.c_cflag &= ~PARENB;
        }
        else if (epicsStrCaseCmp(val, "even") == 0) {
            tty->termios.c_cflag |= PARENB;
            tty->termios.c_cflag &= ~PARODD;
        }
        else if (epicsStrCaseCmp(val, "odd") == 0) {
            tty->termios.c_cflag |= PARENB;
            tty->termios.c_cflag |= PARODD;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                            "Invalid parity.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "stop") == 0) {
        if (epicsStrCaseCmp(val, "1") == 0) {
            tty->termios.c_cflag &= ~CSTOPB;
        }
        else if (epicsStrCaseCmp(val, "2") == 0) {
            tty->termios.c_cflag |= CSTOPB;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                "Invalid number of stop bits.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "clocal") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_cflag |= CLOCAL;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_cflag &= ~CLOCAL;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid clocal value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "crtscts") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
/* vxWorks uses CLOCAL when it should use CRTSCTS */
#ifdef vxWorks
            tty->termios.c_cflag &= ~CLOCAL;
#else
            tty->termios.c_cflag |= CRTSCTS;
#endif
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
#ifdef vxWorks
            tty->termios.c_cflag |= CLOCAL;
#else
            tty->termios.c_cflag &= ~CRTSCTS;
#endif
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                      "Invalid crtscts value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "ixon") == 0) {
        if (epicsStrCaseCmp(val, "Y") == 0) {
#ifdef vxWorks
            ioctl(tty->fd, FIOSETOPTIONS, ioctl(tty->fd, FIOGETOPTIONS, 0) | OPT_TANDEM);
            return asynSuccess;
#else
            tty->termios.c_iflag |= IXON;
#endif
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
#ifdef vxWorks
            ioctl(tty->fd, FIOSETOPTIONS, ioctl(tty->fd, FIOGETOPTIONS, 0) & ~OPT_TANDEM);
            return asynSuccess;
#else
            tty->termios.c_iflag &= ~IXON;
#endif
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixon value.");
            return asynError;
        }
    }
    else if (epicsStrCaseCmp(key, "ixany") == 0) {
#ifdef vxWorks
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Option ixany not supported on vxWorks");
            return asynError;       
#else
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_iflag |= IXANY;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_iflag &= ~IXANY;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixany value.");
            return asynError;
        }
#endif
    }
    else if (epicsStrCaseCmp(key, "ixoff") == 0) {
#ifdef vxWorks
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Option ixoff not supported on vxWorks");
            return asynError;       
#else
        if (epicsStrCaseCmp(val, "Y") == 0) {
            tty->termios.c_iflag |= IXOFF;
        }
        else if (epicsStrCaseCmp(val, "N") == 0) {
            tty->termios.c_iflag &= ~IXOFF;
        }
        else {
            epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                    "Invalid ixoff value.");
            return asynError;
        }
#endif
    }
    else if (epicsStrCaseCmp(key, "") != 0) {
        epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize,
                                                "Unsupported key \"%s\"", key);
        return asynError;
    }
    if (tty->fd >= 0)
        return applyOptions(pasynUser, tty);
    return asynSuccess;
}
	BOOL handleMessages( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
	{
		int index = 0;
		std::string mod;

		int modIndex = modSelector.getActiveIndex();
		int menuId = game::SimpleOptions::getInt(DH_OPT_I_MENU_LANGUAGE);
		int speechId = game::SimpleOptions::getInt(DH_OPT_I_SPEECH_LANGUAGE);
		int subtitleId = game::SimpleOptions::getInt(DH_OPT_I_SUBTITLE_LANGUAGE);
		std::string modDir;
		std::string parameters;

		switch( msg )
		{
		case WM_INITDIALOG:
			SetFocus( GetDlgItem( hwnd, IDOK ) );
			break; 

		case WM_COMMAND:
		{	
			int command = LOWORD(wParam);
						
			switch( command )
			{
			case IDOK:
				applyOptions( hwnd );
				GameOptionManager::getInstance()->save();
				PostQuitMessage( 0 );

				modSelector.restoreDir();

				//int modIndex = modSelector.getActiveIndex();
				if(modIndex >= 0)
				{
					//int menuId = game::SimpleOptions::getInt(DH_OPT_I_MENU_LANGUAGE);
					//int speechId = game::SimpleOptions::getInt(DH_OPT_I_SPEECH_LANGUAGE);
					//int subtitleId = game::SimpleOptions::getInt(DH_OPT_I_SUBTITLE_LANGUAGE);
					modDir = modSelector.getModDir(modIndex);

					parameters += "-mod=" + modDir;
					parameters += " -menu_language=" + boost::lexical_cast<std::string> (menuId);
					parameters += " -speech_language=" + boost::lexical_cast<std::string> (speechId);
					parameters += " -subtitle_language=" + boost::lexical_cast<std::string> (subtitleId);

					//MessageBox(0, command.c_str(), "Shit happens", MB_OK);
					ShellExecute( 0, 0, "claw_proto.exe", parameters.c_str(), 0, SW_NORMAL );
				}
				else
				{
					ShellExecute( 0, 0, "claw_proto.exe", 0, 0, SW_NORMAL );
				}

				// manager.save();
				break;

			case IDCHECKUPDATES:
				//applyOptions( hwnd );
				//GameOptionManager::getInstance()->save();
				//ShellExecute( 0, 0, "Updater.exe", 0, 0, SW_NORMAL );
				//system("start Updater.exe");
				modSelector.restoreDir();
				hiddencommand("Updater\\start_updater.bat", false);
				PostQuitMessage( 0 );
				// manager.save();
				break;

			case IDC_ACTIVATEMOD:
				index = SendMessage( GetDlgItem( hwnd, IDC_COMBOMODSELECTION ), CB_GETCURSEL, 0, 0);
				modSelector.saveActiveModFile(index - 1);

				modSelector.restoreDir();

				if(fileExists("Shadowgrounds Launcher.exe"))
					ShellExecute( 0, 0, "Shadowgrounds Launcher.exe", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "ShadowgroundsLauncher.exe", 0, 0, SW_NORMAL );

				PostQuitMessage( 0 );
				break;

			case IDC_EDITOR_MANUAL:
				modSelector.restoreDir();

				if(fileExists("Editor Manual.rtf"))
					ShellExecute( 0, 0, "Editor Manual.rtf", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "EditorManual.rtf", 0, 0, SW_NORMAL );


				modSelector.changeDir();
				break;

			case IDC_EDITOR_LAUNCH:
				modSelector.restoreDir();
#ifdef STEAM_HAX
				ShellExecute( 0, 0, "steam://run/2505", 0, 0, SW_NORMAL );
#else
				if(fileExists("Shadowgrounds Editor.exe"))
					ShellExecute( 0, 0, "Shadowgrounds Editor.exe", 0, 0, SW_NORMAL );
				else
					ShellExecute( 0, 0, "ShadowgroundsEditor.exe", 0, 0, SW_NORMAL );
#endif
				PostQuitMessage( 0 );
				break;

			case IDCANCEL:
				PostQuitMessage( 0 );
				break;

			case IDC_BUTTONADVANCED:
				applyOptions( hwnd );
				lwindow->openAdvanced();

				break;
			}

			break;
		}

		case WM_SHOWWINDOW:
			manager.load();
			initDialog( hwnd );	
			break;

		};


		return 0;
	}
void CVodesIntegrator::initialize(double t0, FuncEval& func)
{
    m_neq = func.neq();
    m_t0 = t0;
    m_time = t0;

    if (m_y) {
        N_VDestroy_Serial(m_y); // free solution vector if already allocated
    }
    m_y = N_VNew_Serial(static_cast<sd_size_t>(m_neq)); // allocate solution vector
    N_VConst(0.0, m_y);
    // check abs tolerance array size
    if (m_itol == CV_SV && m_nabs < m_neq) {
        throw CanteraError("CVodesIntegrator::initialize",
                           "not enough absolute tolerance values specified.");
    }

    func.getState(NV_DATA_S(m_y));

    if (m_cvode_mem) {
        CVodeFree(&m_cvode_mem);
    }

    //! Specify the method and the iteration type. Cantera Defaults:
    //!        CV_BDF  - Use BDF methods
    //!        CV_NEWTON - use Newton's method
    m_cvode_mem = CVodeCreate(m_method, m_iter);
    if (!m_cvode_mem) {
        throw CanteraError("CVodesIntegrator::initialize",
                           "CVodeCreate failed.");
    }

    int flag = CVodeInit(m_cvode_mem, cvodes_rhs, m_t0, m_y);
    if (flag != CV_SUCCESS) {
        if (flag == CV_MEM_FAIL) {
            throw CanteraError("CVodesIntegrator::initialize",
                               "Memory allocation failed.");
        } else if (flag == CV_ILL_INPUT) {
            throw CanteraError("CVodesIntegrator::initialize",
                               "Illegal value for CVodeInit input argument.");
        } else {
            throw CanteraError("CVodesIntegrator::initialize",
                               "CVodeInit failed.");
        }
    }
    CVodeSetErrHandlerFn(m_cvode_mem, &cvodes_err, this);

    if (m_itol == CV_SV) {
        flag = CVodeSVtolerances(m_cvode_mem, m_reltol, m_abstol);
    } else {
        flag = CVodeSStolerances(m_cvode_mem, m_reltol, m_abstols);
    }
    if (flag != CV_SUCCESS) {
        if (flag == CV_MEM_FAIL) {
            throw CanteraError("CVodesIntegrator::initialize",
                               "Memory allocation failed.");
        } else if (flag == CV_ILL_INPUT) {
            throw CanteraError("CVodesIntegrator::initialize",
                               "Illegal value for CVodeInit input argument.");
        } else {
            throw CanteraError("CVodesIntegrator::initialize",
                               "CVodeInit failed.");
        }
    }

    flag = CVodeSetUserData(m_cvode_mem, &func);
    if (flag != CV_SUCCESS) {
        throw CanteraError("CVodesIntegrator::initialize",
                           "CVodeSetUserData failed.");
    }
    if (func.nparams() > 0) {
        sensInit(t0, func);
        flag = CVodeSetSensParams(m_cvode_mem, func.m_sens_params.data(),
                                  func.m_paramScales.data(), NULL);
        if (flag != CV_SUCCESS) {
            throw CanteraError("CVodesIntegrator::initialize",
                               "CVodeSetSensParams failed.");
        }
    }
    applyOptions();
}
Exemple #20
0
void GStateOptions::update(const double dt_){
	this->elapsedTime += dt_;

	this->resolution->changeText(possibleResolutions[currentResolution].c_str());
	this->volumeMusic->changeText(Util::toString(this->musicVolume).c_str());
	this->volumeSFX->changeText(Util::toString(this->sfxVolume).c_str());

	const std::array<bool, GameKeys::MAX> keyStates = Game::instance().getInput();

	if(keyStates[GameKeys::ESCAPE] == true){
		Game::instance().setState(Game::GStates::MENU);
	}

	const double selectorDelayTime = 0.2;

	if(keyStates[GameKeys::DOWN] == true){
		if(this->elapsedTime >= selectorDelayTime){
			if(this->currentOption == (O_TOTAL - 1)){
				this->currentOption = O_RESOLUTION;
			}
			else{
				this->currentOption++;
			}
			this->elapsedTime = 0.0;
		}
	}

	if(keyStates[GameKeys::UP] == true){
		if(this->elapsedTime >= selectorDelayTime){
			if(this->currentOption == O_RESOLUTION){
				this->currentOption = (O_TOTAL - 1);
			}
			else{
				this->currentOption--;
			}
			this->elapsedTime = 0.0;
		}
	}

	if(keyStates[GameKeys::LEFT] == true){
		if(this->elapsedTime >= selectorDelayTime){
			// Option == Resolution
			if(this->currentOption == O_RESOLUTION){
				if(this->currentResolution == R_800_600){
					this->currentResolution = (R_TOTAL - 1);
				}
				else{
					this->currentResolution--;
				}
			}
			// Option == VOLUME MUSIC
			else if(this->currentOption == O_VOLUME_MUSIC){
				if(this->musicVolume > 0)
					this->musicVolume -= 5;
			}
			// Option == VOLUME SFX
			else if(this->currentOption == O_VOLUME_SFX){
				if(this->sfxVolume > 0)
					this->sfxVolume -= 5;
			}

			this->elapsedTime = 0.0;
		}
	}

	if(keyStates[GameKeys::RIGHT] == true){
		if(this->elapsedTime >= selectorDelayTime){
			// Option == Resolution
			if(this->currentOption == O_RESOLUTION){
				if(this->currentResolution == (R_TOTAL - 1)){
					this->currentResolution = R_800_600;
				}
				else{
					this->currentResolution++;
				}
			}
			// Option == VOLUME MUSIC
			else if(this->currentOption == O_VOLUME_MUSIC){
				if(this->musicVolume < 100)
					this->musicVolume += 5;
			
			}
			// Option == VOLUME SFX
			else if(this->currentOption == O_VOLUME_SFX){
				if(this->sfxVolume < 100)
					this->sfxVolume += 5;
			}
			else {

			}

			this->elapsedTime = 0.0;
		}
	}

	if(keyStates[GameKeys::SPACE] == true && this->currentOption == O_APPLY){
		applyOptions();
	}

	if(keyStates[GameKeys::SPACE] == true && this->currentOption == O_RETURN){
		Game::instance().setState(Game::GStates::MENU);
	}
}
Exemple #21
0
KviMainWindow::KviMainWindow(QWidget * pParent)
    : KviTalMainWindow(pParent, "kvirc_frame")
{
	g_pMainWindow = this;
	setAttribute(Qt::WA_DeleteOnClose);
	setAutoFillBackground(false);
	setAttribute(Qt::WA_TranslucentBackground);
	//disable this flag that gets enabled by qt when using Qt::WA_TranslucentBackground
	setAttribute(Qt::WA_NoSystemBackground, false);
#if !(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) || defined(COMPILE_KDE_SUPPORT))
	// Under windows, the icon is builtin; under kde, KApplication sets it for us
	// We try to avois this as much as possible, since it forces the use of the low-res 16x16 icon
	setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::KVIrc)));
#endif

	m_pWinList = new KviPointerList<KviWindow>;
	setWindowTitle(KVI_DEFAULT_FRAME_CAPTION);
	m_pWinList->setAutoDelete(false);

	m_pModuleExtensionToolBarList = new KviPointerList<KviMexToolBar>;
	m_pModuleExtensionToolBarList->setAutoDelete(false);

	m_pActiveContext = nullptr;

	m_pTrayIcon = nullptr;

	m_pSplitter = new QSplitter(Qt::Horizontal, this);
	m_pSplitter->setObjectName("main_frame_splitter");
	m_pSplitter->setChildrenCollapsible(false);

	setCentralWidget(m_pSplitter);

	setIconSize(KVI_OPTION_UINT(KviOption_uintToolBarIconSize));
	setButtonStyle(KVI_OPTION_UINT(KviOption_uintToolBarButtonStyle));

	m_pWindowStack = new KviWindowStack(m_pSplitter, "mdi_manager");

	// This theoretically had to exists before KviWindowStack (that uses enterSdiMode)
	m_pAccellerators = new KviPointerList<QShortcut>;
	m_pMenuBar = new KviMenuBar(this, "main_menu_bar");
	setMenuWidget(m_pMenuBar);
#ifndef COMPILE_ON_MAC
	m_pMenuBar->setVisible(KVI_OPTION_BOOL(KviOption_boolMenuBarVisible));
#endif

	if(KVI_OPTION_BOOL(KviOption_boolStatusBarVisible))
	{
		m_pStatusBar = new KviStatusBar(this);
		setStatusBar(m_pStatusBar);
		// torque: moved out of status bar constructor
		// because module init functions executed in load()
		// couldn't access the status bar via g_pMainWindow->mainStatusBar()
		// (assignment of m_pStatusBar happened after load() and
		// the init function)
		m_pStatusBar->load();
	}
	else
	{
		m_pStatusBar = nullptr;
	}

	m_pWindowList = nullptr;

	createWindowList();

	if((KVI_OPTION_RECT(KviOption_rectFrameGeometry).width() < 100) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).height() < 100) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).x() > g_pApp->desktop()->width()) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).y() > g_pApp->desktop()->height()))
	{
		// Try to find some reasonable defaults
		// prefer primary screen for first startup
		int primary_screen = g_pApp->desktop()->primaryScreen();
		QRect r = g_pApp->desktop()->screenGeometry(primary_screen);
		r.setLeft(r.left() + 10);
		r.setRight(r.right() - 100);
		r.setTop(r.top() + 10);
		r.setBottom(r.bottom() - 200);
		KVI_OPTION_RECT(KviOption_rectFrameGeometry) = r;
	}

	resize(KVI_OPTION_RECT(KviOption_rectFrameGeometry).width(),
	    KVI_OPTION_RECT(KviOption_rectFrameGeometry).height());
	move(KVI_OPTION_RECT(KviOption_rectFrameGeometry).x(),
	    KVI_OPTION_RECT(KviOption_rectFrameGeometry).y());

	if(KVI_OPTION_BOOL(KviOption_boolFrameIsMaximized))
		showMaximized();

	applyOptions();

	installAccelerators();
}
Exemple #22
0
void KviMainWindow::toggleWindowList()
{
	KVI_OPTION_BOOL(KviOption_boolUseTreeWindowList) = !KVI_OPTION_BOOL(KviOption_boolUseTreeWindowList);
	recreateWindowList();
	applyOptions();
}