FlickrResult flickr_photos_notes_edit(FlickrClient *client,
				      const String *note_id,
				      const FlickrPhotoNote *note,
				      String *id)
{
  resetCursor(client);
  {
    notesAddArg p;
    const FlickrRequestArg reqarg[] = {
      { "note_id", note_id->m_start },
      { "note_x", makeIntString(client,note->x) },
      { "note_y", makeIntString(client,note->y) },
      { "note_w", makeIntString(client,note->w) },
      { "note_h", makeIntString(client,note->h) },
      { "note_text", note->text.m_start },
    };
    memset(&p,0,sizeof(notesAddArg));
    p.m_id = id;

    rsp_ParserCreate(&p.m_super);
    rsp_SetElementHandler(&p.m_super,note_StartElementHandler,noop_EndElementHandler);
  
    flickr_request_rsp(client, "flickr.photos.notes.edit",
		   p.m_super,
		   reqarg);

    rsp_ParserFree(&p.m_super);
    return p.m_super.m_code;
    /* FIXME requires authentication with write permission */
  }
}
예제 #2
0
//! Stop dragging
void CanvasView::stopDrag()
{
	if(_dragbtndown != NOTRANSFORM)
		viewport()->setCursor(Qt::OpenHandCursor);
	else
		resetCursor();
	_isdragging = NOTRANSFORM;
	_showoutline = true;
}
예제 #3
0
void CanvasView::keyReleaseEvent(QKeyEvent *event) {
	if(event->key() == Qt::Key_Space && !event->isAutoRepeat()) {
		event->accept();
		_dragbtndown = DRAG_NOTRANSFORM;
		if(_isdragging==DRAG_NOTRANSFORM)
			resetCursor();

	} else {
		QGraphicsView::keyReleaseEvent(event);

		if(event->key() == Qt::Key_Control) {
			if(_dragbtndown)
				viewport()->setCursor(Qt::OpenHandCursor);
			else
				resetCursor();
		}
	}
}
예제 #4
0
void LaunchSimulationBox::updateWidget()
{
    switch (mState) {
    case LaunchSimulationBox::Wait:
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_fraction(0.0);
        mProgressBar->set_text(_("Wait"));
        mCurrentTimeLabel->set_text("");
        break;
    case LaunchSimulationBox::Init:
        changeToWatchCursor();
        mPlay->set_sensitive(false);
        mStop->set_sensitive(false);
        mProgressBar->set_fraction(0.0);
        mProgressBar->set_text(_("The simulator initializes the models"));
        mCurrentTimeLabel->set_text("");
        break;
    case LaunchSimulationBox::Play:
        mPlay->set_sensitive(false);
        mStop->set_sensitive(true);
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Error:
        resetCursor();
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_text(_("Simulation error"));
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Finish:
        resetCursor();
        mPlay->set_sensitive(true);
        mStop->set_sensitive(false);
        mProgressBar->set_text(_("Finished"));
        updateCurrentTime();
        updateProgressBar();
        break;
    case LaunchSimulationBox::Close:
        break;
    }
}
예제 #5
0
void CanvasView::keyReleaseEvent(QKeyEvent *event) {
	if(event->key() == Qt::Key_Space && !event->isAutoRepeat()) {
		event->accept();
		_dragbtndown = NOTRANSFORM;
		if(_isdragging==NOTRANSFORM)
			resetCursor();
	} else {
		QGraphicsView::keyReleaseEvent(event);
	}
}
예제 #6
0
파일: u1.c 프로젝트: vternal3/OSkernal
main(int argc, char *argv[])
{ 
    int pid, cmd, i;
    char name[64];
    ucolor = 0;
    clearScreen(UMODE);
    printf("enter main() : argc = %d\n", argc);
    for (i=0; i<argc; i++)
        printf("argv[%d] = %s\n", i, argv[i]);

    while(1){
        pid = getpid();
        color = ucolor ? ucolor:0x000B + (pid % 5);// avoid black on black baground
        cmd?resetCursor(UMODE):1;
        printf("----------------------------------------------\n");
        printf("I am proc %din U mode: segment=%x\n", pid, (pid+1)*0x1000);
        show_menu();
        printf("Command ? ");
        getCurPos(UMODE);
        printf("                                                                      \n");
        setCurPos(ux_col,uy_row,UMODE);
        gets(name);
        clearScreenRegion(K_X_PRINT_OFFSET,80,U_Y_PRINT_OFFSET-1,24,UMODE);
        if (name[0]==0) 
            continue;

        cmd = find_cmd(name);
        
        getCurPos(UMODE);
        setCurPos(K_X_PRINT_OFFSET,U_Y_PRINT_OFFSET,UMODE);
        switch(cmd){
            case 0 : do_getpid();   break;
            case 1 : ps();          break;
            case 2 : chname();      break;
            case 3 : kmode();       break;
            case 4 : kswitch();     break;
            case 5 : wait();        break;
            case 6 : exit();        break;
            case 7 : fork();        break;
            case 8 : exec();        break;
            case 9 : ucolor = chcolor();     break;

            case 10: pipe();        break;
            case 11: pfd();         break;
            case 12: read_pipe();   break;
            case 13: write_pipe();  break;
            case 14: close_pipe();  break;
            
            default: invalid(name); break;
        }
        setCurPos(ux_col,uy_row,UMODE);
    }
}
예제 #7
0
void LaunchSimulationBox::run()
{
    mDialog->show_all();
    mDialog->run();
    setState(Close);

    mConnectionTimer.disconnect();

    mDialog->hide();

    resetCursor();

    if (mThread and mThreadRun) {
        mThread->join();
    }
}
예제 #8
0
static const char *separatedList(const char *separator,
			  FlickrClient *client,
			  const String *tickets,
			  unsigned int sz)
{
  unsigned int i=0;
  resetCursor(client);
  {
    char *p = client->m_extras_scratchpad+client->m_cursor;
    for(;i<sz;i++) {
      strcpy(p, tickets[i].m_start);
      if(i<sz-1)
	strcat(p,separator);
    }
    return client->m_extras_scratchpad+client->m_cursor;
  }
}
예제 #9
0
//Begins Text Input
void getText(char *buffer)
{
	int FINISHED = 0;
	clearScreen();
	setupInterrupts();
	initializeSprites();
	drawKeyboard();
	playBG = TRUE;	
	while(!FINISHED)
	{
		if(playBG && !BGplaying)
        {
            // play the bg music
            DMA[2].cnt |= DMA_ON;
            REG_TM1CNT |= TM_ON;
            startBG = vblankcount;
            BGplaying = TRUE;
            DMA[2].src = flute;
        }
		checkMovement();
		//Check Input and End Function if finished
		if(!endInput)
		{
			checkSelection(buffer);
			copyShadow();
			waitForVblank();
			moveSpriteToMem();
		}
		else
		{
			DMA[2].cnt &= ~DMA_ON;
            REG_TM1CNT &= ~TM_ON;
			playBG = FALSE;
			waitForVblank();
			FINISHED = 1;
			resetVariables();
			endInput = 0;
			resetCursor();
		}
		
	}
	clearScreen();
}
예제 #10
0
const char *commaSeparatedListOfDates(FlickrClient *client,
				      unsigned int dates_count,
				      time_t *dates)
{
  if(dates_count==0) return NULL;

  qsort(dates, dates_count, sizeof(time_t),&compareTime_t);

  resetCursor(client);
  {
    unsigned int i=0;
    char *p = client->m_extras_scratchpad+client->m_cursor;
    for(;i<dates_count;i++) {
      char buf[20];
      sprintf(&buf[0],"%ld",dates[i]);
      strcpy(p, &buf[0]);
      if(i<dates_count-1)
	strcat(p,",");
    }
    return client->m_extras_scratchpad+client->m_cursor;
  }
}
예제 #11
0
void pushCursor()
{
	oldCursor = cursor;
	resetCursor();
}
예제 #12
0
void CanvasView::setLocked(bool lock)
{
	_locked = lock;
	resetCursor();
}
예제 #13
0
파일: vid.c 프로젝트: vternal3/OSkernal
clearScreen(int m){
    clearScreenRegion(0,80,0,24,m);
    resetCursor(UMODE);
}
예제 #14
0
LvlScene::LvlScene(dataconfigs &configs, LevelData &FileData, QObject *parent) : QGraphicsScene(parent)
{
    setItemIndexMethod(NoIndex);

    //Pointerss
    pConfigs = &configs; // Pointer to Main Configs
    LvlData = &FileData; //Ad pointer to level data

    //Options
    opts.animationEnabled = true;
    opts.collisionsEnabled = true;
    grid = true;

    //Indexes
    index_blocks = pConfigs->index_blocks; //Applaying blocks indexes
    index_bgo = pConfigs->index_bgo;
    index_npc = pConfigs->index_npc;

    //Editing mode
    EditingMode = 0;
    EraserEnabled = false;
    PasteFromBuffer = false;
    disableMoveItems = false;
    DrawMode=false;

    //Editing process flags
    IsMoved = false;
    haveSelected = false;

    placingItem=0;

    pResizer = NULL;

    contextMenuOpened = false;

    //Events flags
    resetPosition = false;
    /*
    wasPasted = false;  //call to cursor reset to normal select
    doCopy = false;     //call to copy
    doCut = false;      //call to cut
    SyncLayerList = false; //Call to refresh layer list
    resetResizingSection = false; //Reset resizing applying buttons
    */
    cursor = NULL;
    resetCursor();

    //set dummy images if target not exist or wrong
    uBlockImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_block.gif");
    npcmask = QBitmap(QApplication::applicationDirPath() + "/" + "data/unknown_npcm.gif");
    uNpcImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_npc.gif");
    uNpcImg.setMask(npcmask);
    uBgoImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_bgo.gif");


    //set Default Z Indexes
    bgZ = -1000;
    blockZs = -150; // sizable blocks
    bgoZb = -100; // backround BGO

    blockZ = 1; // standart block
    playerZ = 5; //player Point

    bgoZf = 50; // foreground BGO

    npcZb = 20; // background NPC

    npcZs = 30; // standart NPC

    blockZl = 100; //LavaBlock
    npcZf = 150; // foreground NPC
    waterZ = 500;
    doorZ = 700;
    spaceZ1 = 1000; // interSection space layer
    spaceZ2 = 1020; // section Border

    //HistoryIndex
    historyIndex=0;

    historyChanged = false;

    //Locks
    lock_bgo=false;
    lock_block=false;
    lock_npc=false;
    lock_door=false;
    lock_water=false;

}
예제 #15
0
WldScene::WldScene(GraphicsWorkspace * parentView, dataconfigs &configs, WorldData &FileData, QObject *parent) : QGraphicsScene(parent)
{
    setItemIndexMethod(QGraphicsScene::NoIndex);

    //Pointerss
    pConfigs = &configs; // Pointer to Main Configs
    WldData = &FileData; //Ad pointer to level data
    _viewPort = parentView;

    //Options
    opts.animationEnabled = true;
    opts.collisionsEnabled = true;
    grid = true;

    //Indexes
    index_tiles = pConfigs->index_wtiles; //Applaying blocks indexes
    index_scenes = pConfigs->index_wscene;
    index_paths = pConfigs->index_wpaths;
    index_levels = pConfigs->index_wlvl;

    //Editing mode
    EditingMode = 0;
    EraserEnabled = false;
    PasteFromBuffer = false;
    disableMoveItems = false;
    DrawMode=false;

    mouseLeft=false; //Left mouse key is pressed
    mouseMid=false;  //Middle mouse key is pressed
    mouseRight=false;//Right mouse key is pressed

    mouseMoved=false; //Mouse was moved with right mouseKey

    MousePressEventOnly=false;
    MouseMoveEventOnly=false;
    MouseReleaseEventOnly=false;

    last_tile_arrayID=0;
    last_scene_arrayID=0;
    last_path_arrayID=0;
    last_level_arrayID=0;
    last_musicbox_arrayID=0;

    isSelectionDialog=false;

    //Editing process flags
    IsMoved = false;
    haveSelected = false;

    emptyCollisionCheck = false;

    placingItem=0;

    pResizer = NULL;

    contextMenuOpened = false;

    selectedPoint = QPoint(0, 0);
    selectedPointNotUsed=true;
    pointTarget = NULL;
    pointAnimation = NULL;
    pointImg=QPixmap(":/images/set_point.png");

    cursor = NULL;
    resetCursor();
    messageBox = NULL;

    //set dummy images if target not exist or wrong
    uTileImg    = Themes::Image(Themes::dummy_tile);
    uSceneImg   = Themes::Image(Themes::dummy_scenery);
    uPathImg    = Themes::Image(Themes::dummy_path);
    uLevelImg   = Themes::Image(Themes::dummy_wlevel);

    musicBoxImg = Themes::Image(Themes::dummy_musicbox);

    //Build animators for dummies
    SimpleAnimator * tmpAnimator;
        tmpAnimator = new SimpleAnimator(uTileImg, 0);
    animates_Tiles.push_back( tmpAnimator );
        tmpAnimator = new SimpleAnimator(uSceneImg, 0);
    animates_Scenery.push_back( tmpAnimator );
        tmpAnimator = new SimpleAnimator(uPathImg, 0);
    animates_Paths.push_back( tmpAnimator );
        tmpAnimator = new SimpleAnimator(uLevelImg, 0);
    animates_Levels.push_back( tmpAnimator );


    //set Default Z Indexes
    tileZ=0; // tiles
    sceneZ=5; // scenery
    pathZ=10; // paths
    levelZ=15; // levels
    musicZ=20; // musicboxes

    //HistoryIndex
    historyIndex=0;

    //Locks
    lock_tile=false;
    lock_scene=false;
    lock_path=false;
    lock_level=false;
    lock_musbox=false;

    connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    long padding=100000;

    QGraphicsRectItem * bigRect = addRect(-padding, -padding, padding*2, padding*2, QPen(Qt::transparent), QBrush(Qt::transparent));
    bigRect->setZValue(-10000000000);


    //Build edit mode classes
    WLD_ModeHand * modeHand = new WLD_ModeHand(this);
    EditModes.push_back(modeHand);

    WLD_ModeSelect * modeSelect = new WLD_ModeSelect(this);
    EditModes.push_back(modeSelect);

    WLD_ModeResize * modeResize = new WLD_ModeResize(this);
    EditModes.push_back(modeResize);

    WLD_ModeErase * modeErase = new WLD_ModeErase(this);
    EditModes.push_back(modeErase);

    WLD_ModePlace * modePlace = new WLD_ModePlace(this);
    EditModes.push_back(modePlace);

    WLD_ModeSquare * modeSquare = new WLD_ModeSquare(this);
    EditModes.push_back(modeSquare);

    WLD_ModeLine * modeLine = new WLD_ModeLine(this);
    EditModes.push_back(modeLine);

    WLD_ModeSetPoint * modeSetPoint = new WLD_ModeSetPoint(this);
    EditModes.push_back(modeSetPoint);

    WLD_ModeFill * modeFill = new WLD_ModeFill(this);
    EditModes.push_back(modeFill);

    CurrentMode = modeSelect;
    CurrentMode->set();
}
예제 #16
0
void OplogReader::connectToSyncSource(OperationContext* txn,
                                      const OpTime& lastOpTimeFetched,
                                      const OpTime& requiredOpTime,
                                      ReplicationCoordinator* replCoord) {
    const Timestamp sentinelTimestamp(duration_cast<Seconds>(Date_t::now().toDurationSinceEpoch()),
                                      0);
    const OpTime sentinel(sentinelTimestamp, std::numeric_limits<long long>::max());
    OpTime oldestOpTimeSeen = sentinel;

    invariant(conn() == NULL);

    while (true) {
        HostAndPort candidate = replCoord->chooseNewSyncSource(lastOpTimeFetched);

        if (candidate.empty()) {
            if (oldestOpTimeSeen == sentinel) {
                // If, in this invocation of connectToSyncSource(), we did not successfully
                // connect to any node ahead of us,
                // we apparently have no sync sources to connect to.
                // This situation is common; e.g. if there are no writes to the primary at
                // the moment.
                return;
            }

            // Connected to at least one member, but in all cases we were too stale to use them
            // as a sync source.
            error() << "too stale to catch up -- entering maintenance mode";
            log() << "our last optime : " << lastOpTimeFetched;
            log() << "oldest available is " << oldestOpTimeSeen;
            log() << "See http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember";
            auto status = replCoord->setMaintenanceMode(true);
            if (!status.isOK()) {
                warning() << "Failed to transition into maintenance mode: " << status;
            }
            bool worked = replCoord->setFollowerMode(MemberState::RS_RECOVERING);
            if (!worked) {
                warning() << "Failed to transition into " << MemberState(MemberState::RS_RECOVERING)
                          << ". Current state: " << replCoord->getMemberState();
            }
            return;
        }

        if (!connect(candidate)) {
            LOG(2) << "can't connect to " << candidate.toString() << " to read operations";
            resetConnection();
            replCoord->blacklistSyncSource(candidate, Date_t::now() + Seconds(10));
            continue;
        }
        // Read the first (oldest) op and confirm that it's not newer than our last
        // fetched op. Otherwise, we have fallen off the back of that source's oplog.
        BSONObj remoteOldestOp(findOne(rsOplogName.c_str(), Query()));
        OpTime remoteOldOpTime =
            fassertStatusOK(28776, OpTime::parseFromOplogEntry(remoteOldestOp));

        // remoteOldOpTime may come from a very old config, so we cannot compare their terms.
        if (!lastOpTimeFetched.isNull() &&
            lastOpTimeFetched.getTimestamp() < remoteOldOpTime.getTimestamp()) {
            // We're too stale to use this sync source.
            resetConnection();
            replCoord->blacklistSyncSource(candidate, Date_t::now() + Minutes(1));
            if (oldestOpTimeSeen.getTimestamp() > remoteOldOpTime.getTimestamp()) {
                warning() << "we are too stale to use " << candidate.toString()
                          << " as a sync source";
                oldestOpTimeSeen = remoteOldOpTime;
            }
            continue;
        }

        // Check if sync source contains required optime.
        if (!requiredOpTime.isNull()) {
            // This query is structured so that it is executed on the sync source using the oplog
            // start hack (oplogReplay=true and $gt/$gte predicate over "ts").
            auto ts = requiredOpTime.getTimestamp();
            tailingQuery(rsOplogName.c_str(), BSON("ts" << BSON("$gte" << ts << "$lte" << ts)));
            auto status = _compareRequiredOpTimeWithQueryResponse(requiredOpTime);
            if (!status.isOK()) {
                const auto blacklistDuration = Seconds(60);
                const auto until = Date_t::now() + blacklistDuration;
                warning() << "We cannot use " << candidate.toString()
                          << " as a sync source because it does not contain the necessary "
                             "operations for us to reach a consistent state: "
                          << status << " last fetched optime: " << lastOpTimeFetched
                          << ". required optime: " << requiredOpTime
                          << ". Blacklisting this sync source for " << blacklistDuration
                          << " until: " << until;
                resetConnection();
                replCoord->blacklistSyncSource(candidate, until);
                continue;
            }
            resetCursor();
        }

        // TODO: If we were too stale (recovering with maintenance mode on), then turn it off, to
        //       allow becoming secondary/etc.

        // Got a valid sync source.
        return;
    }  // while (true)
}
예제 #17
0
void OplogReader::tailCheck() {
    if (cursor.get() && cursor->isDead()) {
        log() << "old cursor isDead, will initiate a new one" << std::endl;
        resetCursor();
    }
}
예제 #18
0
void CanvasView::selectTool(tools::Type tool)
{
	_current_tool = _toolbox.get(tool);
	resetCursor();
}
예제 #19
0
	ProgressBar &draw()
	{
		resetCursor();
		drawBar();
		return *this;
	}
