Пример #1
0
static void tglgrid_dialog(t_tg *tg, t_symbol *s, int argc, t_atom *argv) {
  UNUSED(s);
  if (!tg)
    error("tglgrid: tried to set properties on a non-existant grid");
  else if (argc != 6)
    error("tglgrid: invalid number of arguments passed to tglgrid_dialog.  (Expected 6, got %d)",
          argc);
  else if (argv[0].a_type != A_FLOAT ||
           argv[1].a_type != A_FLOAT ||
           argv[2].a_type != A_FLOAT ||
           argv[3].a_type != A_FLOAT ||
           argv[4].a_type != A_SYMBOL ||
           argv[5].a_type != A_SYMBOL)
    error("tglgrid: invalid parameter types passed to tglgrid_dialog");
  else {
    t_int newcols = (t_int)argv[0].a_w.w_float;
    t_int newrows = (t_int)argv[1].a_w.w_float;
    tg->cell_size = (t_int)argv[2].a_w.w_float;
    tg->spacing = (t_int)argv[3].a_w.w_float;
    snprintf(tg->tglfill,8,argv[4].a_w.w_symbol->s_name);
    snprintf(tg->untglfill,8,argv[5].a_w.w_symbol->s_name);

    // need to erase before we change # of rows/cols
    // so we erase the old size
    draw_erase(tg,tg->glist);
    resize_to(tg,newcols,newrows);
    draw_new(tg,tg->glist);
  }
}
Пример #2
0
void vsx_window_object_inspector::unload() {
  resize_to(vsx_vector3<>(0.001,0.001));
  move(1-0.001,1,0);
  texture.unload();
  filename_loaded = "";
  view_type = 0;
}
void vsx_window_object_inspector::unload() {
  resize_to(vsx_vector(0.001,0.001));
  move(1-0.001,1,0);
#ifndef VSXU_PLAYER
  texture.unload();
#endif
  filename_loaded = "";
  view_type = 0;
}
void vsx_window_object_inspector::draw_2d() {
	vsx_widget_window::draw_2d();

  if (view_type == 1)
  {
    pos_.y = pos.y+size.y-font_size;
    size_.y = size.y-font_size-dragborder;
    pos_.x = pos.x+dragborder;
    size_.x = size.x-dragborder*2;
    //printf("size: %f\n",size_.x);
    title = filename_loaded+" "+i2s((int)texture.texture_info.size_x)+"x"+i2s((int)texture.texture_info.size_y);
#ifndef VSXU_PLAYER
   	texture.bind();
    glColor4f(1,1,1,1);
    if (texture.valid) {
    	glBegin(GL_QUADS);
    	if (texture.texture_info.ogl_type == GL_TEXTURE_2D) {
      	glTexCoord2i(0, 1);
        glVertex3f(pos_.x,pos_.y,0);
      	glTexCoord2i(1, 1);
        glVertex3f(pos_.x+size_.x,pos_.y,0);
      	glTexCoord2i(1, 0);
        glVertex3f(pos_.x+size_.x,pos_.y-size_.y,0);
      	glTexCoord2i(0, 0);
        glVertex3f(pos_.x,pos_.y-size_.y,0);
      } else {
      	glTexCoord2i(0, (int)texture.texture_info.size_y);
        glVertex3f(pos_.x,pos_.y,0);
      	glTexCoord2i((int)texture.texture_info.size_x, (int)texture.texture_info.size_y);
        glVertex3f(pos_.x+size_.x,pos_.y,0);
      	glTexCoord2i((int)texture.texture_info.size_x, 0);
        glVertex3f(pos_.x+size_.x,pos_.y-size_.y,0);
      	glTexCoord2i(0, 0);
        glVertex3f(pos_.x,pos_.y-size_.y,0);
      }
      glEnd();
    }
    texture._bind();
#endif
    float screenaspect = screen_x/screen_y;
    //printf("ts %f\n",texture.size_x);
#ifndef VSXU_PLAYER
    if (texture_loaded == false)
    if (texture.texture_info.size_y != 0.0) {
      texture_loaded = true;
      vsx_vector aa;
      aa.x = 0.4/screenaspect*(texture.texture_info.size_x/texture.texture_info.size_y);
      aa.y = 0.4;
      aa.z = 0;
      printf("resizing to tex\n");
      resize_to(aa);
      move(1*screen_aspect-0.4/screenaspect*(texture.texture_info.size_x/texture.texture_info.size_y),1.0f-aa.y,0);
    }
#endif
  }
}
Пример #5
0
void tg_size(t_tg* tg, t_floatarg cf, t_floatarg rf) {
  t_int c = (t_int)cf;
  t_int r = (t_int)rf;

  if (c != tg->cols || r != tg->rows) {
    draw_erase(tg,tg->glist);
    resize_to(tg,c,r);
    draw_new(tg,tg->glist);
  }
}
Пример #6
0
NewDocumentDialog::NewDocumentDialog()
:	NWindow(
		new NDialogPanel(
			MAKEINTRESOURCE(ID_NEW_DOCUMENT_DIALOG), NRect(), "NewDialog",
			NView::FOLLOW_LEFT | NView::FOLLOW_TOP, NDialogPanel::RESIZE_TO_FIT),
		NRect(100, 100, 300, 300), "�V�K�쐬", TITLED_LOOK, MODAL_APP_FEEL,
		NOT_RESIZABLE | NOT_ZOOMABLE | NOT_MINIMIZABLE)
{
	NDialogPanel* dialog_panel = reinterpret_cast<NDialogPanel*>(panel());
	SetDlgItemText(dialog_panel->handle(), ID_WIDTH, "160");
	SetDlgItemText(dialog_panel->handle(), ID_HEIGHT, "120");

	resize_to(dialog_panel->frame().width(), dialog_panel->frame().height());
	move_to(
		(NScreen::frame().width() - frame().width()) /2,
		(NScreen::frame().height() - frame().height()) /2);
}
Пример #7
0
ScrollView::ScrollView(const String& name, View* target, uint mode, uint flags, bool v, bool h, const RGBColor& color)
:	View(Rect(0, 0, 100, 100), name, mode, flags, color)
,	m_target(NULL)
,	m_v_scroll_bar(NULL)
,	m_h_scroll_bar(NULL)
{
	assert(target);

	Rect rect = target->frame();

	target->move_to(0, 0);// ‹Ù‹}”ð“ï‘[’u

	if(v)
	{
		m_v_scroll_bar = new ScrollBar(
			Rect(0, 0, ScrollBar::V_SCROLL_BAR_WIDTH, 10),
			"VScrollBar",
			NULL,
			0, 0,
			ScrollBar::VERTICAL,
			FOLLOW_RIGHT | FOLLOW_TOP_BOTTOM);
		add_child(m_v_scroll_bar);

		rect.right += m_v_scroll_bar->frame().width();
	}

	if(h)
	{
		m_h_scroll_bar = new ScrollBar(
			Rect(0, 0, 10, ScrollBar::H_SCROLL_BAR_HEIGHT),
			"HScrollBar",
			NULL,
			0, 0,
			ScrollBar::HORIZONTAL,
			FOLLOW_BOTTOM | FOLLOW_LEFT_RIGHT);
		add_child(m_h_scroll_bar);

		rect.bottom += m_h_scroll_bar->frame().height();
	}

	move_to(rect.left_top());
	resize_to(rect.width(), rect.height());

	set_target(target);
}
Пример #8
0
void vsx_widget_note::i_draw() {
  if (font_size != editor->font_size)
  {
    for (children_iter = children.begin(); children_iter != children.end(); children_iter++)
    {
      //if ( (*children_iter)->name == "bc1" )
      //::MessageBox(0, "note has bc1", (*children_iter)->name.c_str(), MB_OK);
    }
    font_size = editor->font_size;
    size_min.x = font_size*3.0f;
    size_min.y = font_size*4.0f;
    resize_to(target_size);
  }
  editor->set_pos(vsx_vector3<>(size.x*0.5f,size.y*0.5f-0.5f*font_size+dragborder*0.5f));
  editor->resize_to(vsx_vector3<>(size.x-dragborder*2, size.y-font_size-dragborder));

  vsx_vector3<> parentpos;
  parentpos = parent->get_pos_p();
  //float sx05 = size.x*0.5;
  //float sy05 = size.y*0.5;
  if (parent->render_type == render_type) {
    //parentpos.x = 0.0f;
    //parentpos.y = -font_size*2.0f;
    vsx_widget_window::i_draw();
  } else {
  }
  if (((vsx_widget_base_edit*)editor)->updates) {
    check_time -= vsx_widget_time::get_instance()->get_dtime();
    if (check_time < 0.01f)
    {
      save();
      ((vsx_widget_base_edit*)editor)->updates = 0;
      check_time = 1.0f;
    }
  }
//  printf("pos.x: %f\n",parentpos.x);
//  parentpos.x = 0;
//  parentpos.x = 0;
//  parentpos.z = 0;
  //glColor4f(skin_color[1].r,skin_color[1].g,skin_color[1].b,1);
  //draw_box(pos+parentpos,sx05,sy05);
}