Exemple #1
0
void do_autoscale_set(int gno, int setno)
{
    if (isactive_set(gno, setno))
    {
        defaultsetgraph(gno, setno);
        default_axis(gno, g[gno].auto_type, X_AXIS);
        default_axis(gno, g[gno].auto_type, ZX_AXIS);
        default_axis(gno, g[gno].auto_type, Y_AXIS);
        default_axis(gno, g[gno].auto_type, ZY_AXIS);
        update_all(gno);
        drawgraph();
    }
}
//Встановлює з'єднання з віддаленою БД
void MainWindow::connect_to_db(){
    db = QSqlDatabase::addDatabase("QMYSQL", "db");
    db.setHostName(host);
    db.setDatabaseName("nonogram");
    db.setUserName(user_name);
    db.setPassword("admin");
    connected = db.open();
    if(connected){
        update_all();

    }else{
        QMessageBox::critical(NULL, "Не вдалося підключитися до бази даних!", db.lastError().text());
    }
}
void linux_unicast_router::check_initial_interfaces() {
    do_dump(RTM_GETLINK);

    for (std::vector<interface_desc>::const_iterator i = _interfaces.begin();
            i != _interfaces.end(); ++i) {
        _install_interface(*i);
    }

    _interfaces.clear();

    do_dump(RTM_GETROUTE);

    update_all();
}
Exemple #4
0
static void destroy_nonl_frame(Widget w, XtPointer client_data, XtPointer call_data)
{
    int value = (int) client_data;
    
    if (value == NONL_CANCEL) {
    	if (nlloadset != -1) {
	    killset(cg, nlloadset);
    	}
	update_all(cg);
    	drawgraph();
    }
    
    nlloadset = -1;
    XtUnmanageChild(nonl_frame);
}
void Eeg_lead_leds::begin()
{
	// set up the pins for the LEDs
	pinMode(IPIN_LED_ENABLE, OUTPUT);
	pinMode(PIN_LED_LATCH, OUTPUT);
	pinMode(IPIN_LED_CLEAR, OUTPUT);
	pinMode(PIN_LED_CLK, OUTPUT);
	pinMode(PIN_LED_SERIAL, OUTPUT);

	digitalWrite(PIN_LED_LATCH, LOW);
	digitalWrite(PIN_LED_CLK, LOW);
	digitalWrite(IPIN_LED_ENABLE, LOW);

	// set LEDs to leds_state (probably 0, all off)
	update_all();
}
Exemple #6
0
void Histogram_gui::get_data_from(  GsTLGridProperty* prop, 
                                    const GsTLGridRegion* region ) {
  if( !prop ) return;
  Temporary_propRegion_Selector regionSelector(region,prop);
 

  histogram_->set_data( prop->begin(), prop->end() );
  histogram_->bins( control_panel_->bins_count() );

  control_panel_->set_clipping_values( histogram_->low_clip(),
                                       histogram_->high_clip() );

  plot_->setAxisTitle( QwtPlot::xBottom, prop->name().c_str() );

  update_all();
}
Exemple #7
0
bool Display::init(void)
{
    memset(&_flags, 0, sizeof(_flags));

    _healthy = hw_init();

    if (!_healthy) {
        return false;
    }

    // update all on display
    update_all();
    hw_update();

    return true;
}
Exemple #8
0
Icon::Icon(char *icon_config) : Fl_Widget(0, 0, ICONSIZE, ICONSIZE)
{
    if(!popup) {
        popup = new Fl_Menu_Button(0, 0, 0, 0);
        if(popup->parent())
            popup->parent()->remove(popup);
        popup->parent(0);
        popup->type(Fl_Menu_Button::POPUP3);
        popup->begin();

        Fl_Item *open_item = new Fl_Item(_("&Open"));
        open_item->callback(menu_cb, 1);
        open_item->x_offset(12);

        Fl_Item *delete_item = new Fl_Item(_("&Delete"));
        delete_item->callback(menu_cb, 3);
        delete_item->x_offset(12);

	   new Fl_Divider();

        Fl_Item *property_item = new Fl_Item(_("&Properties"));
        property_item->callback(menu_cb, 4);
        property_item->x_offset(12);

        popup->end();
    }

    cfg = new Fl_Config(icon_config);

    icon_im = 0;
    micon = 0;

    cfg->set_section("Desktop Entry");
    cfg->read("X", x_position, 100);
    cfg->read("Y", y_position, 100);
    position(x_position, y_position);

//    label_font(FL_HELVETICA);
    label(icon_name);
    align(FL_ALIGN_BOTTOM|FL_ALIGN_WRAP);
    tooltip(icon_name);
    box(FL_NO_BOX);

    update_all();
    desktop->begin();
}
Exemple #9
0
void autoscale_set(int gno, int setno, int axis)
{
    if (isactive(gno, setno))
    {
        switch (axis)
        {
        case -3:
            defaultsetgraph(gno, setno);
            default_axis(gno, g[gno].auto_type, X_AXIS);
            default_axis(gno, g[gno].auto_type, ZX_AXIS);
            default_axis(gno, g[gno].auto_type, Y_AXIS);
            default_axis(gno, g[gno].auto_type, ZY_AXIS);
            break;
        case -2:
            defaultx(gno, setno);
            default_axis(gno, g[gno].auto_type, X_AXIS);
            default_axis(gno, g[gno].auto_type, ZX_AXIS);
            break;
        case -1:
            defaulty(gno, setno);
            default_axis(gno, g[gno].auto_type, Y_AXIS);
            default_axis(gno, g[gno].auto_type, ZY_AXIS);
            break;
        default:
            if (axis % 2)
            {
                defaulty(gno, setno);
            }
            else
            {
                defaultx(gno, setno);
            }
            default_axis(gno, g[gno].auto_type, axis);
            break;
        }
        update_all(gno);
    }
    else
    {
        errwin("Set not active!");
    }
}
Exemple #10
0
/*
 * Start up editor using GR_EDITOR variable
 * Note the change to the GR_EDITOR variable: If it requires a text 
 * terminal it must provide it explicitly with an xterm -e prefix 
 */
