Ejemplo n.º 1
1
void *QInfo::evaluate(QAbstractPlayer *ctx) {
	ctx->addText(getText(ctx));
	return NULL;
}
Ejemplo n.º 2
0
void Context::printToFile(FILE* out) const
{
    fprintf(out, "%s", getText().c_str());
}
Ejemplo n.º 3
0
void CruiseEngine::mainLoop() {
	//int32 t_start,t_left;
	//uint32 t_end;
	//int32 q=0;                     /* Dummy */
	int16 mouseX, mouseY;
	int16 mouseButton;

	int enableUser = 0;

	strcpy(nextOverlay, "");
	strcpy(lastOverlay, "");
	strcpy(cmdLine, "");

	currentActiveMenu = -1;
	autoMsg = -1;
	linkedRelation = 0;
	main21 = 0;
	main22 = 0;
	userWait = 0;
	autoTrack = false;

	initAllData();

	playerDontAskQuit = 0;
	int quitValue2 = 1;
	int quitValue = 0;

	if (ConfMan.hasKey("save_slot"))
		loadGameState(ConfMan.getInt("save_slot"));

	do {
		// Handle frame delay
		uint32 currentTick = g_system->getMillis();

		if (!bFastMode) {
			// Delay for the specified amount of time, but still respond to events
			bool skipEvents = false;

			do {
				g_system->delayMillis(10);
				currentTick = g_system->getMillis();

				if (!skipEvents)
					skipEvents = manageEvents();

				if (playerDontAskQuit)
					break;

				_vm->getDebugger()->onFrame();
			} while (currentTick < lastTick + _gameSpeed);
		} else {
			manageEvents();

			if (currentTick >= (lastTickDebug + 10)) {
				lastTickDebug = currentTick;
				_vm->getDebugger()->onFrame();
			}
		}
		if (playerDontAskQuit)
			break;

		lastTick = g_system->getMillis();

		// Handle switchover in game speed after intro
		if (!_speedFlag && canLoadGameStateCurrently()) {
			_speedFlag = true;
			_gameSpeed = GAME_FRAME_DELAY_2;
		}

		// Handle the next frame

//		frames++;
//      t_start=Osystem_GetTicks();

//      readKeyboard();

		bool isUserWait = userWait != 0;
		playerDontAskQuit = processInput();
		if (playerDontAskQuit)
			break;

		if (enableUser) {
			userEnabled = 1;
			enableUser = 0;
		}

		if (userDelay && !userWait) {
			userDelay--;
			continue;
		}

		if (isUserWait & !userWait) {
			// User waiting has ended
			changeScriptParamInList(-1, -1, &procHead, 9999, 0);
			changeScriptParamInList(-1, -1, &relHead, 9999, 0);

			// Disable any mouse click used to end the user wait
			currentMouseButton = 0;
		}

		// FIXME: I suspect that the original game does multiple script executions between game frames; the bug with
		// Raoul appearing when looking at the book is being there are 3 script iterations separation between the
		// scene being changed to the book, and the Raoul actor being frozen/disabled. This loop is a hack to ensure
		// that when a background changes, a few extra script executions are done
		bool bgChanged;
		int numIterations = 1;

		while (numIterations-- > 0) {
			bgChanged = backgroundChanged[masterScreen];
		
			manageScripts(&relHead);
			manageScripts(&procHead);

			removeFinishedScripts(&relHead);
			removeFinishedScripts(&procHead);

			if (!bgChanged && backgroundChanged[masterScreen]) {
				bgChanged = true;
				numIterations += 2;
			}
		}

		processAnimation();

		if (remdo) {
			// ASSERT(0);
			/*    main3 = 0;
			 * var24 = 0;
			 * var23 = 0;
			 *
			 * freeStuff2(); */
		}

		if (cmdLine[0]) {
			ASSERT(0);
			/*        redrawStrings(0,&cmdLine,8);

			        waitForPlayerInput();

			        cmdLine = 0; */
		}

		if (displayOn) {
			if (doFade)
				PCFadeFlag = 0;

			/*if (!PCFadeFlag)*/
			mainDraw(userWait);
			flipScreen();

			if (userEnabled && !userWait && !autoTrack) {
				if (currentActiveMenu == -1) {
					static int16 oldMouseX = -1;
					static int16 oldMouseY = -1;

					getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);

					if (mouseX != oldMouseX || mouseY != oldMouseY) {
						int objectType;
						int newCursor1;
						int newCursor2;

						oldMouseX = mouseX;
						oldMouseY = mouseY;

						objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);

						if (objectType == 9) {
							changeCursor(CURSOR_EXIT);
						} else if (objectType != -1) {
							changeCursor(CURSOR_MAGNIFYING_GLASS);
						} else {
							changeCursor(CURSOR_WALK);
						}
					}
				} else {
					changeCursor(CURSOR_NORMAL);
				}
			} else {
				changeCursor(CURSOR_NORMAL);
			}

			if (userWait == 1) {
				// Waiting for press - original wait loop has been integrated into the
				// main event loop
				continue;
			}

			// wait for character to finish auto track
			if (autoTrack) {
				if (isAnimFinished(narratorOvl, narratorIdx, &actorHead, ATP_MOUSE)) {
					if (autoMsg != -1) {
						freezeCell(&cellHead, autoOvl, autoMsg, 5, -1, 9998, 0);

						char* pText = getText(autoMsg, autoOvl);

						if (strlen(pText))
							userWait = 1;
					}

					changeScriptParamInList(-1, -1, &relHead, 9998, 0);
					autoTrack = false;
					enableUser = 1;
				} else {
					userEnabled = false;
				}
			} else if (autoMsg != -1) {
				removeCell(&cellHead, autoOvl, autoMsg, 5, masterScreen);
				autoMsg = -1;
			}
		} else {
			// Keep ScummVM being responsive even when displayOn is false
			g_system->updateScreen();
		}

	} while (!playerDontAskQuit && quitValue2 && quitValue != 7);

	// Free data
	removeAllScripts(&relHead);
	removeAllScripts(&procHead);
	resetActorPtr(&actorHead);
	freeOverlayTable();
	closeCnf();
	closeBase();
	resetFileEntryRange(0, NUM_FILE_ENTRIES);
	freeObjectList(&cellHead);
	freeBackgroundIncrustList(&backgroundIncrustHead);
}
void TListViewer::draw()
{
 short i, j, item;
 ushort normalColor, selectedColor, focusedColor, color;
 short colWidth, curCol, indent;
 TDrawBuffer b;
 uchar scOff;

    if( (state&(sfSelected | sfActive)) == (sfSelected | sfActive))
        {
        normalColor = getColor(1);
        focusedColor = getColor(3);
        selectedColor = getColor(4);
        }
    else
        {
        normalColor = getColor(2);
        selectedColor = getColor(4);
        }

    if( hScrollBar != 0 )
        indent = hScrollBar->value;
    else
        indent = 0;

    colWidth = size.x / numCols + 1;
    for( i = 0; i < size.y; i++ )
        {
        for( j = 0; j < numCols; j++ )
            {
            item =  j * size.y + i + topItem;
            curCol = j * colWidth;
            if( (state & (sfSelected | sfActive)) == (sfSelected | sfActive) &&
                focused == item &&
                range > 0)
                {
                color = focusedColor;
                setCursor( curCol + 1, i );
                scOff = 0;
                }
            else if( item < range && isSelected(item) )
                {
                color = selectedColor;
                scOff = 2;
                }
            else
                {
                color = normalColor;
                scOff = 4;
                }

            b.moveChar( curCol, ' ', color, colWidth );
            if( item < range )
                {
                char text[256];
                getText( text, item, colWidth + indent );
                char buf[256];
                memmove( buf, text+indent, colWidth );
                buf[colWidth] = EOS;
                b.moveStr( curCol+1, buf, color );
                if( showMarkers )
                    {
                    b.putChar( curCol, specialChars[scOff] );
                    b.putChar( curCol+colWidth-2, specialChars[scOff+1] );
                    }
                }
            else if( i == 0 && j == 0 )
                b.moveStr( curCol+1, "<empty>", getColor(1) );

            b.moveChar( curCol+colWidth-1, 179, getColor(5), 1 );
            }
        writeLine( 0, i, size.x, 1, b );
        }
}
Ejemplo n.º 5
0
int nugi( TCHAR *machine, TCHAR *user )
{
	DWORD rc;
	USER_INFO_3 *buf = 0;
	TCHAR temp[40];
	wchar_t unicodeMachine[UNCLEN + 4], unicodeUser[UNLEN + 2];
	static flag_t privilegeTexts[] =
	{
		{ USER_PRIV_GUEST, _T( "USER_PRIV_GUEST" ) },
		{ USER_PRIV_USER, _T( "USER_PRIV_USER" ) },
		{ USER_PRIV_ADMIN, _T( "USER_PRIV_ADMIN" ) },
		{ 0, 0 }
	};
	static flag_t authFlags[] =
	{
		{ AF_OP_PRINT, _T( "AF_OP_PRINT" ) },
		{ AF_OP_COMM, _T( "AF_OP_COMM" ) },
		{ AF_OP_SERVER, _T( "AF_OP_SERVER" ) },
		{ AF_OP_ACCOUNTS, _T( "AF_OP_ACCOUNTS" ) },
		{ 0, 0 }
	};
	static flag_t acctFlags[] =
	{
		{ UF_SCRIPT, _T( "UF_SCRIPT" ) },
		{ UF_ACCOUNTDISABLE, _T( "UF_ACCOUNTDISABLE" ) },
		{ UF_HOMEDIR_REQUIRED, _T( "UF_HOMEDIR_REQUIRED" ) },
		{ UF_PASSWD_NOTREQD, _T( "UF_PASSWD_NOTREQD" ) },
		{ UF_PASSWD_CANT_CHANGE, _T( "UF_PASSWD_CANT_CHANGE" ) },
		{ UF_LOCKOUT, _T( "UF_LOCKOUT" ) },
		{ UF_DONT_EXPIRE_PASSWD, _T( "UF_DONT_EXPIRE_PASSWD" ) },
#ifdef UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED
		{ UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED, _T( "UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED" ) },
#endif
#ifdef UF_NOT_DELEGATED
		{ UF_NOT_DELEGATED, _T( "UF_NOT_DELEGATED" ) },
#endif
#ifdef UF_SMARTCARD_REQUIRED
		{ UF_SMARTCARD_REQUIRED, _T( "UF_SMARTCARD_REQUIRED" ) },
#endif
		{ UF_NORMAL_ACCOUNT, _T( "UF_NORMAL_ACCOUNT" ) },
		{ UF_TEMP_DUPLICATE_ACCOUNT, _T( "UF_TEMP_DUPLICATE_ACCOUNT" ) },
		{ UF_WORKSTATION_TRUST_ACCOUNT, _T( "UF_WORKSTATION_TRUST_ACCOUNT" ) },
		{ UF_SERVER_TRUST_ACCOUNT, _T( "UF_SERVER_TRUST_ACCOUNT" ) },
		{ UF_INTERDOMAIN_TRUST_ACCOUNT, _T( "UF_INTERDOMAIN_TRUST_ACCOUNT" ) },
		{ 0, 0 }
	};

#ifdef UNICODE
	_tcsncpy( unicodeMachine, machine, lenof( unicodeMachine ) );
	_tcsncpy( unicodeUser, user, lenof( unicodeUser ) );
#else
	mbstowcs( unicodeMachine, machine, lenof( unicodeMachine ) );
	mbstowcs( unicodeUser, user, lenof( unicodeUser ) );
#endif
	unicodeMachine[lenof( unicodeMachine ) - 1] = _T( '\0' );
	unicodeUser[lenof( unicodeUser ) - 1] = _T( '\0' );

	_tprintf( _T( "User %s on %s: " ), user, machine );

	rc = NetUserGetInfo( unicodeMachine, unicodeUser, 3, (byte **) &buf );
	if ( rc != 0 )
	{
		_tprintf( _T( "error %lu.\n" ), rc );
		return rc;
	}

	_tprintf( _T( "found.\n" ) );

	_tprintf( _T( "  Name:          %ls\n" ), buf->usri3_name );
	_tprintf( _T( "  Password:      %ls\n" ), buf->usri3_password );
	_tprintf( _T( "  Password age:  %lu days, %02lu:%02lu:%02lu\n" ), buf->usri3_password_age / 86400UL,
		buf->usri3_password_age % 86400UL / 3600UL, buf->usri3_password_age % 3600UL / 60UL,
		buf->usri3_password_age % 60UL );
	_tprintf( _T( "  Privilege:     %s\n" ), getText( buf->usri3_priv, privilegeTexts ) );
	_tprintf( _T( "  Home dir:      %ls\n" ), buf->usri3_home_dir );
	_tprintf( _T( "  Comment:       %ls\n" ), buf->usri3_comment );
	_tprintf( _T( "  Flags:         %s\n" ), buildFlags( buf->usri3_flags, acctFlags ) );
	_tprintf( _T( "  Script path:   %ls\n" ), buf->usri3_script_path );
	_tprintf( _T( "  Auth flags:    %s\n" ), buildFlags( buf->usri3_auth_flags, authFlags ) );
	_tprintf( _T( "  Full name:     %ls\n" ), buf->usri3_full_name );
	_tprintf( _T( "  User comment:  %ls\n" ), buf->usri3_usr_comment );
	_tprintf( _T( "  RAS params:    (not displayed)\n" ) );
	_tprintf( _T( "  Workstations:  %ls\n" ), buf->usri3_workstations );
	_tprintf( _T( "  Last logon:    %s" ), buf->usri3_last_logon == 0? _T( "never\n" ): _tctime( (long *) &buf->usri3_last_logon ) );
	_tprintf( _T( "  Last logoff:   %s" ), buf->usri3_last_logoff == 0? _T( "unknown\n" ): _tctime( (long *) &buf->usri3_last_logoff ) );
	_tprintf( _T( "  Expires:       %s" ), buf->usri3_acct_expires == TIMEQ_FOREVER? _T( "never\n" ): _tctime( (long *) &buf->usri3_acct_expires ) );
	_tprintf( _T( "  Max storage:   %s\n" ), buf->usri3_max_storage == USER_MAXSTORAGE_UNLIMITED? _T( "unlimited" ): _ultot( buf->usri3_max_storage, temp, 10 ) );
	_tprintf( _T( "  Logon hours:   (not displayed)\n" ) );
	_tprintf( _T( "  Bad PW count:  %s\n" ), buf->usri3_bad_pw_count == (DWORD) -1L? _T( "unlimited" ): _ultot( buf->usri3_bad_pw_count, temp, 10 ) );
	_tprintf( _T( "  # of logons:   %s\n" ), buf->usri3_num_logons == (DWORD) -1L? _T( "unknown" ): _ultot( buf->usri3_num_logons, temp, 10 ) );
	_tprintf( _T( "  Logon server:  %ls\n" ), buf->usri3_logon_server );
	_tprintf( _T( "  Country code:  %lu\n" ), buf->usri3_country_code );
	_tprintf( _T( "  Code page:     %lu\n" ), buf->usri3_code_page );
	_tprintf( _T( "  User RID:      %lu\n" ), buf->usri3_user_id );
	_tprintf( _T( "  Pgroup RID:    %lu\n" ), buf->usri3_primary_group_id );
	_tprintf( _T( "  Profile path:  %ls\n" ), buf->usri3_profile );
	_tprintf( _T( "  Home drive:    %ls\n" ), buf->usri3_home_dir_drive );
	_tprintf( _T( "  PW expired:    %s\n" ), buf->usri3_password_expired? _T( "yes" ): _T( "no" ) );
	_tprintf( _T( "\n" ) );

	return 0;
}
Ejemplo n.º 6
0
int IntTextField::getValue()
{
    return getText().empty() ? mMin : mValue;
}
Ejemplo n.º 7
0
void HorizontalLine::draw (QPixmap &buffer, Scaler &scaler, int, int, int)
{
  QPainter painter;
  painter.begin(&buffer);
  painter.setFont(font);
  
  int y = scaler.convertToY(getValue());
  
  // if value is off chart then don't draw it
  if (getValue() < scaler.getLow())
    return;
      
  painter.setPen(getColor());
    
  QFontMetrics fm(font);
  QString s;
  getText(s);
  int pixelsWide = fm.width(s);
  painter.drawLine (0, y, buffer.width(), y);
  painter.drawText(0, y - 1, s, -1);
  painter.drawText(0 + pixelsWide + 1, y - 1, QString::number(getValue()), -1);
  
  clearSelectionArea();
  QPointArray array;
  array.putPoints(0, 4, 0, y - 4, 0, y + 4, buffer.width(), y + 4, buffer.width(), y - 4);
  setSelectionArea(new QRegion(array));
    
  if (getStatus() == COBase::Selected)
  {
    clearGrabHandles();
    int t = (int) buffer.width() / 4;
    
    setGrabHandle(new QRegion(0,
             		      y - (HANDLE_WIDTH / 2),
			      HANDLE_WIDTH,
			      HANDLE_WIDTH,
			      QRegion::Rectangle));
    painter.fillRect(0, y - (HANDLE_WIDTH / 2), HANDLE_WIDTH, HANDLE_WIDTH, getColor());
  
    setGrabHandle(new QRegion(t,
             		      y - (HANDLE_WIDTH / 2),
			      HANDLE_WIDTH,
			      HANDLE_WIDTH,
			      QRegion::Rectangle));
    painter.fillRect(t, y - (HANDLE_WIDTH / 2), HANDLE_WIDTH, HANDLE_WIDTH, getColor());
    
    setGrabHandle(new QRegion(t * 2,
             		      y - (HANDLE_WIDTH / 2),
			      HANDLE_WIDTH,
		              HANDLE_WIDTH,
			      QRegion::Rectangle));
    painter.fillRect(t * 2, y - (HANDLE_WIDTH / 2), HANDLE_WIDTH, HANDLE_WIDTH, getColor());
    
    setGrabHandle(new QRegion(t * 3,
             		      y - (HANDLE_WIDTH / 2),
			      HANDLE_WIDTH,
		  	      HANDLE_WIDTH,
			      QRegion::Rectangle));
    painter.fillRect(t * 3, y - (HANDLE_WIDTH / 2), HANDLE_WIDTH, HANDLE_WIDTH, getColor());
    
    setGrabHandle(new QRegion(t * 4,
             	              y - (HANDLE_WIDTH / 2),
			      HANDLE_WIDTH,
		    	      HANDLE_WIDTH,
			      QRegion::Rectangle));
    painter.fillRect(t * 4, y - (HANDLE_WIDTH / 2), HANDLE_WIDTH, HANDLE_WIDTH, getColor());
  }

  painter.end();
}
Ejemplo n.º 8
0
void GetPerlBlock( ss_block *ss_new, char *start, line *line, linenum line_no )
{
    line = line;
    line_no = line_no;

    if( start[0] == '\0' ) {
        if( firstNonWS == start ) {
            // line is empty -
            // do not flag following line as having anything to do
            // with an unterminated " or # or // from previous line
            flags.inString = false;
        }
        getBeyondText( ss_new );
        return;
    }

    if( flags.inString ) {
        getString( ss_new, start, 0 );
        return;
    }

    if( isspace( start[0] ) ) {
        getWhiteSpace( ss_new, start );
        return;
    }

    switch( start[0] ) {
        case '#':
            getPerlComment( ss_new, start );
            return;
        case '"':
            getString( ss_new, start, 1 );
            return;
        case '/':
            if( flags.beforeRegExp ) {
                getRegExp( ss_new, start );
                return;
            }
            break;
        case '$':
        case '@':
        case '%':
            if( isalpha( start[1] ) || (start[0] == '$' && start[1] == '#') ) {
                getVariable( ss_new, start );
                return;
            } else if( start[0] == '$' &&
                       (isdigit( start[1] ) || isspecvar( start[1] )) ) {
                getSpecialVariable( ss_new, start );
                return;
            }
            break;
        case '\'':
            getChar( ss_new, start, 1 );
            return;
        case '.':
            if( isdigit( start[1] ) ) {
                getFloat( ss_new, start, 1, AFTER_DOT );
                return;
            }
            break;
        case '0':
            if( start[1] == 'x' || start[1] == 'X' ) {
                getHex( ss_new, start );
                return;
            } else {
                getNumber( ss_new, start, '7' );
                return;
            }
            break;
    }

    if( issymbol( start[0] ) ) {
        getSymbol( ss_new, start );
        return;
    }

    if( isdigit( start[0] ) ) {
        getNumber( ss_new, start, '9' );
        return;
    }

    if( isalpha( *start ) || (*start == '_') ) {
        getText( ss_new, start );
        return;
    }

    getInvalidChar( ss_new );
}
Ejemplo n.º 9
0
void RepoQuery::getText(int iCol, const char*& text, size_t& size) {
  getText(iCol, text);
  size = size_t(sqlite3_column_bytes(m_stmt.get(), iCol));
}
Ejemplo n.º 10
0
{
}