예제 #20
0
/*
 * key input
 */
void KkrBoardView::keyCursor(QKeyEvent *e)
{
    int newCol = m_curCol;
    int newRow = m_curRow;
    const auto mod = e->modifiers();
    CursorClue cl = m_curClue;

    if(mod == Qt::NoModifier) {
        switch(e->key()) {
        case Qt::Key_Up:    case Qt::Key_K:
            // cusor move within cell
            if(m_pBoardData->getCellType(m_curCol, m_curRow) == CellType::CellClue) {
                if(m_curClue == CursorClue::Down
                        && m_pBoardData->getClueRight(m_curCol, m_curRow) != CLOSED_CLUE) {
                    cl = CursorClue::Right;
                    break;
                }
            }

            // move to next cell
            if(m_curRow < 1)
                return;
            newRow = m_curRow-1;

            if(m_pBoardData->getCellType(newCol, newRow) == CellType::CellClue) {
                if(m_pBoardData->getClueDown(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Down;
                else if(m_pBoardData->getClueRight(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Right;
            }
            break;

        case Qt::Key_Down:  case Qt::Key_J:
            // cusor move within cell
            if(m_pBoardData->getCellType(m_curCol, m_curRow) == CellType::CellClue) {
                if(m_curClue == CursorClue::Right
                        && m_pBoardData->getClueDown(m_curCol, m_curRow) != CLOSED_CLUE) {
                    cl = CursorClue::Down;
                    break;
                }
            }

            // move to next cell
            if(m_curRow >= m_pBoardData->getNumRows()-1)
                return;
            newRow = m_curRow+1;

            if(m_pBoardData->getCellType(newCol, newRow) == CellType::CellClue) {
                if(m_pBoardData->getClueRight(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Right;
                else if(m_pBoardData->getClueDown(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Down;
            }
            break;

        case Qt::Key_Left:  case Qt::Key_H:
            // cusor move within cell
            if(m_pBoardData->getCellType(m_curCol, m_curRow) == CellType::CellClue) {
                if(m_curClue == CursorClue::Right
                        && m_pBoardData->getClueDown(m_curCol, m_curRow) != CLOSED_CLUE) {
                    cl = CursorClue::Down;
                    break;
                }
            }

            // move to next cell
            if(m_curCol < 1)
                return;
            newCol = m_curCol-1;

            if(m_pBoardData->getCellType(newCol, newRow) == CellType::CellClue) {
                if(m_pBoardData->getClueRight(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Right;
                else if(m_pBoardData->getClueDown(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Down;
            }
            break;

        case Qt::Key_Right: case Qt::Key_L:
            // cusor move within cell
            if(m_pBoardData->getCellType(m_curCol, m_curRow) == CellType::CellClue) {
                if(m_curClue == CursorClue::Down
                        && m_pBoardData->getClueRight(m_curCol, m_curRow) != CLOSED_CLUE) {
                    cl = CursorClue::Right;
                    break;
                }
            }

            // move to next cell
            if(m_curCol >= m_pBoardData->getNumCols()-1)
                return;
            newCol = m_curCol+1;

            if(m_pBoardData->getCellType(newCol, newRow) == CellType::CellClue) {
                if(m_pBoardData->getClueDown(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Down;
                else if(m_pBoardData->getClueRight(newCol, newRow) != CLOSED_CLUE)
                    cl = CursorClue::Right;
            }
            break;
        }
    }

    if(m_curCol != newCol || m_curRow != newRow || m_curClue != cl)
        resetCursor(newCol, newRow, cl);
}