void do_ext_editor(Widget w, XtPointer client_data, XtPointer call_data)
{
    char buf[256], tbuf[256], *fname, *mktemp(char *);
    char ebuf[256], *s;
    int setno = GetSelectedSet(editp_set_item), curgraph=cg;
    if (setno == SET_SELECT_ERROR) {
        errwin("No set selected");
        return;
    }

    strcpy(tbuf, "/tmp/xmgrXXXXXX");
    fname = mktemp(tbuf);

	if( setno == SET_SELECT_NEXT ){ 
		if( (setno=nextset(curgraph)) == -1 ){ 
        	errwin("Not enough sets");
       	 	return;
    	}
		activateset( curgraph, setno );
		do_writesets(curgraph, setno, 0, fname, sformat);
	} else
		do_writesets(curgraph, setno, 0, fname, sformat);

    if ((s = getenv("GR_EDITOR")) != NULL) {
    	strcpy(ebuf, s);
    } else {
    	strcpy(ebuf, "xterm -e vi");
    }
    sprintf(buf, "%s %s", ebuf, fname);
    system(buf);
    if( isactive_set( curgraph, setno ) ) {
		softkillset( curgraph, setno );	
        getdata(curgraph, fname, SOURCE_DISK, dataset_type( curgraph, setno ) );
	} else {
		setcomment( curgraph, setno, "editor" );
        getdata(curgraph, fname, SOURCE_DISK, SET_XY );
	}
    sprintf(buf, "rm %s", fname);
    system(buf);
	update_all( curgraph );
	doforce_redraw();
}
void RackViewFrame::track_list_changed_slot() {


	int tracks = editor->get_song()->get_track_count();
	
	if (tracks==0) {
	
		selected_track=-1;
	} else { 
	
		if (selected_track<0)
			selected_track=0;
		
		if (selected_track>=tracks)
			selected_track=tracks-1;
	}
	
	update_all();
	
}
Exemple #12
0
custom_tree::custom_tree(QWidget *parent)
	: QTreeWidget(parent)
{
	add_action_ = new QAction(QIcon("icons:add.png"), tr("Add new friend"), this);
    connect(add_action_, SIGNAL(triggered()), SLOT(add()));

    edit_action_ = new QAction(QIcon("icons:edit.png"), tr("Edit selected friend"), this);
    connect(edit_action_, SIGNAL(triggered()), SLOT(edit_selected()));

    remove_action_ = new QAction(QIcon("icons:remove.png"), tr("Remove selected"), this);
    connect(remove_action_, SIGNAL(triggered()), SLOT(remove_selected()));

    chat_action_ = new QAction(QIcon("icons:view-refresh.png"), tr("chat whit"), this);
    connect(chat_action_, SIGNAL(triggered()), SLOT(chat_selected()));

    update_all_action_ = new QAction(QIcon("icons:download.png"), tr("Update all servers"), this);
    connect(update_all_action_, SIGNAL(triggered()), SLOT(update_all()));

    wait_for_friend_action_ = new QAction(QIcon("icons:chronometer.png"), tr("Wait for the friend"), this);
    connect(wait_for_friend_action_, SIGNAL(triggered()), SLOT(wait_for_friend()));

	call_action_ = new QAction(QIcon("icons:chronometer.png"), tr("call to"), this);
    connect(call_action_, SIGNAL(triggered()), SLOT(call_selected()));


   acts << edit_action_
        << remove_action_
		<< chat_action_
		<< call_action_
        << add_separator_action(this,"")
		<< add_action_;

	
	setContextMenuPolicy( Qt::DefaultContextMenu );

	_status_icons.insert("status-green.png", QPixmap("icons:status-green.png"));
	_status_icons.insert("status-orange.png", QPixmap("icons:status-orange.png"));
	_status_icons.insert("status-red.png", QPixmap("icons:status-red.png"));
	_status_icons.insert("status-offline.png", QPixmap("icons:status-offline.png"));
	_status_icons.insert("status-green.png", QPixmap("icons:status-green.png"));
}
//********************************************************
void WordsEdit::merge_file()
{

  WordList w = WordList();
  Q3FileDialog *f = new Q3FileDialog(0,"Open",true);  
  const char *filters[] = {"words.tok","*.tok","All files (*)",NULL};
  
  f->setFilters(filters);
  f->setCaption("Open");
  f->setMode(Q3FileDialog::ExistingFile);
  f->setDir(game->dir.c_str());
  if ( f->exec() == QDialog::Accepted ) {
    if ( !f->selectedFile().isEmpty() ){
      int ret = w.read((char *)f->selectedFile().latin1());
      if(ret)return ;
      wordlist->merge(w);
      update_all();
    }
  }
  
}
Exemple #14
0
void autoscale_graph(int gno, int axis)
{
    if (activeset(gno))
    {
        switch (axis)
        {
        case -3:
            defaultgraph(gno);
            default_axis(gno, g[gno].auto_type, X_AXIS);
            default_axis(gno, g[gno].auto_type, ZX_AXIS);
            default_axis(gno, g[gno].auto_type, Y_AXIS);
            default_axis(gno, g[gno].auto_type, ZY_AXIS);
            break;
        case -2:
            defaultx(gno, -1);
            default_axis(gno, g[gno].auto_type, X_AXIS);
            default_axis(gno, g[gno].auto_type, ZX_AXIS);
            break;
        case -1:
            defaulty(gno, -1);
            default_axis(gno, g[gno].auto_type, Y_AXIS);
            default_axis(gno, g[gno].auto_type, ZY_AXIS);
            break;
        default:
            if (axis % 2)
            {
                defaulty(gno, -1);
            }
            else
            {
                defaultx(gno, -1);
            }
            default_axis(gno, g[gno].auto_type, axis);
            break;
        }
        update_all(gno);
    }
}
void AudioInputI2SQuad::isr(void)
{
	uint32_t daddr, offset;
	const int16_t *src;
	int16_t *dest1, *dest2, *dest3, *dest4;

	//digitalWriteFast(3, HIGH);
	daddr = (uint32_t)(dma.TCD->DADDR);
	dma.clearInterrupt();

	if (daddr < (uint32_t)i2s_rx_buffer + sizeof(i2s_rx_buffer) / 2) {
		// DMA is receiving to the first half of the buffer
		// need to remove data from the second half
		src = (int16_t *)&i2s_rx_buffer[AUDIO_BLOCK_SAMPLES];
		if (update_responsibility) update_all();
	} else {
		// DMA is receiving to the second half of the buffer
		// need to remove data from the first half
		src = (int16_t *)&i2s_rx_buffer[0];
	}
	if (block_ch1) {
		offset = block_offset;
		if (offset <= AUDIO_BLOCK_SAMPLES/2) {
			block_offset = offset + AUDIO_BLOCK_SAMPLES/2;
			dest1 = &(block_ch1->data[offset]);
			dest2 = &(block_ch2->data[offset]);
			dest3 = &(block_ch3->data[offset]);
			dest4 = &(block_ch4->data[offset]);
			for (int i=0; i < AUDIO_BLOCK_SAMPLES/2; i++) {
				*dest1++ = *src++;
				*dest3++ = *src++;
				*dest2++ = *src++;
				*dest4++ = *src++;
			}
		}
	}
	//digitalWriteFast(3, LOW);
}
Exemple #16
0
void arrange_graphs(int grows, int gcols)
{
    int i, j;
    double dvx = 0.9 / gcols;
    double dvy = 0.9 / grows;
    int gtmp = 0;

    if (gcols != 1 || grows != 1) {
	for (i = 0; i < gcols; i++) {
	    for (j = 0; j < grows; j++) {
		g[gtmp].v.xv1 = 0.1 + i * dvx;
		g[gtmp].v.xv2 = 0.1 + ((i + 1) * dvx);
		g[gtmp].v.xv2 -= 0.07;
		g[gtmp].v.yv1 = 0.1 + j * dvy;
		g[gtmp].v.yv2 = 0.1 + ((j + 1) * dvy);
		g[gtmp].v.yv2 -= 0.07;
		set_graph_active(gtmp);
		update_all(cg);
		gtmp++;
	    }
	}
    }
}
Exemple #17
0
int main(int argc, char** argv)
{
    ros::init(argc, argv, "uav_tf");
    ros::NodeHandle nh_;
    ros::Subscriber height_sub;
    ros::Subscriber imu_sub;
    ros::Subscriber uav_status_sub;
    ros::Subscriber sonar_sub = nh_.subscribe("/sonar_height", 1, sonarCallback);
    tf::TransformBroadcaster tf_broadcaster;

    height_sub = nh_.subscribe<sensor_msgs::Range> ("/pressure_height", 1, heightCallback);
    imu_sub = nh_.subscribe<sensor_msgs::Imu> ("/imu", 1, imuCallback);
    uav_status_sub = nh_.subscribe<flight_control::UAV_Status> ("/uav_status", 1, uavStatusCallback);

    // getting frequency
    nh_.param<double> ("loop_rate", frequency, 40.0);
    ros::Rate loop_rate(frequency);
    ROS_INFO("Looping at %fHz.", frequency);

    nh_.param<int> ("window_size_nick", windowSizeNick, 3);
    nh_.param<double> ("threshold_nick", thresholdNick, 15.0);
    nickFilter = new WindowMeanFilter(windowSizeNick, thresholdNick);

    nh_.param<int> ("window_size_roll", windowSizeRoll, 3);
    nh_.param<double> ("threshold_roll", thresholdRoll, 15.0);
    rollFilter = new WindowMeanFilter(windowSizeRoll, thresholdRoll);

    ROS_INFO_STREAM("Running!");

    // loop
    while (nh_.ok())
    {
        update_all(tf_broadcaster);
        loop_rate.sleep();
        ros::spinOnce();
    }
}
Exemple #18
0
bool Display::init(void)
{
    // exit immediately if already initialised
    if (_driver != nullptr) {
        return true;
    }

    // initialise driver
    for(uint8_t i=0; i<8 && _driver == nullptr; i++) {
        if (! (I2C_BUS_PROBE_MASK & (1<<i))) {
            continue;
        }
        switch (pNotify->_display_type) {
        case DISPLAY_SSD1306: {
            _driver = Display_SSD1306_I2C::probe(std::move(hal.i2c_mgr->get_device(i, NOTIFY_DISPLAY_I2C_ADDR)));
            break;
        }
        case DISPLAY_SH1106: {
            _driver = Display_SH1106_I2C::probe(std::move(hal.i2c_mgr->get_device(i, NOTIFY_DISPLAY_I2C_ADDR)));
            break;
        }
        case DISPLAY_OFF:
        default:
            break;
        }
    }

    if (_driver == nullptr) {
        return false;
    }

    // update all on display
    update_all();
    _driver->hw_update();

    return true;
}
static void initialise_ui(void)
{
  GFont bigNumbers, ltlNumbers, regText, bigText;
  
  s_window = window_create();
  window_set_background_color(s_window, GColorWhite);
  #ifndef PBL_SDK_3
    window_set_fullscreen(s_window, true);
  #endif
  
  //-- colors --
  s_colors = (struct TCColors*)malloc(sizeof(struct TCColors));
  s_colors->font_color_pri = BLU;
  s_colors->font_color_sec = GColorBlack;
  s_colors->font_color_ter = GColorBlack;
  
  
  //-- load font resources --
  s_res_sqr_num = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SQUARENUM_64));
  s_res_sqr_num_32 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SQUARENUM_32));
  s_res_scp = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SCP_12));
  s_res_scp_20 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SCP_20));
  
  bigNumbers = s_res_sqr_num;
  ltlNumbers = s_res_sqr_num_32;
  regText = s_res_scp;
  bigText = s_res_scp_20;
  //-- load image resources --
  s_res_w01d = gbitmap_create_with_resource(RESOURCE_ID_w01d);
  s_res_w01n = gbitmap_create_with_resource(RESOURCE_ID_w01n);
  s_res_w02d = gbitmap_create_with_resource(RESOURCE_ID_w02d);
  s_res_w02n = gbitmap_create_with_resource(RESOURCE_ID_w02n);
  s_res_w03d = gbitmap_create_with_resource(RESOURCE_ID_w03d);
  s_res_w04d = gbitmap_create_with_resource(RESOURCE_ID_w04d);
  s_res_w09d = gbitmap_create_with_resource(RESOURCE_ID_w09d);
  s_res_w10d = gbitmap_create_with_resource(RESOURCE_ID_w10d);
  s_res_w10n = gbitmap_create_with_resource(RESOURCE_ID_w10n);
  s_res_w11d = gbitmap_create_with_resource(RESOURCE_ID_w11d);
  s_res_w13d = gbitmap_create_with_resource(RESOURCE_ID_w13d);
  s_res_w50d = gbitmap_create_with_resource(RESOURCE_ID_w50d);
  s_res_bluetooth = gbitmap_create_with_resource(RESOURCE_ID_bluetooth_icon);
  s_res_bluetoothOff = gbitmap_create_with_resource(RESOURCE_ID_bluetooth_off);
  
  //-- text layers --
  // s_time_hr
  s_time_hr = text_layer_create(GRect(40, -10, 50, 90));
  text_layer_set_background_color(s_time_hr, GColorClear);
  text_layer_set_text_color(s_time_hr, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_time_hr, GTextAlignmentRight);
  text_layer_set_font(s_time_hr, bigNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_hr);
  
  // s_time_hr2
  s_time_hr2 = text_layer_create(GRect(40, -10, 100, 90));
  text_layer_set_background_color(s_time_hr2, GColorClear);
  text_layer_set_text_color(s_time_hr2, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_time_hr2, GTextAlignmentRight);
  text_layer_set_font(s_time_hr2, bigNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_hr2);
  
  // s_time_min
  s_time_min = text_layer_create(GRect(40, 43, 50, 90));
  text_layer_set_background_color(s_time_min, GColorClear);
  text_layer_set_text_color(s_time_min, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_time_min, GTextAlignmentRight);
  text_layer_set_font(s_time_min, bigNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_min);
  
  // s_time_min2
  s_time_min2 = text_layer_create(GRect(40, 43, 100, 90));
  text_layer_set_background_color(s_time_min2, GColorClear);
  text_layer_set_text_color(s_time_min2, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_time_min2, GTextAlignmentRight);
  text_layer_set_font(s_time_min2, bigNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_time_min2);
  
  // s_weather_temp
  s_weather_temp = text_layer_create(GRect(-2, 30, 46, 27));
  text_layer_set_background_color(s_weather_temp, GColorClear);
  text_layer_set_text_color(s_weather_temp, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_weather_temp, GTextAlignmentCenter);
  text_layer_set_font(s_weather_temp, bigText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_weather_temp);
  
  // s_date_year = first part of a year (20)
  s_date_year = text_layer_create(GRect(42, 130, 46, 37));
  text_layer_set_background_color(s_date_year, GColorClear);
  text_layer_set_text_color(s_date_year, s_colors->font_color_sec);
  text_layer_set_text_alignment(s_date_year, GTextAlignmentRight);
  text_layer_set_font(s_date_year, ltlNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_year);
  
  // s_date_year2 = last part of a year (15)
  s_date_year2 = text_layer_create(GRect(93, 130, 46, 37));
  text_layer_set_background_color(s_date_year2, GColorClear);
  text_layer_set_text_color(s_date_year2, s_colors->font_color_sec);
  text_layer_set_text_alignment(s_date_year2, GTextAlignmentRight);
  text_layer_set_font(s_date_year2, ltlNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_year2);
  
  // s_date_day = 01, 02, 03, ..., 31
  s_date_day = text_layer_create(GRect(93, 105, 46, 37));
  text_layer_set_background_color(s_date_day, GColorClear);
  text_layer_set_text_color(s_date_day, s_colors->font_color_sec);
  text_layer_set_text_alignment(s_date_day, GTextAlignmentRight);
  text_layer_set_font(s_date_day, ltlNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_day);
  
  // s_date_month = 01, 02, 03, ..., 12
  s_date_month = text_layer_create(GRect(42, 105, 46, 37));
  text_layer_set_background_color(s_date_month, GColorClear);
  text_layer_set_text_color(s_date_month, s_colors->font_color_sec);
  text_layer_set_text_alignment(s_date_month, GTextAlignmentRight);
  text_layer_set_font(s_date_month, ltlNumbers);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_month);
  
  /* looks ugly
  // s_day_h = horizontal day listing
  s_day_h = text_layer_create(GRect(0, 112, 46, 37));
  text_layer_set_background_color(s_day_h, GColorClear);
  text_layer_set_text_color(s_day_h, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_day_h, GTextAlignmentRight);
  text_layer_set_font(s_day_h, bigText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_day_h);
  
  // s_month_h = horizontal month listing
  s_month_h = text_layer_create(GRect(0, 135, 46, 37));
  text_layer_set_background_color(s_month_h, GColorClear);
  text_layer_set_text_color(s_month_h, s_colors->font_color_pri);
  text_layer_set_text_alignment(s_month_h, GTextAlignmentRight);
  text_layer_set_font(s_month_h, bigText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_month_h);
  */
  
  // s_ampm
  s_ampm = text_layer_create(GRect(50, -4, 14, 13));
  text_layer_set_background_color(s_ampm, GColorClear);
  text_layer_set_text_color(s_ampm, s_colors->font_color_ter);
  text_layer_set_font(s_ampm, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_ampm);
  
  // s_day_v = vertical day listing
  s_day_v = text_layer_create(GRect(40, 7, 8, 36));
  text_layer_set_background_color(s_day_v, GColorClear);
  text_layer_set_text_color(s_day_v, s_colors->font_color_ter);
  text_layer_set_text_alignment(s_day_v, GTextAlignmentCenter);
  text_layer_set_font(s_day_v, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_day_v);
  
  // s_date_day_v = same as s_date_day, but vertical, below s_day
  s_date_day_v = text_layer_create(GRect(40, 48, 8, 24));
  text_layer_set_background_color(s_date_day_v, GColorClear);
  text_layer_set_text_color(s_date_day_v, s_colors->font_color_ter);
  text_layer_set_text_alignment(s_date_day_v, GTextAlignmentCenter);
  text_layer_set_font(s_date_day_v, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_date_day_v);
  
  // s_month_v = vertical month listing
  s_month_v = text_layer_create(GRect(40, 75, 8, 36));
  text_layer_set_background_color(s_month_v, GColorClear);
  text_layer_set_text_color(s_month_v, s_colors->font_color_ter);
  text_layer_set_text_alignment(s_month_v, GTextAlignmentCenter);
  text_layer_set_font(s_month_v, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_month_v);
  
  // s_year_v = vertical year listing
  s_year_v = text_layer_create(GRect(40, 115, 8, 48));
  text_layer_set_background_color(s_year_v, GColorClear);
  text_layer_set_text_color(s_year_v, s_colors->font_color_ter);
  text_layer_set_text_alignment(s_year_v, GTextAlignmentCenter);
  text_layer_set_font(s_year_v, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_year_v);
  
  // s_battery
  s_battery = text_layer_create(GRect(101, -4, 36, 13));
  text_layer_set_background_color(s_battery, GColorClear);
  text_layer_set_text_color(s_battery, s_colors->font_color_ter);
  text_layer_set_font(s_battery, regText);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_battery);
  
  //-- bitmaps --
  
  // s_weather_image
  s_weather_image = bitmap_layer_create(GRect(0, -3, 40, 40));
  bitmap_layer_set_compositing_mode(s_weather_image, GCompOpSet);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_weather_image);
  
  // s_bluetooth_image
  s_bluetooth_image = bitmap_layer_create(GRect(83, -3, 20, 20));
  bitmap_layer_set_compositing_mode(s_bluetooth_image, GCompOpSet);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_bluetooth_image);
  
  //-- subscribing to events --
  tick_timer_service_subscribe(MINUTE_UNIT, time_handler);
  battery_state_service_subscribe(battery_handler);
  message_init(s_weather_temp); // start weather service
  bluetooth_connection_service_subscribe(bluetooth_handler);
  //-- setting face --
  update_all();
}
 void set_tile_buf(tile_buf& buf) {
   m_tile_buf.swap(buf);
   set_surface_buffers();
   update_all();
   queue_draw();
 }