// Expected range / not range
MismatchedTokenException::MismatchedTokenException(
    const char* const* tokenNames_,
    const int numTokens_,
    RefToken token_,
    int lower,
    int upper_,
    bool matchNot,
    const ANTLR_USE_NAMESPACE(std)string& fileName_
) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn())
    , token(token_)
    , node(nullASTptr)
    , tokenText(token_->getText())
    , mismatchType(matchNot ? NOT_RANGE : RANGE)
    , expecting(lower)
    , upper(upper_)
    , tokenNames(tokenNames_)
    , numTokens(numTokens_)
{
}

// Expected token / not token
MismatchedTokenException::MismatchedTokenException(
    const char* const* tokenNames_,
    const int numTokens_,
    RefToken token_,
    int expecting_,
    bool matchNot,
Ejemplo n.º 11
0
P2CombinatorWidget::P2CombinatorWidget( const Object *o )
    : P2Text( getText( o ), QColor( COMBINATOR__COLOR ))
{
    //...
}
Ejemplo n.º 12
0
std::string ByteBuffer::toString() const
{
    return getText();
}
Ejemplo n.º 13
0
bool VisusIndexedData::fromXMLLocalVariables(XMLNode& node, XMLDataStorage storageType)
{
  if (! VisusMetricData::fromLocalXMLVariables(node))
    return false;

  mVertexDim = xmltoi(node.getAttribute("vertexDim"), mVertexDim);
  mSpatialDim= xmltoi(node.getAttribute("spatialDim"), mSpatialDim);

  // Save Vertices To XML tree
  XMLNode vertex = node.getChildNode("vertices");
  XMLNode index  = node.getChildNode("indices");

  switch (storageType)
  {
    case ASCII:
    {
      std::stringstream ssVert;;
      ssVert << vertex.getText();
      for (std::vector<std::vector<VertexDataType> >::iterator viter=mVertices->begin(); 
           viter!=mVertices->end(); ++viter) 
      {    
        for (std::vector<VertexDataType>::iterator vdtIter=viter->begin(); 
             vdtIter!=viter->end(); ++vdtIter) 
        {
          ssVert >> (*vdtIter);
        }
      }

      // Save Indices To XML tree
      std::stringstream ssIndex;;  
      ssIndex << index.getText();
      for (std::vector<std::vector<IndexDataType> >::iterator iiter=mElements->begin(); 
           iiter!=mElements->end(); ++iiter) 
      {
        for (std::vector<IndexDataType>::iterator idtIter=iiter->begin(); 
             idtIter!=iiter->end(); ++idtIter) 
        {
          ssIndex >> (*idtIter);
        }
      }
    }
    break;
    default:
    {
      // Save Vertices
      if (!getText(vertex, mVertices, storageType)) {
        vwarning("Failed to retrieve vertex data for VisusIndexedData");
        return false;
      }

      // Save Elements
      if (!getText(index, mElements, storageType)) {
        vwarning("Failed to retrieve element data for VisusIndexedData");
        return false;
      }
    }
    break;
  }

  // Save BBox To Tree
  if (! mBBox.fromXML(node)) {
    vwarning("Failed to retrieve bounding box for VisusIndexedData");
    return false;
  }

  return true;
}  
Ejemplo n.º 14
0
void GetFORTRANBlock( ss_block *ss_new, char *start, int text_col )
{
    int length = 0;
    if( start[0] == '\0' ) {
        if( text_col == 0 ) {
            // line is empty -
            // do not flag following line as having anything to do
            // with an unterminated string from previous line
            flags.inString = false;
        }
        getBeyondText( ss_new );
        return;
    }

    if( iscomment( firstChar ) ) {
        getComment( ss_new, start );
        return;
    }

    if( text_col <= 4 ) {
        getLabelOrWS( ss_new, start, text_col );
        return;
    }

    if( text_col == 5 ) {
        getContinuationOrWS( ss_new, start );
        return;
    }

    if( flags.inString ) {
        getLiteral( ss_new, start, 0 );
        return;
    }

    if( isspace( start[0] ) ) {
        getWhiteSpace( ss_new, start );
        return;
    }

    switch( start[0] ) {

    case '!':
        getComment( ss_new, start );
        return;
    case '\'':
        getLiteral( ss_new, start, 1 );
        return;
    case '.':
        if( isdigit( start[1] ) ) {
            getFloat( ss_new, start, 1, AFTER_DOT );
            return;
        }
        length = islogical( start );
        if( length > 0 ){
            getSymbol( ss_new, length );
            return;
        }
    }

    if( issymbol( start[0] ) ) {
        getSymbol( ss_new, 1 );
        return;
    }

    if( isdigit( *start ) ) {
        getNumber( ss_new, start );
        return;
    }

    if( isalpha( *start ) || (*start == '_') || (*start == '$') ) {
        getText( ss_new, start );
        return;
    }

    getInvalidChar( ss_new );
}
Ejemplo n.º 15
0
void		CWindowControl_Text::render(void)
{
	CGDIPlusUtility::drawText(getPosition(), getSize(), getText(), getTextColour(), getFontSize(), isBold());
}
Ejemplo n.º 16
0
void RepoQuery::getStdString(int iCol, std::string& s) {
  const char* text;
  size_t size;
  getText(iCol, text, size);
  s = std::string(text, size);
}
Ejemplo n.º 17
0
String IOMLCode::encodeBody(shared_ptr<OMLContext> context, const String& text, bool postProcess, bool preserveStartLineSpaces, bool convertCR)
{
	String value = text;

	if ( (postProcess) && (context->getMode() != omlRenderModeSearch) && (!context->getRow()) )
	{
		// Detect degli url
		{
			String protocolsFindLinkOption = context->getPage()->getOption(Options::url_options::protocols_find_link);
			//String protocolsFindLinkOption = Options::instance()->getOption(Options::url_options::protocols_find_link);
			//String UrlMatch = _S("(")+getProtocolsFindLinkOption()+_S(")://(\\w*:\\w*@)?[-\\w.]+(:\\d+)?(/([\\w/_.]*(\\?\\S+)?)?)?");
			//String UrlMatch = _S("((")+getProtocolsFindLinkOption()+_S(")(\\W+\\S+[^).,:;?\\]\\} \\r\\n$]+))");
			//String UrlMatch = _S("(")+protocolsFindLinkOption+_S(")://(\\w*:\\w*@)?[-\\w.]+(:\\d+)?(/([\\w/_.]*(\\?\\S+)?)?)?");

			// 0.11:
			//String UrlMatch = _S("(") + protocolsFindLinkOption + _S(")://\\S+");
			
			// 1.0:
			String UrlMatch = _S("(") + protocolsFindLinkOption + _S("):[/\?]\\S+");
			
			// La versione sotto sarebbe meglio, ma non funziona, ad esempio con il link seguente:
			// skype:?chat&blob=iCnRW4EXR0H_funqp8i2FpbcobXxBfFkllPp0s2NMRd_sbDEOEr5Je-RzNUi
			//String UrlMatch = _S("(")+protocolsFindLinkOption+_S("):\\S+");

			String UrlReplace = _S("[url]$0[/url]");
			//if(regex_match(value, RegexManager::instance()->getRegex(UrlMatch, true)))
			value = regex_replace(value, RegexManager::instance()->getRegex(UrlMatch, true), UrlReplace);
			
			//String MailMatch = _S("\\b((([A-Za-z0-9$_.+%=-])|%[A-Fa-f0-9]{2})+@(([A-Za-z0-9$_.+!*,;/?:%&=-])|%[A-Fa-f0-9]{2})+\\.[a-zA-Z0-9]{1,4})");
			String MailMatch = _S("(\\w+\\.)*\\w+@(\\w+\\.)+[A-Za-z]+");
			String MailReplace = _S("[email]$0[/email]");
			//if(regex_match(value, RegexManager::instance()->getRegex(MailMatch, true)))
			value = regex_replace(value, RegexManager::instance()->getRegex(MailMatch, true), MailReplace);			
		}
		if(value != text)
		{
			// Sono stati inseriti tag, ricomputo...
			return encodeOML(context, value);
		}
	}

	// Risolvo gli escaping
	value.replace_all(_S("\\["), _S("["));
	//value.replace_all(_S("\\]"), _S("]"));

	// Encoding html
	value = encode(context, value);
	
	if(postProcess)
	{
		// Emoticons
		if( (context->getMode() != omlRenderModeSearch) && (context->getPage() != nullptr) )
		{
			String valueLower = value;
			valueLower.to_lower();

			//const StringMap &emoticons = IdeSystem::instance()->getEmoticons();
			//for(StringMap::const_iterator i = emoticons.begin(); i != emoticons.end(); ++i)
			const OMLManager::Emoticons &emoticons = OMLManager::instance()->getEmoticons();
			for(OMLManager::Emoticons::const_iterator i = emoticons.begin(); i != emoticons.end(); ++i)
			{
				//const String &code = i->first;
				shared_ptr<OMLEmoticon> emo = *i;
				const String &code = emo->getCode();

				// Ottimizzazione, se non lo trovo con una 'find' secca sull'equivalente in lower-case,
				//  inutile cercarlo via regex.
				if(valueLower.find(emo->getCode()) != String::npos)
				{
					//const String &name = i->second;
					const String &name = emo->getName();
					String title = getText(context, _S("emoticons.") + name);

					String url = context->getPage()->getSkin()->getImageUrl(_S("emoticons/")+name+_S(".gif"));
					String out = String::format(_S(" <img src=\"%S\" alt=\"%S\" title=\"%S\"> ").c_str(), url.c_str(), code.c_str(), title.c_str());

					// Se prima o dopo non c' niente, o c' un carattere :
					String codeRegexQuote = regex_quote(code);
					// RegEx presa da Invision
					// $txt = preg_replace( "!(?<=[^\w&;/])$code(?=.\W|\W.|\W$)!ei", "\$this->convert_emoticon('$code', '$image')", $txt );
					//String re = _S("!(?<=[^\\w&;/])") + codeRegexQuote + _S("(?=.\\W|\\W.|\\W$)!ei");
					//String re = _S("( ")+codeRegexQuote+_S(" |^")+codeRegexQuote+_S(" | ")+codeRegexQuote+_S("$|^")+codeRegexQuote+_S("$)");

					// Non sono riuscito a far e il detect dei limiti della stringa, per cui aggiungo due spazi prima e trimmo dopo.
					value = _S(" ") + value + _S(" ");

					//String charsEmoBoundary = _S("\\s\\n\\r:),;");
					//String re = String::format(_S("(?<=[%S])%S(?=[%S])").c_str(), charsEmoBoundary.c_str(), codeRegexQuote.c_str(), charsEmoBoundary.c_str());
					String re = String::format(_S("(?<=[\\s])%S(?=[\\s])").c_str(), codeRegexQuote.c_str());

					// URGENT: da ottimizzare con una
					// shared_ptr<boost::wregex> re = regex_create(regex, nocase);
					value = regex_replace(value, RegexManager::instance()->getRegex(re, true), out);

					// Tolgo i due spazi messi sopra
					value = value.substr(1,value.length()-2);
				}
			}
		}
	}
	
	// Encoding dei \n
	if ( (context->getMode() == omlRenderModeSearch) || (context->getRow()) )
	{
		value.replace_all(_S("\n"), _S(" "));
	}
	else
	{
		if(preserveStartLineSpaces)
		{
			for(;;)
			{
				String::size_type posCR = value.find(_S("\n"));
				if(posCR == String::npos)
					break;

				String::size_type posFirstNoSpace = value.find_first_not_of(_S(" "), posCR+1);
				if(posFirstNoSpace == String::npos)
					posFirstNoSpace = value.length();
				String startLineText = value.substr(posCR+1, posFirstNoSpace - (posCR+1));
				startLineText.replace_all(_S(" "),_S("&nbsp;"));
				value = value.substr(0,posCR) + _S("<br>") + startLineText + value.substr(posFirstNoSpace);
			}
		}
		else if(convertCR)
		{
			value.replace_all(_S("\n"), _S("<br />"));
		}
	}

	// Ulteriore encoding finale di sicurezza XSS, trasformo i '\' in '&#x5C;'.
	value.replace_all(_S("\\"),_S("&#x5C;"));

	return value;
}
Ejemplo n.º 18
0
QString
HelpWhatsThis::getWhatsThisText(GCHelp chapter) {
    return getText(chapter);
}
Ejemplo n.º 19
0
void GuiTextEditCtrl::getRenderText(char *dest)
{
    getText( dest );
}
Ejemplo n.º 20
0
LLSD LLTextBox::getValue() const
{
	return LLSD(getText());
}
Ejemplo n.º 21
0
int get_button3()
{
	return getText(button3);
}
Ejemplo n.º 22
0
void cBitmapFontEditable::takeFocus(CDrawContext *pContext) {
  if(!m_editing) {
    getText((char*)&m_old_buffer);
  }
  m_editing = true;
  
  if(m_edit_index) {
    m_edit_index = 0;
    memset(m_edit_buffer, 0x0, sizeof(char) * MAX_EDIT_CHARS);
  }
  setText(" ");
    
#if WINDOWS || MACX
	// calculate offset for CViewContainers
	CRect rect (size);
	CView* parent = getParentView ();
	CRect vSize;
	while (parent)
	{
		if (parent->notify (this, kMsgCheckIfViewContainer) == kMessageNotified)
		{
			parent->getViewSize (vSize);
			rect.offset (vSize.left, vSize.top);
		}
		parent = parent->getParentView ();
	}
	if (pContext)
		rect.offset (pContext->offset.h, pContext->offset.v);
#endif
  
#if WINDOWS
//	int wstyle = 0;
//	if (horiTxtAlign == kLeftText)
//		wstyle |= ES_LEFT;
//	else if (horiTxtAlign == kRightText)
//		wstyle |= ES_RIGHT;
//	else
//		wstyle |= ES_CENTER;
//  
//	wstyle |= WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;
//	platformControl = (void*)CreateWindow (
//                                         "EDIT", text, wstyle,
//                                         rect.left, rect.top, rect.width ()/* + 1*/, rect.height ()/* + 1*/,
//                                         (HWND)getFrame ()->getSystemWindow (), NULL, GetInstance (), 0);
//  
//	// get/set the current font
//	LOGFONT logfont = {0};
//  
//	long fontH = gStandardFontSize [fontID];
//	if (fontH > rect.height () - 2)
//		fontH = rect.height () - 2;
//  
//	logfont.lfWeight = FW_NORMAL;
//	logfont.lfHeight = -fontH;
//	logfont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
//	strcpy (logfont.lfFaceName, gStandardFontName[fontID]);
//  
//	logfont.lfClipPrecision	 = CLIP_STROKE_PRECIS;
//	logfont.lfOutPrecision	 = OUT_STRING_PRECIS;
//	logfont.lfQuality 	     = DEFAULT_QUALITY;
//	logfont.lfCharSet        = ANSI_CHARSET;
//  
//	platformFont = (HANDLE)CreateFontIndirect (&logfont);
//	platformFontColor = 0;
//  
	SetWindowLongPtr ((HWND)platformControl, GWLP_USERDATA, (LONG_PTR)this);
//	SendMessage ((HWND)platformControl, WM_SETFONT, (WPARAM)platformFont, true);
	SendMessage ((HWND)platformControl, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG (0, 0));
//	SendMessage ((HWND)platformControl, EM_SETSEL, 0, -1);
	SendMessage ((HWND)platformControl, EM_LIMITTEXT, 255, 0);
	SetFocus ((HWND)platformControl);

	oldWndProcEdit = (WINDOWSPROC)SetWindowLongPtr ((HWND)platformControl, GWLP_WNDPROC, (LONG_PTR)WindowProcEdit);
  
#elif MAC
	WindowRef window = (WindowRef)getFrame()->getSystemWindow();
  SetUserFocusWindow(window);
  AdvanceKeyboardFocus(window);
  EventTypeSpec eventTypes[] = {
    { kEventClassMouse, kEventMouseDown },
    { kEventClassWindow, kEventWindowDeactivated },
    { kEventClassKeyboard, kEventRawKeyDown },
    { kEventClassKeyboard, kEventRawKeyRepeat }
  };
  InstallWindowEventHandler(window, TextControlProc, GetEventTypeCount(eventTypes),
                            eventTypes, this, &gEventHandler);
#endif
  
  setDirty();
}
Ejemplo n.º 23
0
int
main(int argc, const char *argv[]) {

    struct cmdlineInfo cmdline;
    bit ** bits;
    unsigned int rows, cols;
    struct font * fontP;
    unsigned int vmargin, hmargin;
    struct text inputText;
    struct text formattedText;
    int maxleftb;

    pm_proginit(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);
    
    computeFont(cmdline, &fontP);

    getText(cmdline.text, fontP, &inputText);
       
    if (cmdline.nomargins) {
        vmargin = 0;
        hmargin = 0;
    } else {
        if (inputText.lineCount == 1) {
            vmargin = fontP->maxheight / 2;
            hmargin = fontP->maxwidth;
        } else {
            vmargin = fontP->maxheight;
            hmargin = 2 * fontP->maxwidth;
        }
    }
    
    if (cmdline.width > 0) {
        if (cmdline.width > INT_MAX -10)
            pm_error("-width value too large: %u", cmdline.width);
            
        /* Flow or truncate lines to meet user's width request */
        if (inputText.lineCount == 1) 
            flowText(inputText, cmdline.width, fontP, cmdline.space,
                     &formattedText);
        else
            truncateText(inputText, cmdline.width, fontP, cmdline.space,
                         &formattedText);
        freeTextArray(inputText);
    } else
        formattedText = inputText;
        
    if (formattedText.lineCount == 0)
        pm_error("No input text.");
    
    computeImageHeight(formattedText, fontP, cmdline.lspace, vmargin,
                       &rows);

    computeImageWidth(formattedText, fontP, cmdline.space, hmargin,
                      &cols, &maxleftb);

    if (cols == 0 || rows == 0)
        pm_error("Input is all whitespace and/or non-renderable characters.");

    bits = pbm_allocarray(cols, rows);

    /* Fill background with white */
    fill_rect(bits, 0, 0, rows, cols, PBM_WHITE);

    /* Put the text in  */
    insert_characters(bits, formattedText, fontP, vmargin, hmargin + maxleftb, 
                      cmdline.space, cmdline.lspace);

    pbm_writepbm(stdout, bits, cols, rows, 0);

    pbm_freearray(bits, rows);

    freeTextArray(formattedText);
    pm_close(stdout);

    return 0;
}
Ejemplo n.º 24
0
// render
void		CWindowControl_Check::render(void)
{
	CGDIPlusUtility::drawRectangleFill(getPosition(), getSize(), getFillColour());
	CGDIPlusUtility::drawRectangleBorder(getPosition(), getSize(), getLineColour());
	if(isChecked())
	{
		CGDIPlusUtility::drawLine(CVector2ui32(getPosition().m_x, getPosition().m_y + getSize().m_y), CVector2ui32(getPosition().m_x + getSize().m_x, getPosition().m_y), getLineColour());
	}
	CGDIPlusUtility::drawText(CVector2ui32(getPosition().m_x + getSize().m_x + getIconRightMargin(), getPosition().m_y), getSize(), getText(), getTextColour(), getFontSize(), isBold());
}
Ejemplo n.º 25
0
ANTLR_USE_NAMESPACE(std)string CommonToken::toString() const
{
	return "[\""+getText()+"\",<"+getType()+">,line="+getLine()+",column="+getColumn()+"]";
}
Ejemplo n.º 26
0
int QwtPlotWidget::interpret(const char *command, double *x, double *y)
{
  if(command == NULL) return -1;
  line = command;

  if     (isCommand("setCurveData("))
  {
    if(x == NULL) return -1;
    if(y == NULL) return -1;
    int c,count;
    sscanf(command,"setCurveData(%d,%d",&c,&count);
    if(c<0 || c>=nCurves) return -1;
    if(curves[c] != NULL) curves[c]->setData(x,y,count);
  }
  else if(isCommand("replot("))
  {
    replot();
  }
  else if(isCommand("setTitle("))
  {
    QString text;
    if(getText(command,text) != 0) return -1;
    setTitle(text);
  }
  else if(isCommand("setCanvasBackground("))
  {
    int r,g,b;
    sscanf(command,"setCanvasBackground(%d,%d,%d",&r,&g,&b);
    setCanvasBackground(QColor(r,g,b));
  }
  else if(isCommand("enableOutline("))
  {
    int val;
    sscanf(command,"enableOutline(%d",&val);
    if( val == 0 || val == 1 )
    {
      //xx enableOutline(val);
      //xx setOutlineStyle(Qwt::Rect );
    }
    else
    {
      //xx enableOutline( 1 );
      //xx setOutlineStyle(Qwt::Cross );
    }
  }
  else if(isCommand("setOutlinePen("))
  {
    int r,g,b;
    sscanf(command,"setOutlinePen(%d,%d,%d",&r,&g,&b);
    //xx setOutlinePen(QColor(r,g,b));
  }
  else if(isCommand("setAutoLegend("))
  {
    int val;
    sscanf(command,"setAutoLegend(%d",&val);
    //xx setAutoLegend(val);
    autolegend = val;
  }
  else if(isCommand("enableLegend("))
  {
    int val;
    sscanf(command,"enableLegend(%d",&val);
    enablelegend = val;
  }
  else if(isCommand("setLegendPos("))
  {
    int val;
    sscanf(command,"setLegendPos(%d",&val);
    if(opt.arg_debug) printf("SetLegendPos begin\n");;
    if(legend == NULL) legend = new QwtLegend();
    if(opt.arg_debug) printf("SetLegendPos 1\n");;
    legend->setItemMode(QwtLegend::ClickableItem);
    if(opt.arg_debug) printf("SetLegendPos 2\n");;
    switch(val)
    {
      case PV::LeftLegend:
        insertLegend(legend, QwtPlot::LeftLegend);
        break;
      case PV::RightLegend:
        insertLegend(legend, QwtPlot::RightLegend);
        break;
      case PV::TopLegend:
        insertLegend(legend, QwtPlot::TopLegend);
        break;
      default:
        insertLegend(legend, QwtPlot::BottomLegend);
        break;
    }
    if(opt.arg_debug) printf("SetLegendPos end\n");;
  }
  else if(isCommand("setLegendFrameStyle("))
  {
    int val;
    sscanf(command,"setLegendFrameStyle(%d",&val);
    legendframestyle = val;
    if(legend != NULL) legend->setFrameStyle(legendframestyle);
  }
  else if(isCommand("enableGridXMin("))
  {
    grid.enableXMin(true);
  }
  else if(isCommand("setGridMajPen("))
  {
    int r,g,b,style;
    sscanf(command,"setGridMajPen(%d,%d,%d,%d",&r,&g,&b,&style);
    grid.setMajPen(QPen(QColor(r,g,b),0,(Qt::PenStyle) style));
  }
  else if(isCommand("setGridMinPen("))
  {
    int r,g,b,style;
    sscanf(command,"setGridMinPen(%d,%d,%d,%d",&r,&g,&b,&style);
    grid.setMinPen(QPen(QColor(r,g,b),0,(Qt::PenStyle) style));
  }
  else if(isCommand("enableAxis("))
  {
    int pos;
    sscanf(command,"enableAxis(%d",&pos);
    enableAxis(pos);
  }
  else if(isCommand("setAxisTitle("))
  {
    int pos;
    QString text;
    sscanf(command,"setAxisTitle(%d",&pos);
    if(getText(command,text) != 0) return -1;
    setAxisTitle(pos,text);
  }
  else if(isCommand("setAxisOptions("))
  {
    int pos,val;
    sscanf(command,"setAxisOptions(%d,%d",&pos,&val);
    //xx setAxisOptions(pos,val);
  }
  else if(isCommand("setAxisMaxMajor("))
  {
    int pos,val;
    sscanf(command,"setAxisMaxMajor(%d,%d",&pos,&val);
    setAxisMaxMajor(pos,val);
  }
  else if(isCommand("setAxisMaxMinor("))
  {
    int pos,val;
    sscanf(command,"setAxisMaxMinor(%d,%d",&pos,&val);
    setAxisMaxMinor(pos,val);
  }
  else if(isCommand("insertCurve("))
  {
    int pos;
    QString text;
    sscanf(command,"insertCurve(%d",&pos);
    if(getText(command,text) != 0) return -1;
    if(pos<0 || pos>=nCurves) return -1;
    //xx removeCurve( curves[pos] );
    //xx curves[pos] = insertCurve(text);
    if(curves[pos] != NULL) delete curves[pos];
    if(opt.arg_debug) printf("new QwtPlotCurve(%s)\n",(const char *) text.toUtf8());
    curves[pos] = new QwtPlotCurve(text);
    curves[pos]->attach(this);
    if(legend != NULL)
    {
      QWidget *w = legend->find(curves[pos]);
      if(w != NULL) 
      {
        if(opt.arg_debug) printf("setChecked(%d)\n",autolegend);
        ((QwtLegendItem *)w)->setChecked(autolegend);
      }
    }
    replot();

    //if(autolegend && legend != NULL) curves[pos]->updateLegend(legend);
  }
  else if(isCommand("removeCurve("))
  {
    int pos;
    sscanf(command,"removeCurve(%d",&pos);
    if(pos<0 || pos>=nCurves) return -1;
    //xx removeCurve( curves[pos] );
    if(curves[pos] != NULL) curves[pos]->detach();
    if(curves[pos] != NULL) delete curves[pos];
    curves[pos] = NULL;
  }
  else if(isCommand("setCurvePen("))
  {
    int pos,r,g,b,width,style;
    sscanf(command,"setCurvePen(%d,%d,%d,%d,%d,%d",&pos,&r,&g,&b,&width,&style);
    if(pos<0 || pos>=nCurves) return -1;
    //xx setCurvePen(curves[pos],QPen(QColor(r,g,b),width,(Qt::PenStyle) style));
    QPen pen(QColor(r,g,b));
    pen.setWidth(width);
    pen.setStyle((Qt::PenStyle) style);
    if(curves[pos] != NULL) curves[pos]->setPen(pen);
  }
  else if(isCommand("setCurveSymbol("))
  {
    int pos,symbol,r1,g1,b1,r2,g2,b2,w,h;
    sscanf(command,"setCurveSymbol(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&pos,&symbol,
                    &r1,&g1,&b1,&r2,&g2,&b2,&w,&h);
    if(pos<0 || pos>=nCurves) return -1;
    //xx setCurveSymbol(curves[pos], QwtSymbol((QwtSymbol::Style) symbol, QColor(r1,g1,b1), QColor(r2,g2,b2), QSize(w,h)));
    if(curves[pos] != NULL) curves[pos]->setSymbol(QwtSymbol((QwtSymbol::Style) symbol, QColor(r1,g1,b1), QColor(r2,g2,b2), QSize(w,h)));
  }
  else if(isCommand("setCurveYAxis("))
  {
    int pos,pos2;
    sscanf(command,"setCurveYAxis(%d,%d",&pos,&pos2);
    if(pos<0 || pos>=nCurves) return -1;
    //xx setCurveYAxis(curves[pos],pos2); rl2013
    if(curves[pos] != NULL) curves[pos]->setYAxis(pos2);
  }
  else if(isCommand("insertMarker("))
  {
    int pos;
    sscanf(command,"insertMarker(%d",&pos);
    if(pos<0 || pos>=nMarker) return -1;
    //xx marker[pos] = insertMarker();
    if(marker[pos] != NULL) delete marker[pos];
    marker[pos] = new QwtPlotMarker();
    marker[pos]->attach(this);
  }
  else if(isCommand("setMarkerLineStyle("))
  {
    int pos,style;
    sscanf(command,"setMarkerLineStyle(%d,%d",&pos,&style);
    if(pos<0 || pos>=nMarker) return -1;
    //xx setMarkerLineStyle(marker[pos],(QwtMarker::LineStyle) style);
    if(marker[pos] != NULL) marker[pos]->setLineStyle((QwtPlotMarker::LineStyle) style);
  }
  else if(isCommand("setMarkerPos("))
  {
    int pos;
    float x,y;
    sscanf(command,"setMarkerPos(%d,%f,%f",&pos,&x,&y);
    if(pos<0 || pos>=nMarker) return -1;
    //xx setMarkerPos(marker[pos],x,y);
    if(marker[pos] != NULL) marker[pos]->setValue(x,y);
  }
  else if(isCommand("setMarkerLabelAlign("))
  {
    int pos,align;
    sscanf(command,"setMarkerLabelAlign(%d,%d",&pos,&align);
    if(pos<0 || pos>=nMarker) return -1;
    //xx setMarkerLabelAlign(marker[pos],align);
    if(marker[pos] != NULL) marker[pos]->setLabelAlignment((Qt::Alignment) align);
  }
  else if(isCommand("setMarkerLabel("))
  {
    int pos;
    QString text;
    sscanf( command, "setMarkerLabel(%d",&pos );
    if(getText(command, text) != 0 ) return -1;
    //xx setMarkerLabel(marker[pos], text );
    if(marker[pos] != NULL) marker[pos]->setLabel(text);
  }
  else if(isCommand("setMarkerPen("))
  {
    int pos,r,g,b,style;
    sscanf(command,"setMarkerPen(%d,%d,%d,%d,%d",&pos,&r,&g,&b,&style);
    if(pos<0 || pos>=nMarker) return -1;
    //xx setMarkerPen(marker[pos],QPen(QColor(r,g,b),0,(Qt::PenStyle) style));
    if(marker[pos] != NULL) marker[pos]->setLinePen(QPen(QColor(r,g,b)));
  }
  else if(isCommand("setMarkerFont("))
  {
    int pos,size,style;
    QString family;
    sscanf(command,"setMarkerFont(%d,%d,%d",&pos,&size,&style);
    if(pos<0 || pos>=nMarker) return -1;
    if(getText(command,family) != 0) return -1;
    //xx setMarkerFont(marker[pos],QFont(family,size,style));
  }
  else if(isCommand("setMarkerSymbol("))
  {
    int pos,symbol,r1,g1,b1,r2,g2,b2,w,h;
    sscanf(command,"setMarkerSymbol(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
                  &pos,&symbol,&r1,&g1,&b1,&r2,&g2,&b2,&w,&h);
    if(pos<0 || pos>=nMarker) return -1;
    //xx setMarkerSymbol(marker[pos], QwtSymbol((QwtSymbol::Style) symbol, QColor(r1,g1,b1), QColor(r2,g2,b2), QSize(w,h)));
    if(marker[pos] != NULL) marker[pos]->setSymbol(QwtSymbol((QwtSymbol::Style) symbol, QColor(r1,g1,b1), QColor(r2,g2,b2), QSize(w,h)));
  }
  else if(isCommand("insertLineMarker("))
  {
    int pos,pos2;
    QString text;
    sscanf(command,"insertLineMarker(%d,%d",&pos,&pos2);
    if(getText(command,text) != 0) return -1;
    if(pos<0 || pos>=nMarker) return -1;
    //xx marker[pos] = insertLineMarker(text, pos2);
    if(marker[pos] != NULL) delete marker[pos];
    marker[pos] = new QwtPlotMarker();
    marker[pos]->attach(this);
    if(marker[pos] != NULL) marker[pos]->setLabel(text);
  }
  else if( isCommand("setAxisScaleDraw("))
  {
    int pos;
    QString qtext;
    char text[1024];
    sscanf( command, "setAxisScaleDraw(%d",&pos );
    if( getText(command, qtext) != 0 ) return -1;
    if(qtext.length() < ((int) sizeof(text) -1))
    {
      strcpy(text,qtext.toUtf8());
    }
    else
    {
      strcpy(text,"text too long");
    }
    if(opt.arg_debug) printf("setAxisScaleDraw(%s)\n",text);
    setAxisScaleDraw( pos, new UserScaleDraw( text ));
  }
  else if( isCommand("setAxisScale("))
  {
    int pos;
    float min,max,step;
    sscanf( command, "setAxisScale(%d,%f,%f,%f",&pos ,&min, &max, &step);
    if(opt.arg_debug) printf("setAxisScale(%d,%f,%f,%f)\n",pos,min,max,step);
    setAxisScale(pos,min,max,step);
  }
  else
  {
    return -1;
  }

  return 0;
}
Ejemplo n.º 27
0
void MGui2d::draw(void)
{
	MRenderingContext * render = MGui::getInstance()->getRenderingContext();

	if(! isVisible())
		return;

	if(isPressed()) // pressed
	{  
		render->setColor4(getPressedColor());

		if(hasPressedTexture())
		{
			render->enableTexture();
			drawTexturedQuad(getPressedTexture());
		}
		else
		{
			render->disableTexture();
			drawQuad();
		} 
	}
	else if(isHighLight()) // highLight
	{
		render->setColor4(getHighLightColor());

		if(hasHighLightTexture()){
			render->enableTexture();
			drawTexturedQuad(getHighLightTexture());
		}
		else
		{
			render->disableTexture();
			drawQuad();
		}
	}
	else // normal	
	{
		render->setColor4(getNormalColor());

		if(hasNormalTexture())
		{
			render->enableTexture();
			drawTexturedQuad(getNormalTexture());
		}	  
		else
		{
			render->disableTexture();
			drawQuad();
		}
	}

	if(isDrawingText() && (getText() != NULL))
	{
		render->enableTexture();
		render->setColor4(getTextColor());
		getFont()->draw(getText(), getPosition(), getTextSize());
	}

	// draw shadows
	if(hasShadow())
	{
		render->pushMatrix();
		render->translate(MVector3(getPosition().x, getPosition().y, 0));

		drawShadow();

		render->popMatrix();
	}
}
Ejemplo n.º 28
0
//--------------------------------------------------
ofBuffer::operator string() const {
	return getText();
}
Ejemplo n.º 29
0
void Dynamic::draw(Painter* p) const
      {
      Font f("MScore1");
      f.setSize(12.0 * score()->spatium() / (SPATIUM20 * DPI));
      p->drawText(f, QPointF(), getText());
      }
//event ID must match enum ddDataType!!! this event was created on view
void ddTextColumnFigure::OnTextPopupClick(wxCommandEvent& event, ddDrawingView *view)
{
	wxTextEntryDialog *nameDialog=NULL;
	wxString tmpString;
	int answer;
	//DD-TODO: improve this
	switch(event.GetId())
	{
		case 0:  // Add Column
				getOwnerColumn()->getOwnerTable()->addColumn(new ddColumnFigure(wxString(wxT("NewColumn")),getOwnerColumn()->getOwnerTable()));
				break;
		case 1:  // Delete Column
				answer = wxMessageBox(wxT("Delete column: ") + getText(true) + wxT("?"), wxT("Confirm"),wxYES_NO, view);
				if (answer == wxYES)
				{
					getOwnerColumn()->getOwnerTable()->removeColumn(getOwnerColumn());
				}
				break;
		case 2:  //Rename Column
				nameDialog = new wxTextEntryDialog(view,wxT("Input column name"),wxT("Rename Column"),getText());   //DD-TODO: change for dialog like in option 17
				nameDialog->ShowModal();
				setText(nameDialog->GetValue());
				delete nameDialog;
				break;
		case 4:  //Not Null
				if(getOwnerColumn()->isNotNull())
					getOwnerColumn()->setColumnOption(null);
				else
					getOwnerColumn()->setColumnOption(notnull);
				break;
				//DD-TODO: add options fr fk, fkpk, fkuk
		case 6:	//pk
				if(getOwnerColumn()->isPrimaryKey())
				{
					getOwnerColumn()->setColumnKind(none);
				}else
				{	
					getOwnerColumn()->setColumnKind(pk);
					getOwnerColumn()->setColumnOption(notnull);
				}
				break;
		case 7:	//uk
				getOwnerColumn()->setColumnKind(uk,view);
				break;
		case 10:  // Submenu opcion 1
				columnType = dt_bigint;
				break;
		case 11:
				columnType = dt_boolean;
		break;
		case 12:
				columnType = dt_integer;
		break;
		case 13:
				columnType = dt_money;
		break;
		case 14:
				columnType = dt_varchar;
		break;
		case 15: //Call datatypes selector
				//DD-TODO: Add all types, improve and separate from quick access types
				columnType = (ddDataType) wxGetSingleChoiceIndex(wxT("Select column datatype"),wxT("Column Datatypes"),dataTypes(),view);
		break;
		case 17:
				tmpString=wxGetTextFromUser(wxT("Change name of Primary Key constraint:"),getOwnerColumn()->getOwnerTable()->getPkConstraintName(),getOwnerColumn()->getOwnerTable()->getPkConstraintName(),view);
				if(tmpString.length()>0)
					getOwnerColumn()->getOwnerTable()->setPkConstraintName(tmpString);
				break;
		case 18:
				answer = wxGetSingleChoiceIndex(wxT("Select Unique Key constraint to edit name"),wxT("Select Unique Constraint to edit name:"),getOwnerColumn()->getOwnerTable()->getUkConstraintsNames(),view);
				if(answer>=0)
				{
					tmpString=wxGetTextFromUser(wxT("Change name of Unique Key constraint:"),getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer),getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer),view);
					if(tmpString.length()>0)
						getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer)=tmpString;
				}
				break;
		case 20:
				answer = wxMessageBox(wxT("Delete Table: ") + getOwnerColumn()->getOwnerTable()->getTableName() + wxT("?"), wxT("Confirm"),wxYES_NO, view);
				if (answer == wxYES)
				{
					ddTableFigure *table = getOwnerColumn()->getOwnerTable();	
					//unselect table
					if(view->isFigureSelected(table))
					{
						view->removeFromSelection(table);
					}
					//drop foreign keys with this table as origin or destination
					table->processDeleteAlert(view);
					//drop table
					view->remove(table);
					if(table)
					{
						delete table;
					}						
				}

	}		
}