Esempio n. 1
0
static void setting_handle_buttons(button_t button) {
    if (button == BUTTON_BACK) {
        switch (_state) {
            case SETTING_STATE_MENU:
                _state = SETTING_STATE_CLOSED;
                menu_close();
                nsec_setting_show();
                break;

            case SETTING_STATE_BRIGHTNESS:
            case SETTING_STATE_SPEED:
            case SETTING_STATE_FIRST_COLOR:
            case SETTING_STATE_SECOND_COLOR:
            case SETTING_STATE_THIRD_COLOR:
            case SETTING_STATE_REVERSE:
            case SETTING_STATE_CONTROL:
                _state = SETTING_STATE_MENU;
                menu_close();
                nsec_show_led_settings();
                break;

            default:
                break;
        }
    }
}
Esempio n. 2
0
File: edit.c Progetto: jff/mathspad
static void edit_handle_remark_done(void *data, int bnr)
{
    EDITINFO *einf = (EDITINFO *) data;
    FILE *f;
    int close_next = quit_sequence;

    if (!bnr) {
	f = fopen((char*)UstrtoFilename(newname),"wb");
	if (f) {
	    set_file(f);
	    put_filecode(DOCUMENTFILE);
	    save_editwindow(einf->info);
	    unset_file();
	    cleanup_stencilstack();
	    fclose(f);
	    remove_auto_save(einf);
	    einf->saved = MP_True;
	    edit_close(data);
	} else {
	    message(MP_ERROR, translate("Can't save file."));
	    failure=MP_True;
	}
    } else if (bnr==1) {
	edit_auto_save(data, 0);
	einf->saved = MP_True;
	edit_close(data);
    } else if (bnr==2) {
	close_next = MP_False;
	quit_sequence = MP_False;
    }
    free(newname);
    kind_of_remark = NO_REMARK;
    newname = NULL;
    if (close_next) menu_close();
}
Esempio n. 3
0
static void show_speed_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_speed();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(speed_items), speed_items);
    _state = SETTING_STATE_SPEED;
}
Esempio n. 4
0
static void show_reverse_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_reverse();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(reverse_items), reverse_items);
    _state = SETTING_STATE_REVERSE;
}
Esempio n. 5
0
static void show_control_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_control();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(control_items), control_items);
    _state = SETTING_STATE_CONTROL;
}
Esempio n. 6
0
static void show_brightness_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_brightness();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(brightness_items), brightness_items);
    _state = SETTING_STATE_BRIGHTNESS;
}
Esempio n. 7
0
void btrccar_open()
{
	menu_close();

	display_setDrawFunc(draw);
	buttons_setFuncs(btn1, btn2, btn3);
	
	btData = 0;
}
Esempio n. 8
0
void torch_open()
{
	menu_close();

	strobe = 0;
	display_setDrawFunc(draw);
	buttons_setFunc(BTN_SELECT,	select);
	buttons_setFunc(BTN_DOWN,	down);
	buttons_setFunc(BTN_UP,		down);
}
Esempio n. 9
0
static void show_color_menu(uint8_t item) {
    if (item == 2) {
        _state = SETTING_STATE_FIRST_COLOR;
    } else if (item == 3) {
        _state = SETTING_STATE_SECOND_COLOR;
    } else {
        _state = SETTING_STATE_THIRD_COLOR;
    }
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_color();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(color_items), color_items);
}
Esempio n. 10
0
void game2_start()
{
	menu_close();

	srand(millis());

	display_setDrawFunc(draw);
	buttons_setFunc(BTN_SELECT,	select);
	buttons_setFunc(BTN_DOWN,	down);
	buttons_setFunc(BTN_UP,		up);

	LOOP(CAR_COUNT, i)
	{
		cars[i].y = i * 16;
		cars[i].speed = i + 1;
		cars[i].x = FRAME_WIDTH;
	}	
Esempio n. 11
0
ZUserInfo::ZUserInfo(std::string _id)
    :MyBaseDlg()
{
 	setMainWidgetTitle ( LNG_USERINFO );
	id = _id;
	dlgUserInfo = this;

	initInterface();

	ZSoftKey *softKey = new ZSoftKey ( NULL, this, this );
	softKey->setText ( ZSoftKey::LEFT, LNG_OK, ( ZSoftKey::TEXT_PRIORITY ) 0 );
	softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( menu_close() ) );
	// TODO: FIX - Add update button
	//softKey->setText ( ZSoftKey::RIGHT, LNG_UPD, ( ZSoftKey::TEXT_PRIORITY ) 0 );
	//softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( menu_update() ) );	
	setCSTWidget ( softKey );

	pthread_attr_t attr;
	pthread_attr_init(&attr);
	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
	pthread_create(&thread, &attr, getInfo, (void*) &id );
	pthread_attr_destroy(&attr);
}
Esempio n. 12
0
void indicator_disk_mouse(Indicator *indicator, XButtonPressedEvent *ev) {
	if(ev->type != ButtonPress) {
		return;
	}
	if(ev->window==menu.window) {
		indicator_disk_expose(indicator, ev->window);
		return;
	}
	switch(ev->button) {
		case Button1:
		case Button3:
			if(indicator->active)
				menu_close(indicator);
			else
				menu_open(indicator);
			return;
		case Button4:
			break;
		case Button5:
			break;
	}
	if(indicator->active)
		indicator_disk_expose(indicator, menu.window);
}
Esempio n. 13
0
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
  mp_image_t *dmpi = NULL;

  if (vf->priv->passthrough) {
    dmpi=vf_get_image(vf->next, IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT,
                      0, mpi->w, mpi->h);
    dmpi->planes[0]=mpi->planes[0];
    return vf_next_put_image(vf,dmpi, pts);
  }

  // Close all menu who requested it
  while(vf->priv->current->cl && vf->priv->current != vf->priv->root) {
    menu_t* m = vf->priv->current;
    vf->priv->current = m->parent ? m->parent :  vf->priv->root;
    menu_close(m);
  }

    // Try to capture the last frame before pause, or fallback to use
    // last captured frame.
    if(pause_mpi && (mpi->w != pause_mpi->w || mpi->h != pause_mpi->h ||
		     mpi->imgfmt != pause_mpi->imgfmt)) {
      free_mp_image(pause_mpi);
      pause_mpi = NULL;
    }
  if (!pause_mpi) {
    pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt);
    copy_mpi(pause_mpi,mpi);
  }
  else if (mpctx_get_osd_function(vf->priv->root->ctx) == OSD_PAUSE)
    copy_mpi(pause_mpi,mpi);

  if (vf->priv->current->show) {
    if (!mp_input_key_cb)
      mp_input_key_cb = key_cb;

  if(mpi->flags&MP_IMGFLAG_DIRECT)
    dmpi = mpi->priv;
  else {
    dmpi = vf_get_image(vf->next,mpi->imgfmt,
			MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
			mpi->w,mpi->h);
    copy_mpi(dmpi,mpi);
  }
  menu_draw(vf->priv->current,dmpi);

  } else {
    if(mp_input_key_cb)
      mp_input_key_cb = NULL;

    if(mpi->flags&MP_IMGFLAG_DIRECT)
      dmpi = mpi->priv;
    else {
      dmpi = vf_get_image(vf->next,mpi->imgfmt,
                          MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
                          mpi->w,mpi->h);

      dmpi->stride[0] = mpi->stride[0];
      dmpi->stride[1] = mpi->stride[1];
      dmpi->stride[2] = mpi->stride[2];
      dmpi->planes[0] = mpi->planes[0];
      dmpi->planes[1] = mpi->planes[1];
      dmpi->planes[2] = mpi->planes[2];
      dmpi->priv      = mpi->priv;
    }
  }
  return vf_next_put_image(vf,dmpi, pts);
}
Esempio n. 14
0
void open_led_pattern(uint8_t item) {
    menu_close();
    is_at_main_menu = false;
    nsec_led_pattern_show();
}
Esempio n. 15
0
void open_settings(uint8_t item) {
    menu_close();
    is_at_main_menu = false;
    nsec_setting_show();
}
Esempio n. 16
0
void open_warning(uint8_t item) {
    menu_close();
    is_at_main_menu = false;
    nsec_warning_show();
}
Esempio n. 17
0
void open_battery_status(uint8_t item) {
    menu_close();
    is_at_main_menu = false;
    show_battery_status();
}
Esempio n. 18
0
void indicator_music_mouse(Indicator *indicator, XButtonPressedEvent *ev) {
	if(ev->type != ButtonPress) {
		Window w;
		int tmp;
		int x, y;
		unsigned int mask;
		XQueryPointer(dpy, menu.window, &w, &w, &tmp, &tmp, &x, &y, &mask);
		
		menu.selected=-1;
		if(x>=0&&y>=0&&x<menu.w&&y<menu.h) {
			if(mask&0x100&&y/bh==1) {
				int sliderw=menu.w-10*2;
				snd_mixer_handle_events(alsa.handle);
				volume_set(100*(x-10)/sliderw);
			}
			menu.selected=y/bh;
			menu.button=x>=menu.w/2-BUTTON_W*3/2&&x<menu.w/2+BUTTON_W*2/2?(x-(menu.w/2-BUTTON_W*3/2))/BUTTON_W:-1;
		}
		
		indicator_music_expose(indicator, menu.window);
		return;
	}
	if(ev->window==menu.window) {
		int sliderw=menu.w-10*2;
		int item=ev->y/bh;
		struct MEDIAPLAYER *mp;
		
		if(item==0) {
			snd_mixer_handle_events(alsa.handle);
			mute_set(!mute_get());
		} else if(item==1) {
			if(ev->x>=10&&ev->x<menu.w-10) {
				snd_mixer_handle_events(alsa.handle);
				volume_set(100*(ev->x-10)/sliderw);
			}
		} else {
			int i;
			for(mp=mediaplayer, i=2; mp; mp=mp->next, i+=5)
				if(item==i) {
					mediaplayer_raise(mp->id);
					indicator->active=False;
					menu_close();
					break;
				} else if(item==i+4&&menu.button>=0) {
					mediaplayer_action(mp->id, menu.button);
					indicator_music_expose(indicator, ev->window);
				}
			
			return;
		}
		indicator_music_expose(indicator, ev->window);
		
		return;
	}
	switch(ev->button) {
		case Button1:
		case Button3:
			if((indicator->active=!indicator->active))
				menu_open(indicator);
			else
				menu_close();
			return;
		case Button4:
			snd_mixer_handle_events(alsa.handle);
			volume_set(volume_get()+6);
			break;
		case Button5:
			snd_mixer_handle_events(alsa.handle);
			volume_set(volume_get()-4);
			break;
	}
	if(indicator->active)
		indicator_music_expose(indicator, menu.window);
}
Esempio n. 19
0
void open_conference_schedule(uint8_t item) {
    menu_close();
    is_at_main_menu = false;
    nsec_schedule_show_dates();
}
Esempio n. 20
0
static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
  mp_image_t *dmpi = NULL;

  if (vf->priv->passthrough) {
    dmpi=vf_get_image(vf->next, IMGFMT_MPEGPES, MP_IMGTYPE_EXPORT,
                      0, mpi->w, mpi->h);
    dmpi->planes[0]=mpi->planes[0];
    return vf_next_put_image(vf,dmpi, pts);
  }

  if(vf->priv->current->show 
  || (vf->priv->current->parent && vf->priv->current->parent->show)) {
  // Close all menu who requested it
  while(vf->priv->current->cl && vf->priv->current != vf->priv->root) {
    menu_t* m = vf->priv->current;
    vf->priv->current = m->parent ? m->parent :  vf->priv->root;
    menu_close(m);
  }

  // Step 1 : save the picture
  while(go2pause == 1) {
    static char delay = 0; // Hack : wait the 2 frame to be sure to show the right picture
    delay ^= 1; // after a seek
    if(!delay) break;

    if(pause_mpi && (mpi->w != pause_mpi->w || mpi->h != pause_mpi->h ||
		     mpi->imgfmt != pause_mpi->imgfmt)) {
      free_mp_image(pause_mpi);
      pause_mpi = NULL;
    }
    if(!pause_mpi)
      pause_mpi = alloc_mpi(mpi->w,mpi->h,mpi->imgfmt);
    copy_mpi(pause_mpi,mpi);
    mp_input_queue_cmd(mp_input_parse_cmd("pause"));
    go2pause = 2;
    break;
  }

  // Grab // Ungrab the keys
  if(!mp_input_key_cb && vf->priv->current->show)
    mp_input_key_cb = key_cb;
  if(mp_input_key_cb && !vf->priv->current->show)
    mp_input_key_cb = NULL;

  if(mpi->flags&MP_IMGFLAG_DIRECT)
    dmpi = mpi->priv;
  else {
    dmpi = vf_get_image(vf->next,mpi->imgfmt,
			MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
			mpi->w,mpi->h);
    copy_mpi(dmpi,mpi);
  }
  menu_draw(vf->priv->current,dmpi);

  } else {
    if(mp_input_key_cb)
      mp_input_key_cb = NULL;

    if(mpi->flags&MP_IMGFLAG_DIRECT)
      dmpi = mpi->priv;
    else {
      dmpi = vf_get_image(vf->next,mpi->imgfmt,
                          MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
                          mpi->w,mpi->h);

      dmpi->stride[0] = mpi->stride[0];
      dmpi->stride[1] = mpi->stride[1];
      dmpi->stride[2] = mpi->stride[2];
      dmpi->planes[0] = mpi->planes[0];
      dmpi->planes[1] = mpi->planes[1];
      dmpi->planes[2] = mpi->planes[2];
      dmpi->priv      = mpi->priv;
    }
  }
  return vf_next_put_image(vf,dmpi, pts);
}
Esempio n. 21
0
void menu_params_apply_named_temp(const menuitem_t *item) {
	menu_params_apply_color_temp(item);

	beep();
	menu_close();
}