Exemplo n.º 1
0
void handle_new_size(MFDB *original, GEM_WINDOW *gwnd)
{
  VXIMAGE *vimage ;
  int xe, ye, wxe, whe ;
  int xo, yo, wo, ho ;
  int ww, wh, dummy ;

  if ( gwnd == NULL) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;
  if ( ( original->fd_w == vimage->raster.fd_w ) && ( original->fd_h == vimage->raster.fd_h ) ) return ;

  wind_calc( WC_WORK, gwnd->window_kind, xopen, yopen, wdesk-(xopen-xdesk),
             hdesk-(yopen-ydesk), &xe, &ye, &wxe, &whe ) ;
  if ( wxe >= vimage->raster.fd_w ) wxe = vimage->raster.fd_w-1 ;
  if ( whe >= vimage->raster.fd_h ) whe = vimage->raster.fd_h-1 ;
  wind_calc( WC_BORDER, gwnd->window_kind, xe, ye, wxe, whe, &xo, &yo, &wo, &ho ) ;
  if ( gwnd->is_icon ) GWOnUnIconify( gwnd, gwnd->xywh_bicon ) ;
  else                 GWSetCurrXYWH( gwnd, xo, yo, wo, ho ) ; 

  gwnd->GetWorkXYWH( gwnd, &dummy, &dummy, &wo, &ho ) ;
  ww = (int) ( 1000.0*(double)wo / (double)vimage->raster.fd_w ) ;
  wh = (int) ( 1000.0*(double)ho / (double)vimage->raster.fd_h ) ;
  GWSetHSlider( gwnd, 1 ) ;
  GWSetVSlider( gwnd, 1 ) ;
  GWSetHSliderSize( gwnd, ww ) ;
  GWSetVSliderSize( gwnd, wh ) ;
  set_modif( gwnd ) ;
  update_view( gwnd ) ;
  update_zview( gwnd ) ;
  GWRePaint( gwnd ) ;
}
Exemplo n.º 2
0
void CPaused::Loop(float time_step) {
	CControl *ctrl = g_game.player->ctrl;
	int width = Winsys.resolution.width;
	int height = Winsys.resolution.height;

	ClearRenderContext();
	Env.SetupFog();
	update_view(ctrl, 0);
	SetupViewFrustum(ctrl);

	if (sky) Env.DrawSkybox(ctrl->viewpos);
	if (fog) Env.DrawFog();
	Env.SetupLight();
	if (terr) RenderCourse();
	DrawTrackmarks();
	if (trees) DrawTrees();

	DrawSnow(ctrl);

	if (param.perf_level > 2) draw_particles(ctrl);
	g_game.character->shape->Draw();

	DrawHud(ctrl);
	Reshape(width, height);
	Winsys.SwapBuffers();
}
Exemplo n.º 3
0
void ViewBase::set_viewport_dims(ushort2 dims, float scale) {
	view.dims.x = (unsigned short) (dims.x * scale);
	view.dims.y = (unsigned short) (dims.y * scale);
	pixel_ratio_rotation = 180.0f / (MINIMUM(dims.x, dims.y));	
	pixel_ratio_translation = (distance_limits.y - distance_limits.x) / (dims.y / 2);
	update_view();
}
Exemplo n.º 4
0
bool UITaskListWndItem::init_task( CGameTask* task, UITaskListWnd* parent )
{
	VERIFY( task );
	if ( !task )
	{
		return false;
	}
	m_task = task;
	SetMessageTarget( parent );
	
	CUIXml		xml;
	xml.Load( CONFIG_PATH, UI_PATH, PDA_TASK_XML );

	CUIXmlInit::InitWindow( xml, "second_task_wnd:task_item", 0, this );
	
	m_name     = UIHelper::Create3tButton( xml, "second_task_wnd:task_item:name", this );
//	m_bt_view  = UIHelper::CreateCheck(      xml, "second_task_wnd:task_item:btn_view", this );
	m_st_story = UIHelper::CreateStatic( xml, "second_task_wnd:task_item:st_story", this );
	m_bt_focus = UIHelper::Create3tButton( xml, "second_task_wnd:task_item:btn_focus", this );
	
	m_color_states[stt_activ ] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:activ",  0, (u32)(-1) );
	m_color_states[stt_unread] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:unread", 0, (u32)(-1) );
	m_color_states[stt_read  ] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:read",   0, (u32)(-1) );
	update_view();
	return true;
}
Exemplo n.º 5
0
Camera::  Camera(const float fov,
                 const float aspectRatio,
                 const float near,
                 const float far,
                 const GLKVector3 &position,
                 const GLKVector3 &focus,
                 const GLKVector3 &up,
                 const GLKVector3 &lightDir,
                 const GLKVector4 &lightColor
                 ) :
