void KeyboardLayoutWidget::setKeyboard(XkbComponentNamesPtr names) { release(); if (xkb) XkbFreeKeyboard(xkb, 0, TRUE); if (names) { xkb = XkbGetKeyboardByName (QX11Info::display(), XkbUseCoreKbd, names, 0, XkbGBN_GeometryMask | XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask | XkbGBN_ClientSymbolsMask | XkbGBN_IndicatorMapMask, FALSE); xkbOnDisplay = FALSE; } else { xkb = XkbGetKeyboard (QX11Info::display(), XkbGBN_GeometryMask | XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask | XkbGBN_SymbolsMask | XkbGBN_IndicatorMapMask, XkbUseCoreKbd); XkbGetNames (QX11Info::display(), XkbAllNamesMask, xkb); xkbOnDisplay = TRUE; } if (xkb == NULL) return; alloc (); init(); initColors(); generatePixmap(true); repaint(); }
//-------------------------------------------------------------- void testApp::setup(){ ofSetCircleResolution(50); ofSetWindowTitle("openframeworks gvf visualiser"); ofSetWindowShape(1024, 768); ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps. ofPoint wSize = ofGetWindowSize(); scrW = wSize.x; scrH = wSize.y; printf("w: %d h: %d\n", scrW, scrH); drawArea = ofRectangle(ofPoint(0, 0), ofGetWindowWidth(), ofGetWindowHeight()); currentGesture.setDrawArea(drawArea); isMouseDrawing = false; viewYRotation = 0; viewXRotation = 0; initializeGui(); initColors(); //leap: open the controller leap.open(); }
/* initGui must be called to initialize the structures used by the GUI */ int initGUI(int level) { int i; int n = CARD_NUMBER; char cardName[50]; if (i_initGUI) return(-1); /* check the flag of GUI initialized*/ markIndex = 0; /* mark color index*/ for (i=0; i<n; i++) { if (i<10) sprintf(cardName, "%s/0%1d.xpm", xpmdir, i); else sprintf(cardName, "%s/%2d.xpm", xpmdir, i); read_cmap(cardName, &(mycard[i])); } initLayout(level); rootColor = NULL; doColorTable(mycard, 0, n); initGraphics(); setBlack(& mycard[ EMPTY_CARD ]); initColors(); remapColor(mycard, 0, CARD_NUMBER-1); initWindow(); initImages(mycard, 0, CARD_NUMBER-1); drawMenu(); /* printf(" Nex Graphics done \n"); */ i_initGUI = 1; /* set the flag of GUI initialized*/ return(0); }
GoogleColorsPane::GoogleColorsPane(QWidget* _parent) : ColorsPane(_parent) { // // Рассчитаем фиксированный размер панели // const int width = (COLOR_RECT_SIZE * COLOR_RECT_COLUMNS) // ширина цветовых квадратов + (COLOR_RECT_SPACE * (COLOR_RECT_COLUMNS - 1)) // ширина оступов между квадратами + (PANEL_MARGIN * 2); // ширина полей const int height = (COLOR_RECT_SIZE * COLOR_RECT_ROWS) // высота цветовых квадратов + (COLOR_RECT_SPACE * (COLOR_RECT_ROWS + 3)) // высота отступов между ними (+3 т.к. между 1, 2 и 3 увеличенные отступы) + (PANEL_MARGIN * 2); // высота полей setFixedSize(width, height); // // Отслеживаем движения мыши // setMouseTracking( true ); // // Настроим курсор // setCursor(Qt::PointingHandCursor); initColors(); }
QColor KGlobalSettings::alternateBackgroundColor() { initColors(); KConfigGroup g( KGlobal::config(), "General" ); *alternateColor = calculateAlternateBackgroundColor( baseColor() ); return g.readColorEntry( "alternateBackground", alternateColor ); }
//-------------------------------------------------------------- void testApp::setup() { // frameRate = 25; frameRate = 60; ofSetVerticalSync( true ); ofSetFrameRate( frameRate ); ofSetCircleResolution( 100 ); screenGrab.setup( "movies/" ); // screenGrab.setPause( false ); tileSaver.init( 10, 0, true ); bDebug = false; bFullScreen = false; bSmooth = true; bDrawGhost = true; bPause = false; bUseCamera = true; initColors(); initCamera(); initLogo(); initCv(); initContours(); initBox2d(); initOpticalField(); initCirclePacker(); }
QColor KGlobalSettings::linkColor() { initColors(); if (!_linkColor) _linkColor = new QColor(0,0,238); KConfigGroup g( KGlobal::config(), "General" ); return g.readColorEntry( "linkColor", _linkColor ); }
// IMPORTANT: // This function should be get in sync with // KApplication::kdisplaySetPalette() QColor KGlobalSettings::highlightColor() { initColors(); if (!_selectBackground) _selectBackground = new QColor(103,141,178); KConfigGroup g( KGlobal::config(), "General" ); return g.readColorEntry( "selectBackground", _selectBackground ); }
KeyboardLayoutWidget::KeyboardLayoutWidget(QWidget* parent): QWidget(parent), ratio(1.0), trackModifiers(false ) { uint i = 0; for (i = 0; i < sizeof(deadMapData) / sizeof(deadMapData[0]); i ++) deadMap[deadMapData[i].dead] = deadMapData[i].nondead; xkb = XkbGetKeyboard (QX11Info::display(), XkbGBN_GeometryMask | XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask | XkbGBN_SymbolsMask | XkbGBN_IndicatorMapMask, XkbUseCoreKbd); if (!xkb) return; groupLevels = pGroupsLevels; XkbGetNames (QX11Info::display(), XkbAllNamesMask, xkb); l3mod = XkbKeysymToModifiers (QX11Info::display(), XK_ISO_Level3_Shift); XkbSelectEventDetails (QX11Info::display(), XkbUseCoreKbd, XkbIndicatorStateNotify, xkb->indicators->phys_indicators, xkb->indicators->phys_indicators); xkbOnDisplay = true; int mask = (XkbStateNotifyMask | XkbNamesNotifyMask | XkbControlsNotifyMask | XkbIndicatorMapNotifyMask | XkbNewKeyboardNotifyMask); XkbSelectEvents (QX11Info::display(), XkbUseCoreKbd, mask, mask); mask = XkbGroupStateMask | XkbModifierStateMask; XkbSelectEventDetails (QX11Info::display(), XkbUseCoreKbd, XkbStateNotify, mask, mask); mask = (XkbGroupNamesMask | XkbIndicatorNamesMask); XkbSelectEventDetails (QX11Info::display(), XkbUseCoreKbd, XkbNamesNotify, mask, mask); alloc (); init(); initColors(); setFocusPolicy(Qt::StrongFocus); }
KFinder::KFinder( QWidget *_parent, QStrList *_headers, QArray<int> *_sizes ) : QWidget( _parent ) { xOffset = 0; getOpenPixmap(); getClosePixmap(); buttonList.setAutoDelete( TRUE ); sizeList = 0L; currentSizeList = 0L; if ( _headers ) { sizeList = new unsigned int[ _headers->count() ]; currentSizeList = new unsigned int[ _headers->count() ]; } else { sizeList = new unsigned int[ 1 ]; currentSizeList = new unsigned int[ 1 ]; } if ( _headers ) for ( unsigned int i = 0; i < _headers->count(); i++ ) { KFinderButton *but; buttonList.append( but = new KFinderButton( _headers->at( i ), this ) ); connect( but, SIGNAL( pressed( KFinderButton* ) ), this, SLOT( slotButtonPressed( KFinderButton* ) ) ); if ( _sizes ) { currentSizeList[i] = (*_sizes)[i]; sizeList[ i ] = (*_sizes)[i]; } else { // Just a guess currentSizeList[i] = 150; sizeList[ i ] = 150; } } sort = 0; finderWin = new KFinderWin( this ); connect( finderWin->horizontalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( slotScrolled( int ) ) ); // Dirty Hack, sorry QScrollBar *s = (QScrollBar*)finderWin->horizontalScrollBar(); s->setTracking( TRUE ); initColors(); }
WindowsColorConsoleChannel::WindowsColorConsoleChannel(): _enableColors(true), _isFile(false), _hConsole(INVALID_HANDLE_VALUE) { //_hConsole = GetStdHandle(STD_OUTPUT_HANDLE); // check whether the console has been redirected //DWORD mode; //_isFile = (GetConsoleMode(_hConsole, &mode) == 0); initColors(); }
ImageSet applyTeamColors(const SdlSurface &baseImg) { initColors(); ImageSet ret; for (int i = 0; i < numTeams; ++i) { ret.emplace_back(sdlDeepCopy(baseImg)); applyColor(ret[i], i); } return ret; }
QColor KGlobalSettings::activeTitleColor() { #ifdef Q_WS_WIN return qt_colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)); #else initColors(); if (!_activeBackground) _activeBackground = new QColor(65,142,220); KConfigGroup g( KGlobal::config(), "WM" ); return g.readColorEntry( "activeBackground", _activeBackground); #endif }
void initApp() { initscr(); right_margin = COLS - 10; max_editable_lines = LINES - 18 - 1; helpInterval = 10000 + (random() % 10000); helpLength = 1; if (colorSupport) { initColors(); } }
static void initGC(void) { char buffer[32]; curGC = makeGC(0); /* Pick pen 1; set default pen width; set colors */ sprintf(buffer, "SP1%sPW%.3f%s\n", Sep, PENW, Sep); output(buffer); fontState.curfont = 1; setFont(&dfltFont); CurrentPen = 1; initColors(); }
void handle_init() { int i; srand(time(NULL)); initColors(); readConfig(); swapDigitShapes(); app_message_init(); initSplash(); window = window_create(); if (invertStatus) { window_set_background_color(window, GColorWhite); } else { window_set_background_color(window, GColorBlack); } window_stack_push(window, true); rootLayer = window_get_root_layer(window); mainLayer = layer_create(layer_get_bounds(rootLayer)); layer_add_child(rootLayer, mainLayer); layer_set_update_proc(mainLayer, updateMainLayer); for (i=0; i<NUMSLOTS; i++) { initSlot(i, mainLayer); } initDigitCorners(); animImpl.setup = NULL; animImpl.update = animateDigits; #ifdef PBL_PLATFORM_APLITE animImpl.teardown = destroyAnim; #else animImpl.teardown = NULL; #endif createAnim(); timer = app_timer_register(STARTDELAY, handle_timer, NULL); tick_timer_service_subscribe(MINUTE_UNIT, handle_tick); accel_tap_service_subscribe(handle_tap); lastBluetoothStatus = bluetooth_connection_service_peek(); bluetooth_connection_service_subscribe(handle_bluetooth); }
ofColor testApp::generateRandomColor() { ofColor c; if(colors.size() == 0) initColors(); int colorsRemaining = colors.size(); int index = ofRandom(0, colorsRemaining - 1); cout << index << endl; c = colors[index]; colors.erase(colors.begin() + index); return c; }
CAppPalette::CAppPalette() { CDC* dc = AfxGetMainWnd()->GetDC(); m_paletteDevice = ((dc->GetDeviceCaps(RASTERCAPS) & RC_PALETTE) != 0); m_logPalette = (LOGPALETTE*)&m_paletteBuf; m_logPalette->palVersion = 0x300; m_logPalette->palNumEntries = NumAppColors; m_paletteEntries = &(m_logPalette->palPalEntry[0]); m_editIndex = NumAppColors - 1; initColors(); }
int main(int argc, char** argv) { initColors(); preprocesareInformatii(); triangulate(); glutInit(&argc, argv); // Initialize GLUT glutInitWindowSize(480, 480); // Set the window's initial width & height glutInitWindowPosition(50, 50); // Position the window's initial top-left corner glutCreateWindow("OPENGL_2D"); // Create window with the given title glutDisplayFunc(display); // Register callback handler for window re-paint event glutReshapeFunc(reshape); // Register callback handler for window re-size event initGL(); // Our own OpenGL initialization glutMainLoop(); // Enter the event-processing loop return 0; }
int main(int argc, char *argv[]) { TCODConsole::initRoot(HM_WIDTH,HM_HEIGHT,"height map tool",false); guicon = new TCODConsole(HM_WIDTH,HM_HEIGHT); guicon->setKeyColor(TCODColor(255,0,255)); Widget::setConsole(guicon); TCODSystem::setFps(25); initColors(); buildGui(); hm = new TCODHeightMap(HM_WIDTH,HM_HEIGHT); hmold = new TCODHeightMap(HM_WIDTH,HM_HEIGHT); rnd=new TCODRandom(seed); noise=new TCODNoise(2,rnd); uint8 fade=50; bool creditsEnd=false; while ( ! TCODConsole::isWindowClosed() ) { render(); guicon->setDefaultBackground(TCODColor(255,0,255)); guicon->clear(); Widget::renderWidgets(); if (! creditsEnd ) { creditsEnd=TCODConsole::renderCredits(HM_WIDTH-20,HM_HEIGHT-7,true); } if ( Widget::focus ) { if ( fade < 200 ) fade += 20; } else { if ( fade > 80 ) fade -= 20; } TCODConsole::blit(guicon,0,0,HM_WIDTH,HM_HEIGHT,TCODConsole::root,0,0,fade/255.0f,fade/255.0f); TCODConsole::flush(); TCOD_key_t key; TCOD_mouse_t mouse; TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS|TCOD_EVENT_MOUSE,&key,&mouse); Widget::updateWidgets(key,mouse); switch(key.c) { case '+' : (new AddLevelOperation((mapmax-mapmin)/50))->run(); break; case '-' : (new AddLevelOperation(-(mapmax-mapmin)/50))->run(); break; default:break; } switch(key.vk) { case TCODK_PRINTSCREEN : TCODSystem::saveScreenshot(NULL); break; default:break; } } return 0; }
/////////////// /////// Pieces table Implementation /////// PiecesTable::PiecesTable(QWidget* parent, const char* name ) : QTableView(parent, name), _menu(0), _randomized(false), _dialog( 0l ) { // setup table view setFrameStyle(StyledPanel | Sunken); setBackgroundMode(NoBackground); setMouseTracking(true); setNumRows(4); setNumCols(4); // init arrays readConfig(); initColors(); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if (key == 'l' || key == 'L'){ // get ready to learn a new gesture // (will not start to learn a new gesture // if the user is in the middle of a gesture // or if the state is already STATE_LEARNING) if(gvfh.get_state() != STATE_LEARNING && !isMouseDrawing) { gvfh.gvf_learn(); } } else if(key == 'c' || key == 'C') { gvfh.gvf_clear(); initColors(); } else if (key == 'r' || key == 'R') { rotate = !rotate; viewYRotation = 0; viewXRotation = 0; } else if (key == 'f' || key == 'F') { ofToggleFullscreen(); } else if (key == '1') { displayParticles = !displayParticles; } else if (key == '2') { displayTemplate = !displayTemplate; } else if (key == '3') { displayEstimatedGesture = !displayEstimatedGesture; } else if (key == '4') { displayCurrentGesture = !displayCurrentGesture; } }
PiecesTable::PiecesTable(TQWidget* parent, const char* name ) : QtTableView(parent, name), _activeRow(-1), _activeCol(-1), _randomized(false) { _menu = new TQPopupMenu(this); _menu->insertItem(i18n("R&andomize Pieces"), this, TQT_SLOT(randomizeMap())); _menu->insertItem(i18n("&Reset Pieces"), this, TQT_SLOT(resetMap())); _menu->adjustSize(); // setup table view setFrameStyle(StyledPanel | Sunken); setBackgroundMode(NoBackground); setMouseTracking(true); setNumRows(4); setNumCols(4); // init arrays initMap(); initColors(); }
/** The Constructor - your first job! */ Config::Config(QWidget *parent) : BConfig(parent), loadedPal(0), infoIsManage(false) { /** Setup the UI and geometry */ ui.setupUi(this); /** Some special stuff */ QEvent event(QEvent::PaletteChange); changeEvent(&event); ui.info->setOpenExternalLinks( true ); /** i've an internet link here */ ui.info->setMinimumWidth(160); const QPalette::ColorGroup groups[3] = { QPalette::Active, QPalette::Inactive, QPalette::Disabled }; ui.info->viewport()->setAutoFillBackground(false); QPalette pal = ui.info->palette(); for (int i = 0; i < 3; ++i) { pal.setColor(groups[i], QPalette::Base, pal.color(groups[i], QPalette::Window)); pal.setColor(groups[i], QPalette::Text, pal.color(groups[i], QPalette::WindowText)); } ui.info->setPalette(pal); /** set up color page, not of interest */ QColorDialog *cd = new QColorDialog(this); cd->hide(); connect ( ui.colorButton, SIGNAL(clicked()), cd, SLOT(show()) ); connect ( ui.colorButton, SIGNAL(clicked()), cd, SLOT(raise()) ); ui.role_window->installEventFilter(this); ui.role_windowText->installEventFilter(this); ui.role_highlight->installEventFilter(this); ui.role_highlightedText->installEventFilter(this); QTimer::singleShot( 50, this, SLOT(initColors()) ); /** fill some comboboxes, not of interest */ QSettings csettings("BE", "Config"); QStringList strList = csettings.value ( "UserPwChars", QStringList() ).toStringList(); ushort n; foreach (QString str, strList) { n = str.toUShort(0,16); if (n) ui.pwEchoChar->addItem(QChar(n), n); }
int main(int argc, char *argv[]) { // Set up rotation matrix for entire scene resetRotationMatrix(); // Initialize cube positions array to default positions // if positions[3] == 6, this means cube instance #6 is at position #3. for (int i=0; i<NUM_CUBES; i++) positions[i] = i; initColors(); // Initialize window glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(winWidth, winHeight); glutInitContextVersion(3, 2); glutInitContextProfile(GLUT_CORE_PROFILE); glutCreateWindow("Rubik's Cube"); glewExperimental = GL_TRUE; glewInit(); init(); // Register callback functions glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutMouseFunc(mouseButton); glutMotionFunc(mouseMotion); glutIdleFunc(idle); srand(time(0)); long numRotations; if (argc > 1) { numRotations = strtol(argv[1],0,10); if (errno == ERANGE) std::cerr << "Invalid argument" << std::endl; else randomRotations(numRotations); } glutMainLoop(); return 0; }
void testApp::loadGestures(ofFileDialogResult dialogResult) { ofxXmlSettings file; if(!file.loadFile(dialogResult.filePath)) return; gvfh.gvf_clear(); initColors(); int gestureCount = file.getNumTags("GESTURE"); if(gestureCount < 1) return; cout << gestureCount << " gestures." << endl; for(int i = 0; i < gestureCount; i++) { file.pushTag("GESTURE", i); ofPoint p; p.x = file.getValue("INIT_POINT:X", (double)-1); p.y = file.getValue("INIT_POINT:Y", (double)-1); file.pushTag("POINTS"); int pointCount = file.getNumTags("PT"); if(pointCount < 1) return; gvfh.gvf_learn(); gvfh.addTemplateGesture(p, generateRandomColor()); for(int j = 0; j < pointCount; j++) { p.x = file.getValue("PT:X", (double)-1, j); p.y = file.getValue("PT:Y", (double)-1, j); gvfh.gvf_data(p); } file.popTag(); file.popTag(); gvfh.gvf_follow(); } }
ColorManager::ColorManager() { m_colorMaps.resize(TOTAL_COLORS); initColors(); createNames(); m_uneditableColors = 3; // Make sure these are in the same order as in PredefinedTypes // These indicate the number of ramps for each ramp type setNumColorRamps(SEQUENTIAL, 7); setNumColorRamps(DIVERGING, 6); setNumColorRamps(QUALITATIVE, 5); setNumColorRamps(LINK_REL2, 3); setNumColorRamps(LINK_CON2, 2); setNumColorRamps(LINK_REL5, 2); m_strat = ORDER; }
/** * @brief Initialize the newt library * @return int - 0 for success, else < 0 */ int newtInit(void) { char * MonoValue, * MonoEnv = "NEWT_MONO"; const char *lang; int ret; if ((lang = getenv("LC_ALL")) == NULL) if ((lang = getenv("LC_CTYPE")) == NULL) if ((lang = getenv("LANG")) == NULL) lang = ""; /* slang doesn't support multibyte encodings except UTF-8, avoid character corruption by redrawing the screen */ if (strstr (lang, ".euc") != NULL) trashScreen = 1; (void) strlen(ident); SLutf8_enable(-1); SLtt_get_terminfo(); SLtt_get_screen_size(); MonoValue = getenv(MonoEnv); if ( MonoValue != NULL ) SLtt_Use_Ansi_Colors = 0; if ((ret = SLsmg_init_smg()) < 0) return ret; if ((ret = SLang_init_tty(0, 0, 0)) < 0) return ret; initColors(); newtCursorOff(); initKeymap(); SLsignal_intr(SIGWINCH, handleSigwinch); SLang_getkey_intr_hook = getkeyInterruptHook; return 0; }
struct hvGfx *oneTrackMakeTrackHvg(char *trackName, char *gifName) /* Set up a single track, load it, draw it and return the graphics object: */ { char *visStr = cloneString( cartUsualString(cart, trackName, hTrackOpenVis(trackName)) ); cartSetString(cart, trackName, visStr); struct trackDb *tdb = hTrackDbForTrack(trackName); tdbSortPrioritiesFromCart(cart, &tdb); if(tdb->subtracks) tdbSortPrioritiesFromCart(cart, &(tdb->subtracks)); struct track *tg = trackFromTrackDb(tdb); tg->visibility = hTvFromString(visStr); trackList = tg; tg->loadItems(tg); limitVisibility(tg); int height = tg->totalHeight(tg, tg->limitedVis); struct hvGfx *hvg = hvGfxOpenGif(insideWidth, height, gifName, TRUE); initColors(hvg); findTrackColors(hvg, tg); /* This is the only image we'll draw, so offset=(0,0). */ int xOff = 0, yOff = 0; MgFont *font = tl.font; hvGfxSetClip(hvg, xOff, yOff, insideWidth, tg->height); tg->drawItems(tg, winStart, winEnd, hvg, xOff, yOff, insideWidth, font, hvGfxFindRgb(hvg, &tg->color), tg->limitedVis); /* MEMORY LEAK -- Freeing items slows hgTracks down unacceptably so we * don't do it, and it has become vestigial. For example, wigFreeItems * is a no-op because the author noted that it is never invoked. */ #ifdef SLOW tg->freeItems(tg); #endif /* SLOW */ return hvg; }
/** * Displays a title screen in an infinite loop. The intent is that this will be called from a * pthread. */ void displayTitleScreen(WINDOW *window) { initColors(); pthread_mutex_init(&mutex, NULL); int maxX = 0; int maxY = 0; getmaxyx(window, maxY, maxX); clear(); printFolly(maxX); attron(COLOR_PAIR(WHITE_ON_BLACK)); mvprintw(14, (maxX - 44)/2, "Press ENTER to continue..."); attroff(COLOR_PAIR(WHITE_ON_BLACK)); move(0, 0); refresh(); usleep(100000); unsigned int randomSeed = (unsigned int)time(NULL); initRandomSeed(randomSeed); int *arg = malloc(sizeof(*arg)); *arg = maxX; pthread_create(&ellipsisThread, NULL, cycleEllipsis, arg); pthread_create(&wanderThread, NULL, cycleWander, arg); while (1) { pthread_mutex_lock(&mutex); move(0, 0); refresh(); pthread_mutex_unlock(&mutex); usleep(10000); } }