Exemple #21
0
void QPplot_gui::update_var1_low_clip( float val ) {
  qpploter_->low_clip( QPplot::Xvar, val );
  update_all();
}
void Viewer::on_prev_button_clicked(){
    update_all( current_frame_id - frame_step );
}
void Viewer::on_update_frame_id_clicked(){
    update_all( ui->frame_id_edit->toPlainText().toInt() );
}
Exemple #24
0
void backwards(int * trace, int * max_used_color,
               int * vertex_max_color, int * current_vertex,
               int * satur_degree, Graph * graph, tuple * base,
               int * popularity, int * coloring,
               int * depth, int upper_bound, int lower_bound) {
  
  // Se determina la posición en la traza donde se encuentra
  // el vértice desde el cual se hace backtracking
  int vertex_position = lin_search(trace, *current_vertex, *depth);
  
  
  // Se averigua si el vértice de donde se parte
  // el backtracking es la raiz
  if (vertex_position == 0) {
    int vertex_color = graph[trace[vertex_position]].color;
    update_all(trace, graph, base, popularity, *depth,
               vertex_position, satur_degree);
    // Quitamos su color del FC
    graph[trace[vertex_position]].FC[vertex_color] = 0;

    // Se determina el máximo color utilizado hasta ahora
    max_color(popularity, max_used_color, upper_bound);
    
    if (valid_FC(graph, trace[vertex_position],lower_bound+1)) {
      *current_vertex = trace[vertex_position];
      *vertex_max_color = 0;
      return;
    }
    else {
      // Se ha llegado a la raiz y no hay mas colores 
      // posibles que introducir
      *current_vertex = -1;
      return;
    }
  }
  else {
    tuple_list * candidates = NULL;
    
    if (vertex_position == -1) {
      // Significa que el vértice donde quedó forward 
      // tuvo FC vació, por lo tanto no se encontró en 
      // la traza. Se llama directamente label
      candidates = label(graph, *depth + 1,
                         *max_used_color, trace, *current_vertex);
      vertex_position = *depth + 1;
    }
    else {
      // Se logró una coloración completa. Por lo tanto:
      // Se decolorean todos los vértices subiendo en el 
      // árbol hasta llegar al vértice de mínimo rango 
      // con el mayor color usado en la coloración parcial actual
      update_all(trace, graph, base, popularity, *depth,
                 vertex_position, satur_degree);
      
      // Se procede a hacer el etiquetado partiendo del vértice
      // con coloración más alta y de rango mínimo. O partiendo 
      // del vértice cuyo FC se hizo vacío
      candidates = label(graph, vertex_position,
                         *max_used_color, trace, *current_vertex);
    }

    // Se verifica que la lista de candidatos del label
    // sea distinta de Nula. En caso contrario no hay más
    // backtracking que hacer y se consiguió una coloración
    while (candidates != NULL) {
      
      int vertex_color = graph[candidates->vertex].color;
 
      // Se decolorean todos los vértices que están a partir
      // de una posición anterior desde donde se hizo labeling 
      // hasta el vértice de rango máximo entre todos los 
      // etiquetados
      update_all(trace, graph, base, popularity,
                 vertex_position - 1, candidates->position,
                 satur_degree);
 
      // Se elimina de su FC el color que tiene actualmente
      graph[candidates->vertex].FC[vertex_color] = 0;
    
      // Se determina el máximo color utilizado hasta ahora
 
      max_color(popularity, max_used_color, upper_bound);
 
      // Se verifica que el vértice de máximo rango etiquetado
      // no tenga un FC vacío. Al ser su FC no vació se hace
      // retornar el algoritmo
    
      if (valid_FC(graph, candidates->vertex, *max_used_color)) {
        // Se determina la posición en la traza
        // del vértice de mínimo rango que tiene
        // el color máximo utilizado
        det_vertex_max_color(graph, trace,*max_used_color,
                             vertex_max_color, candidates->position);
        // Se indica la posición en la traza del vértice 
        // del cual se parte para hacer forward.
        *current_vertex = candidates->vertex;
        *depth = candidates->position;
        free_tuple_list(candidates);
        return;
      }
      else {
        tuple_list * tmp = candidates;
        candidates = candidates->next;
        tmp->next = NULL;
        free_tuple_list(tmp);
      }
    }
  }
  // La lista CP está vacía por lo tanto se retorna el
  // algoritmo con current_vertex siendo cero.
  *current_vertex = -1;
  return;
}
void Viewer::on_radio_depth_clicked(){
    update_all();
}
void Viewer::on_radio_rgbd_clicked(){
    update_all();
}
Exemple #27
0
/*
  We have a new comand from the server.
  'emit' a signal.
 */