fov_(fov),
aspectRatio_(aspectRatio),
near_(near),
far_(far),
position_(position),
focus_(focus),
up_(up),
lightDirection_(lightDir),
lightColor_(lightColor),
viewMatrix_(GLKMatrix4Identity),
projectionMatrix_(GLKMatrix4Identity)
{
  update_view();
  update_projection();
}
Exemplo n.º 6
0
void
inventory_manager::update ()
{
  update_container ();
  sort ();
  update_view ();
}
Exemplo n.º 7
0
static void on_prev(GtkButton *button, Editor *e)
{
    update_record(e);
    if (e->record > 0)
    {
        e->record--;
        update_view(e);
        return;
    }

    e->shelf--;
    if (e->shelf == -1)
        e->shelf = library_shelves_count(e->library) - 1;
    e->record = current_shelf(e)->count - 1;
    update_view(e);
}
Exemplo n.º 8
0
Arquivo: display.c Projeto: JakeSc/tig
int
get_input(int prompt_position, struct key *key, bool modifiers)
{
    struct view *view;
    int i, key_value, cursor_y, cursor_x;

    if (prompt_position)
        input_mode = TRUE;

    memset(key, 0, sizeof(*key));

    while (TRUE) {
        int delay = -1;

        if (opt_refresh_mode == REFRESH_MODE_PERIODIC) {
            delay = watch_periodic(opt_refresh_interval);
            foreach_displayed_view (view, i) {
                if (view_can_refresh(view) &&
                        watch_dirty(&view->watch))
                    refresh_view(view);
            }
        }

        foreach_view (view, i) {
            update_view(view);
            if (view_is_displayed(view) && view->has_scrolled &&
                    use_scroll_redrawwin)
                redrawwin(view->win);
            view->has_scrolled = FALSE;
            if (view->pipe)
                delay = 0;
        }
Exemplo n.º 9
0
bool render_editor()
{
    cursor c = cursor_get();
    map_view v = view_get();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update_view(v.x, v.y, v.zoom);
    /*update_cursor_data(&selected_map, &selected_tile_x, &selected_tile_y);*/
    bool can_place = cursor_in_bounds(c.selected_tile_x, c.selected_tile_y);

    mat4 t = ident;
    mat4 cursor_pos = ident;
    uint16_t tile_w = (TILE_WIDTH * v.zoom);
    uint16_t tile_h = (TILE_HEIGHT * v.zoom);
    if(tile_w == 0)
        tile_w = 1;
    if(tile_h == 0)
        tile_h = 1;
    mat4_translate(&cursor_pos, c.selected_tile_x * TILE_WIDTH + (c.selected_map % 3 * TILEMAP_DIMS * TILE_WIDTH), c.selected_tile_y * TILE_HEIGHT + (c.selected_map / 3 * TILEMAP_DIMS * TILE_HEIGHT), 0);
    draw_maps(t);
    if(can_place) {
        draw_single_tile(get_tileset_texture(), c.set_id, c.current_id, cursor_pos);
    }
    for(int i = 0; i < 3; ++i)
        for(int j = 0; j < 3; ++j) {
            mat4_translate(&t, TILEMAP_DIMS * TILE_WIDTH * i, TILEMAP_DIMS * TILE_HEIGHT * j, 0);
            draw_grid(t);
        }
    
    glFlush();

    return true;
}
Exemplo n.º 10
0
  void
GameOver::loop(float timeStep)
{
  int width, height;
  width = getparam_x_resolution();
  height = getparam_y_resolution();

  /* Check joystick */
  if ( is_joystick_active() ) {
    update_joystick();

    if ( is_joystick_continue_button_down() )
    {
      if ( gameMgr->gametype != GameMgr::PRACTICING ) {
        set_game_mode( EVENT_RACE_SELECT );
      }else{
        set_game_mode( RACE_SELECT );
      }
      winsys_post_redisplay();
      return;
    }
  }
  fpsCounter.update();

  update_audio();

  clear_rendering_context();

  fogPlane.setup();
  update_player_pos( players[0], 0 );
  update_view( players[0], 0 );

  setup_view_frustum( players[0], NEAR_CLIP_DIST, 
      getparam_forward_clip_distance() );

  draw_sky(players[0].view.pos);
  draw_fog_plane();

  set_course_clipping( true );
  set_course_eye_point( players[0].view.pos );
  setup_course_lighting();
  render_course();
  draw_trees();
  if ( getparam_draw_particles() ) {
    draw_particles( players[0] );
  }

  ModelHndl->draw_tux();
  draw_tux_shadow();
  set_gl_options( GUI );

  UIMgr.setupDisplay();
  UIMgr.draw();

  HUD1.draw(players[0]);
  reshape( width, height );

  winsys_swap_buffers();
}
Exemplo n.º 11
0
void Browser::update(void)
{
  next();
  update_view();

  // ToDo double buffering (next) or triple buffering (next/previous)
  // use an other webView
}
Exemplo n.º 12
0
static void on_next(GtkButton *button, Editor *e)
{
    Shelf *s = current_shelf(e);
    update_record(e);
    if (e->record < s->count - 1)
    {
        e->record++;
        update_view(e);
        return;
    }

    e->record = 0;
    e->shelf++;
    if (e->shelf >= library_shelves_count(e->library))
        e->shelf = 0;
    update_view(e);
}
Exemplo n.º 13
0
void PIDConfigurator::stop_transaction()
{
	model[type] = values;

	if (type == pid_combo->currentIndex())
		update_view( type );

	transaction = false;
}
Exemplo n.º 14
0
Status::Status(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Status)
{
    ui->setupUi(this);

    db=DBlib::getInstance();
   update_view();


}
Exemplo n.º 15
0
int main(int argc, char *argv[])
{
    int c; /* c must be int not char, because the value of KEY_RESIZE is 632. */

    char buf[BUFSIZ];
    enum request request; 
    request = REQ_VIEW_MAIN; 

    struct view *view;
    if (argc < 2) {
        printf("Usage: %s <dir/filename> <keyword>\n", argv[0]);
        return;
    }
    signal(SIGINT, quit);

    if (argc == 3) {
        snprintf(buf, sizeof(buf), FIND_CMDD, argv[1], argv[2]);
        string_copy(fmt_cmd, buf);
    }else{
        snprintf(buf, sizeof(buf), FIND_CMD, argv[1]);
        string_copy(fmt_cmd, buf);
    }
    
	init();
            
	while (view_driver(display[current_view], request)) 
    {
        int i;

        foreach_view (view, i)
            update_view(view);

        c = wgetch(status_win);     
        request = get_request(c);
        
        if ( request == REQ_SCREEN_RESIZE) {

            int height, width;

            getmaxyx(stdscr, height, width);

            wresize(status_win, 1, width);
            mvwin(status_win, height - 1, 0);
            wrefresh(status_win);
        }
    }

	quit(0);

    return 0;
}
Exemplo n.º 16
0
static int data_size_proc(struct menu_item *item,
                          enum menu_callback_reason reason,
                          void *data)
{
  if (reason == MENU_CALLBACK_DEACTIVATE) {
    int v = (1 << menu_option_get(item));
    if (view_data_size != v) {
      view_data_size = v;
      make_cells(item->owner);
      update_view();
    }
  }
  return 0;
}
Exemplo n.º 17
0
int Browser::gotopage(int new_page)
{
  if (new_page<url_list.count() && new_page>=0) {
    page=new_page;
    update_view();
    return 0; // ok  
  } else {
  	// + return to first page
  	//page=0;
  	//update_view();
  	
  	// + nothing is done
    return 1; // erreur page inexistante
  }
}
Exemplo n.º 18
0
void UITaskListWndItem::Update()
{
	inherited::Update();
	update_view();

	if ( m_task && m_name->CursorOverWindow() && show_hint_can )
	{
		if ( Device.dwTimeGlobal > ( m_name->FocusReceiveTime() + 700 ) )
		{
			show_hint = true;
			GetMessageTarget()->SendMessage( this, PDA_TASK_SHOW_HINT, (void*)m_task );
			return;
		}
	}
}
Exemplo n.º 19
0
void update_all(int gno)
{
    update_set_lists(gno);
    update_world(gno);
    update_view(gno);
    update_status(gno, cur_statusitem, -1);
    update_ticks(gno);
    update_autos(gno);
    updatelegends(gno);
    updatesymbols(gno, -1);
    update_label_proc();
    update_locator_items(gno);
    update_draw();
    update_frame_items(gno);
    update_graph_items();
    update_hotlinks();
}
Exemplo n.º 20
0
void racing_loop (double time_step){
    CControl *ctrl = Players.GetCtrl (g_game.player_id);
	double ycoord = Course.FindYCoord (ctrl->cpos.x, ctrl->cpos.z);
	bool airborne = (bool) (ctrl->cpos.y > (ycoord + JUMP_MAX_START_HEIGHT));

    check_gl_error();
    ClearRenderContext ();
	Env.SetupFog ();
	Music.Update ();    

	CalcTrickControls (ctrl, time_step, airborne);

	if (!g_game.finish) CalcSteeringControls (ctrl, time_step);
		else CalcFinishControls (ctrl, time_step, airborne);
	PlayTerrainSound (ctrl, airborne);

//  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	ctrl->UpdatePlayerPos (time_step); 
//  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

	if (g_game.finish) IncCameraDistance (time_step);
	update_view (ctrl, time_step);
	UpdateTrackmarks (ctrl);

    SetupViewFrustum (ctrl);
	if (sky) Env.DrawSkybox (ctrl->viewpos);
	if (fog) Env.DrawFog ();
	void SetupLight ();
	if (terr) RenderCourse ();
	DrawTrackmarks ();
	if (trees) DrawTrees ();
	if (param.perf_level > 2) {
		update_particles (time_step);
		draw_particles (ctrl);
    }
	Char.Draw (g_game.char_id);
	UpdateWind (time_step, ctrl);
	UpdateSnow (time_step, ctrl);
	DrawSnow (ctrl);
	DrawHud (ctrl);
	
	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers ();
	if (g_game.finish == false) g_game.time += time_step;
} 
Exemplo n.º 21
0
static int address_proc(struct menu_item *item,
                        enum menu_callback_reason reason,
                        void *data)
{
  if (reason == MENU_CALLBACK_CHANGED) {
    uint32_t address = menu_intinput_get(item);
    for (int i = 0; i < domains.size; ++i) {
      struct mem_domain *d = vector_at(&domains, i);
      if (address >= d->start && address < d->start + d->size) {
        view_domain_index = i;
        d->view_offset = address - d->start;
        break;
      }
    }
    update_view();
  }
  return 0;
}
Exemplo n.º 22
0
int main(int argc, char **argv)
{
    Editor e;
    GtkWidget *win;
    gtk_init(&argc, &argv);

    if (argc <= 1)
    {
        fprintf(stderr, "usage: %s [-r] <library>\n", argv[0]);
        exit(1);
    }

    if (!strcmp(argv[1], "-r"))
    {
        e.path = argv[2];
        e.library = library_open_recreating(e.path);
    }
    else
    {
        e.path = argv[1];
        e.library = library_open(e.path);
        library_read_prototypes(e.library);
    }
    e.shelf = 0;
    e.record = 0;
    if (!library_shelves_count(e.library))
    {
        fprintf(stderr, "the library %s is empty!\n", e.path);
        exit(1);
    }
    
    create_library_editor(&e);
    update_view(&e);
    win = e.window;
    gtk_window_set_title(GTK_WINDOW(win), e.path);
    g_signal_connect(G_OBJECT(win), "key_press_event", G_CALLBACK(on_key), &e);
    g_signal_connect(G_OBJECT(win), "delete_event", G_CALLBACK(on_quit), &e);
    gtk_widget_show_all(win);
    gtk_main();

    return 0;
}
Exemplo n.º 23
0
void
BasicGrid::resize_grid(
	UI::index_type new_col_count,
	UI::index_type new_row_count
) {
	m_sel.resize(new_row_count);
	set_row_count(new_row_count);
	set_col_count(new_col_count);
	set_cursor(0, 0);
	update_view(
		0, view().fit_count,
		0, col_count(),
		false
	);
	queue_header_render();
	queue_cell_render(0, row_count());
	enqueue_actions(
		UI::UpdateActions::render
	);
}
Exemplo n.º 24
0
void GTKGeomWindow::spinbutton( GtkSpinButton *spinbutton )
{
    //std::cout << "Spinbutton\n";
    //g_signal_stop_emission_by_name( G_OBJECT(_spinbutton), "value-changed" );

    int level = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(_spinbutton) );

    std::stringstream ss;
    std::locale mylocale("");
    ss.imbue( mylocale );
    switch( _geomplot.get_view() ) {
    case VIEW_XY:
	ss << "z = "<< _geom.origo(2)+level*_geom.h() << " m";
	break;
    case VIEW_XZ:
	ss << "y = "<< _geom.origo(1)+level*_geom.h() << " m";
	break;
    case VIEW_YZ:
	ss << "x = "<< _geom.origo(0)+level*_geom.h() << " m";
	break;
    case VIEW_ZX:
	ss << "y = "<< _geom.origo(1)+level*_geom.h() << " m";
	break;
    case VIEW_ZY:
	ss << "x = "<< _geom.origo(0)+level*_geom.h() << " m";
	break;
    case VIEW_YX:
	ss << "z = "<< _geom.origo(2)+level*_geom.h() << " m";
	break;
    default:
	throw( ErrorUnimplemented( ERROR_LOCATION ) );
	break;
    }
    gtk_statusbar_pop( GTK_STATUSBAR(_statusbar), 0 );
    gtk_statusbar_push( GTK_STATUSBAR(_statusbar), 0, ss.str().c_str() );

    // Update view
    _geomplot.set_view( _geomplot.get_view(), level );
    update_view();
    draw_and_expose();
}
Exemplo n.º 25
0
Arquivo: view.c Projeto: mrirecon/view
extern gboolean refresh_callback(GtkWidget *widget, gpointer data)
{
	struct view_s* v = data;

	v->invalid = true;

	long size = md_calc_size(DIMS, v->dims);
	double max = 0.;
	for (long j = 0; j < size; j++)
		if (max < cabsf(v->data[j]))
			max = cabsf(v->data[j]);

	if (0. == max)
		max = 1.;

	v->max = max;

	update_view(v);

	return FALSE;
}
Exemplo n.º 26
0
void GameOverLoop (double time_step) {
    CControl *ctrl = Players.GetCtrl (g_game.player_id);
    int width, height;
    width = param.x_resolution;
    height = param.y_resolution;
    check_gl_error();

    Music.Update ();

    ClearRenderContext ();
    Env.SetupFog ();

    update_view (ctrl, 0);

    if (final_frame != NULL) final_frame->Update (time_step, ctrl);

    SetupViewFrustum (ctrl);
    Env.DrawSkybox (ctrl->viewpos);
    Env.DrawFog ();
    Env.SetupLight ();

    RenderCourse ();
    DrawTrackmarks ();
    DrawTrees ();

    UpdateWind (time_step, ctrl);
    UpdateSnow (time_step, ctrl);
    DrawSnow (ctrl);

    Char.Draw (g_game.char_id);

    set_gl_options (GUI);
    SetupGuiDisplay ();
    if (final_frame != NULL) {
        if (!final_frame->active) GameOverMessage (ctrl);
    } else GameOverMessage (ctrl);
    DrawHud (ctrl);
    Reshape (width, height);
    Winsys.SwapBuffers ();
}
Exemplo n.º 27
0
static void * layout_thread(void * data)
{
    vx_gtk_buffer_manager_t * man = data;
    man->running = 1;

    while (man->running) {

        // wait for signal to redraw.
        pthread_mutex_lock(&man->mutex);
        while (!man->layout_update_required && man->running)
            pthread_cond_wait(&man->cond, &man->mutex);

        man->layout_update_required = 0;
        pthread_mutex_unlock(&man->mutex);

        update_view(man);

    }


    return NULL;
}
Exemplo n.º 28
0
int
get_input(int prompt_position, struct key *key)
{
	struct view *view;
	int i, key_value, cursor_y, cursor_x;

	if (prompt_position > 0)
		input_mode = true;

	memset(key, 0, sizeof(*key));

	while (true) {
		int delay = -1;

		if (opt_refresh_mode == REFRESH_MODE_PERIODIC) {
			delay = watch_periodic(opt_refresh_interval);
			bool refs_refreshed = false;
			foreach_displayed_view (view, i) {
				if (view_can_refresh(view) &&
					watch_dirty(&view->watch)) {
					if (!refs_refreshed) {
						load_refs(true);
						refs_refreshed = true;
					}
					refresh_view(view);
				}
			}
		}

		foreach_view (view, i) {
			update_view(view);
			if (view_is_displayed(view) && view->has_scrolled &&
			    use_scroll_redrawwin)
				redrawwin(view->win);
			view->has_scrolled = false;
			if (view->pipe)
				delay = 0;
		}
Exemplo n.º 29
0
void
BasicGrid::adjust_view() noexcept {
	auto const& view = this->view();
	if (
		view.row_range.x >  m_cursor.row ||
		view.row_range.y <= m_cursor.row ||
		view.col_range.x >  m_cursor.col ||
		view.col_range.y <= m_cursor.col
	) {
		auto row_begin = m_cursor.row;
		if (view.row_range.y <= m_cursor.row) {
			row_begin -= view.fit_count - 1;
		}
		update_view(
			row_begin,
			row_begin + view.fit_count,
			0,
			col_count(),
			true
		);
		enqueue_actions(UI::UpdateActions::render);
	}
}
Exemplo n.º 30
0
Arquivo: view.c Projeto: mrirecon/view
extern gboolean window_callback(GtkWidget *widget, gpointer data)
{
	struct view_s* v = data;

	v->mode = gtk_combo_box_get_active(v->gtk_mode);
	v->winlow = gtk_adjustment_get_value(v->gtk_winlow);
	v->winhigh = gtk_adjustment_get_value(v->gtk_winhigh);

	for (struct view_s* v2 = v->next; v2 != v; v2 = v2->next) {

		if (v->sync && v2->sync) {

			gtk_adjustment_set_value(v2->gtk_winlow, v->winlow);
			gtk_adjustment_set_value(v2->gtk_winhigh, v->winhigh);
			gtk_combo_box_set_active(v2->gtk_mode, v->mode);
		}
	}

	v->rgb_invalid = true;

	update_view(v);

	return FALSE;
}