void TTCP::newCommand(const QStringList &list)
{
    if (list[0] == "auto") {

	if (list.size() == 12) {
	    emit add_autoentry(list[1], list[2].toInt(), list[3].toInt(), list[4], list[5], list[6], list[7], list[8], list[9], list[10], list[11]);
			     /* user    project          auto_id          host     name     class    role     desk     title     flags    enabled */
	} else
	if (list.size() == 11) {
	    emit add_autoentry(list[1], list[2].toInt(), list[3].toInt(), list[4], list[5], list[6], list[7], list[8], list[9], list[10], "t");
			     /* user    project          auto_id          host     name     class    role     desk     title     flags    enabled */
	}
    } else if (list[0] == "entry") {
	emit add_entry(list[2], list[3].toInt(), list[4].toInt(), totime(list[5]),  totime(list[6]));
    } else if (list[0] == "timeslice") {
        if (list.size() == 8) {
            emit add_timeslice(list[1], list[2].toInt(), list[3].toInt(), list[4].toInt(), list[5], todatetime(list[6]), list[7]);
        } else {
            qWarning("timeslice: wrong # of arguments %d", list.size());
	}
    } else if (list[0] == "current") {
	emit current(list[2].toInt());
    } else if (list[0] == "disable") {
	emit disable(list[2].toInt());
    } else if (list[0] == "error") {
	emit error(list[1]);
    } else if (list[0] == "update") {
	emit update_all();
    } else if (list[0] == "update_time") {
	if (list.count() == 5) {
	    emit settime(list[2].toInt(), totime(list[3]), totime(list[4]));
	} else {
	    printf("Error in update_time\n");
	}
    } else if (list[0] == "accept_note") {
        qWarning("%s %s", qPrintable(list[0]), qPrintable(list[1]));
	emit accept_note(list[1]);
    } else if (list[0] == "accept_task") {
	emit accept_project(list[1]);
    } else if (list[0] == "accept_select") {
	emit accept_select(list[1]);
    } else if (list[0] == "alert") {
        emit alert_message(list[1].toInt(), list[2], list[3]);
    } else if (list[0] == "alert_end") {
        emit alert_end_message(list[1].toInt());
    } else if (list[0] == "hourly") {
        qWarning("Hourly");
        emit hourly();
    } else if (list[0] == "recentproject") {
        emit recentproject(
                    list[2].toInt(),   // project ID
                    list[3].toInt(),   // index
                    list[4].toInt(),   // max index
                    QString("A comment")
                );
    } else if (list[0] == "recentprojects") {
        QStringList plist(list.mid(2));
        QList<int> pilist;
        QStringList::iterator i;
        for (i = plist.begin(); i != plist.end(); ++i)
            pilist.append((*i).toInt());
        emit recentprojects(
                    pilist
                );
    } else {
        qWarning("TTCP Unknown: '%s'/%d\n", qPrintable(list[0]), list.size() - 1);
    }
}
Exemple #28
0
void AudioOutputI2SQuad::isr(void)
{
	uint32_t saddr;
	const int16_t *src1, *src2, *src3, *src4;
	const int16_t *zeros = (const int16_t *)zerodata;
	int16_t *dest;

	saddr = (uint32_t)(dma.TCD->SADDR);
	dma.clearInterrupt();
	if (saddr < (uint32_t)i2s_tx_buffer + sizeof(i2s_tx_buffer) / 2) {
		// DMA is transmitting the first half of the buffer
		// so we must fill the second half
		dest = (int16_t *)&i2s_tx_buffer[AUDIO_BLOCK_SAMPLES];
		if (update_responsibility) update_all();
	} else {
		dest = (int16_t *)i2s_tx_buffer;
	}

	src1 = (block_ch1_1st) ? block_ch1_1st->data + ch1_offset : zeros;
	src2 = (block_ch2_1st) ? block_ch2_1st->data + ch2_offset : zeros;
	src3 = (block_ch3_1st) ? block_ch3_1st->data + ch3_offset : zeros;
	src4 = (block_ch4_1st) ? block_ch4_1st->data + ch4_offset : zeros;

	// TODO: fast 4-way interleaved memcpy...
#if 1
	memcpy_tointerleaveQuad(dest, src1, src2, src3, src4);
#else
	for (int i=0; i < AUDIO_BLOCK_SAMPLES/2; i++) {
		*dest++ = *src1++;
		*dest++ = *src3++;
		*dest++ = *src2++;
		*dest++ = *src4++;
	}
#endif

	if (block_ch1_1st) {
		if (ch1_offset == 0) {
			ch1_offset = AUDIO_BLOCK_SAMPLES/2;
		} else {
			ch1_offset = 0;
			release(block_ch1_1st);
			block_ch1_1st = block_ch1_2nd;
			block_ch1_2nd = NULL;
		}
	}
	if (block_ch2_1st) {
		if (ch2_offset == 0) {
			ch2_offset = AUDIO_BLOCK_SAMPLES/2;
		} else {
			ch2_offset = 0;
			release(block_ch2_1st);
			block_ch2_1st = block_ch2_2nd;
			block_ch2_2nd = NULL;
		}
	}
	if (block_ch3_1st) {
		if (ch3_offset == 0) {
			ch3_offset = AUDIO_BLOCK_SAMPLES/2;
		} else {
			ch3_offset = 0;
			release(block_ch3_1st);
			block_ch3_1st = block_ch3_2nd;
			block_ch3_2nd = NULL;
		}
	}
	if (block_ch4_1st) {
		if (ch4_offset == 0) {
			ch4_offset = AUDIO_BLOCK_SAMPLES/2;
		} else {
			ch4_offset = 0;
			release(block_ch4_1st);
			block_ch4_1st = block_ch4_2nd;
			block_ch4_2nd = NULL;
		}
	}
}
Exemple #29
0
void QPplot_gui::update_var2_high_clip( float val ) {
  qpploter_->high_clip( QPplot::Yvar, val );
  update_all();  
}
void Viewer::on_next_button_clicked(){
    update_all( current_frame_id + frame_step );
}