static void add_text_display (ply_boot_splash_plugin_t *plugin, ply_text_display_t *display) { view_t *view; ply_terminal_t *terminal; view = view_new (plugin, display); terminal = ply_text_display_get_terminal (view->display); if (ply_terminal_open (terminal)) ply_terminal_activate_vt (terminal); ply_text_display_set_draw_handler (view->display, (ply_text_display_draw_handler_t) on_draw, view); ply_list_append_data (plugin->views, view); if (plugin->is_animating) view_start_animation (view); }
static void add_text_display (ply_boot_splash_plugin_t *plugin, ply_text_display_t *display) { view_t *view; ply_terminal_t *terminal; view = view_new (plugin, display); terminal = ply_text_display_get_terminal (view->display); if (ply_terminal_open (terminal)) { ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT); ply_terminal_activate_vt (terminal); } ply_text_display_set_draw_handler (view->display, (ply_text_display_draw_handler_t) on_draw, view); ply_list_append_data (plugin->views, view); }
/* since a lot of routines depend on the current_panel variable */ void set_display_type (int num, int type) { int x, y, cols, lines; int the_other; /* Index to the other panel */ char *file_name = 0; /* For Quick view */ Widget *new_widget, *old_widget; WPanel *the_other_panel; x =y = cols = lines = 0; old_widget = 0; if (num >= MAX_VIEWS){ fprintf (stderr, "Could not allocate more that %d views\n", MAX_VIEWS); abort (); } /* Check that we will have a WPanel * at least */ the_other = 0; if (type != view_listing){ the_other = num == 0 ? 1 : 0; if (panels [the_other].type != view_listing) return; } /* Get rid of it */ if (panels [num].widget){ Widget *w = panels [num].widget; WPanel *panel = (WPanel *) panels [num].widget; x = w->x; y = w->y; cols = w->cols; lines = w->lines; old_widget = panels [num].widget; if (panels [num].type == view_listing){ if (panel->frame_size == frame_full && type != view_listing){ cols = COLS - first_panel_size; if (num == 1) x = first_panel_size; } } #ifdef HAVE_TK tk_evalf ("container_clean %s", panel->widget.wcontainer); #endif } new_widget = 0; switch (type){ case view_listing: new_widget = (Widget *) panel_new (get_nth_panel_name (num)); break; case view_info: new_widget = (Widget *) info_new (); break; case view_tree: new_widget = (Widget *) tree_new (1, 0, 0, 0, 0); break; case view_quick: new_widget = (Widget *) view_new (0, 0, 0, 0, 1); the_other_panel = (WPanel *) panels [the_other].widget; if (the_other_panel) file_name = the_other_panel->dir.list[the_other_panel->selected].fname; else file_name = ""; view_init ((WView *) new_widget, 0, file_name, 0); break; } panels [num].type = type; panels [num].widget = (Widget *) new_widget; /* We set the same size the old widget had */ widget_set_size ((Widget *) new_widget, y, x, lines, cols); /* We wanna the new widget at the same position */ /* XView sets wcontainer to !0 <- Not XView, but we, when we create it */ /* Ok, the XView support code does it */ if (old_widget && old_widget->wcontainer){ new_widget->wcontainer = old_widget->wcontainer; new_widget->area = old_widget->area; } /* We use replace to keep the circular list of the dialog in the */ /* same state. Maybe we could just kill it and then replace it */ if (midnight_dlg && old_widget){ dlg_replace_widget (midnight_dlg, old_widget, panels [num].widget); } if (type == view_listing){ if (num == 0) left_panel = (WPanel *) new_widget; else right_panel = (WPanel *) new_widget; } if (type == view_tree) the_tree = (WTree *) new_widget; /* Prevent current_panel's value from becoming invalid. * It's just a quick hack to prevent segfaults. Comment out and * try following: * - select left panel * - invoke menue left/tree * - as long as you stay in the left panel almost everything that uses * cpanel causes segfault, e.g. C-Enter, C-x c, ... */ if (type != view_listing) if (cpanel == (WPanel *) old_widget) current_panel = num == 0 ? right_panel : left_panel; }
int view (char *_command, char *_file, int *move_dir_p, int start_line) { Dlg_head *our_dlg; GtkWidget *toplevel, *status, *scrollbar, *hbox; GtkVBox *vbox; WView *wview; WButtonBar *bar; int midnight_colors [4]; int error; /* Create dialog and widgets, put them on the dialog */ our_dlg = create_dlg (0, 0, 0, 0, midnight_colors, gnome_view_callback, "[Internal File Viewer]", "view", DLG_NO_TED | DLG_GNOME_APP); toplevel = GTK_WIDGET (our_dlg->wdata); vbox = GTK_VBOX (gtk_vbox_new (0, 0)); gtk_window_set_policy (GTK_WINDOW (toplevel), TRUE, TRUE, TRUE); gnome_app_set_contents (GNOME_APP (toplevel), GTK_WIDGET (vbox)); gtk_window_set_title (GTK_WINDOW (toplevel), _command ? _command : _file); wview = view_new (0, 0, 80, 25, 0); bar = buttonbar_new (1); add_widget (our_dlg, wview); add_widget (our_dlg, bar); error = view_init (wview, _command, _file, start_line); if (move_dir_p) *move_dir_p = 0; /* Please note that if you add another widget, * you have to modify view_adjust_size to * be aware of it */ if (error) return !error; status = gview_status (wview); gnome_app_create_menus_with_data (GNOME_APP (toplevel), gview_top_menu, wview); /* Setup the menus checkboxes correctly */ GTK_CHECK_MENU_ITEM (gview_mode_menu [WRAP_POS].widget)->active = wview->wrap_mode; GTK_CHECK_MENU_ITEM (gview_mode_menu [FORMAT_POS].widget)->active = wview->viewer_nroff_flag; GTK_CHECK_MENU_ITEM (gview_mode_menu [HEX_POS].widget)->active = wview->hex_mode; init_dlg (our_dlg); gtk_box_pack_start (GTK_BOX (vbox), status, 0, 1, 0); wview->sadj = gtk_adjustment_new (0.0, 0.0, 1000000.0, 1.0, 25.0, 25.0); scrollbar = gtk_vscrollbar_new (wview->sadj); gtk_signal_connect (GTK_OBJECT (wview->sadj), "value_changed", GTK_SIGNAL_FUNC(scrollbar_moved), wview); gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event", GTK_SIGNAL_FUNC (quit_view), wview); hbox = gtk_hbox_new (0, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, 1, 1, 0); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (wview->widget.wdata), 1, 1, 0); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (scrollbar), 0, 1, 0); gtk_widget_show_all (toplevel); return 1; }
GLvoid init_scene(GLvoid) { u_int* temp; temp = (u_int*) calloc(DIMS, sizeof(u_int)); // printf("allocated initial [%x]\n", temp); temp[0] = 0; temp[1] = 0; view_main = view_new(0, VIEW_NONE, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, 0, 0, 1, 1); view_main->draw_func = draw_scene; /* view_main->subviews[0] = view_new(0, VIEW_FG | VIEW_BG | VIEW_ASPECT, GL_DEPTH_BUFFER_BIT, 0.0, 0.0, 0.3, 0.3); view_main->subviews[0]->alpha = 0.5f; view_main->subviews[0]->draw_func = draw_static_board; */ board* b11; board* b12; board* b13; board* b21; board* b22; board* b23; board* b31; board* b32; board* b33; b11 = read_2d("boards/red-star-p.board"); b21 = read_2d("boards/red-saturn-p.board"); //b31 = read_2d("boards/red-gear-p.board"); b12 = read_2d("boards/red-gear-p.board"); b22 = read_2d("boards/red-moon-p.board"); //b32 = read_2d("boards/red-saturn-np.board"); //b13 = read_2d("boards/red-star-p.board"); //b23 = read_2d("boards/red-gear-np.board"); //b33 = read_2d("boards/red-moon-p.board"); // board_rotate_2d(b2, 1); // board_rotate_2d(b3, 3); // board_rotate_2d(b4, 2); boards_stich_2d(b11, DIR_RIGHT, b12); // boards_stich_2d(b12, DIR_RIGHT, b13); boards_stich_2d(b21, DIR_RIGHT, b22); //boards_stich_2d(b22, DIR_RIGHT, b23); //boards_stich_2d(b31, DIR_RIGHT, b32); //boards_stich_2d(b32, DIR_RIGHT, b33); boards_stich_2d(b11, DIR_DOWN, b21); //boards_stich_2d(b21, DIR_DOWN, b31); boards_stich_2d(b12, DIR_DOWN, b22); //boards_stich_2d(b22, DIR_DOWN, b32); //boards_stich_2d(b13, DIR_DOWN, b23); //boards_stich_2d(b23, DIR_DOWN, b33); board_clean_stich(b11); board_clean_stich(b12); //board_clean_stich(b13); board_clean_stich(b21); board_clean_stich(b22); //board_clean_stich(b23); //board_clean_stich(b31); //board_clean_stich(b32); //board_clean_stich(b33); tile_clear_flag(b11->origin, TILE_CHECKED); tile_fill_coord(b11->origin, temp); // exit(0); robots = robots_new(); robots_v = robots_new(); origin = b11->origin; cursor = origin; place_robot(COLOR_RED, origin); place_robot(COLOR_GREEN, origin->tile_p[DIR_RIGHT]); place_robot(COLOR_BLUE, origin->tile_p[DIR_DOWN]); place_robot(COLOR_YELLOW, origin->tile_p[DIR_RIGHT]->tile_p[DIR_RIGHT]); place_robot(COLOR_BLACK, origin->tile_p[DIR_DOWN]->tile_p[DIR_DOWN]); textures = (GLuint*) calloc(TEXTURES, sizeof(GLuint)); if (textures == NULL) pexit(errno, "init_scene: can't allocate texture array"); textures[TEXTURE_TILE] = gl_load_texture_png("gfx/tile.png", 0); textures[TEXTURE_MARK_MOON_RED] = gl_load_texture_png("gfx/mark_moon_red.png", 1); textures[TEXTURE_MARK_MOON_GREEN] = gl_load_texture_png("gfx/mark_moon_green.png", 1); textures[TEXTURE_MARK_MOON_BLUE] = gl_load_texture_png("gfx/mark_moon_blue.png", 1); textures[TEXTURE_MARK_MOON_YELLOW] = gl_load_texture_png("gfx/mark_moon_yellow.png", 1); textures[TEXTURE_MARK_STAR_RED] = gl_load_texture_png("gfx/mark_star_red.png", 1); textures[TEXTURE_MARK_STAR_GREEN] = gl_load_texture_png("gfx/mark_star_green.png", 1); textures[TEXTURE_MARK_STAR_BLUE] = gl_load_texture_png("gfx/mark_star_blue.png", 1); textures[TEXTURE_MARK_STAR_YELLOW] = gl_load_texture_png("gfx/mark_star_yellow.png", 1); textures[TEXTURE_MARK_SATURN_RED] = gl_load_texture_png("gfx/mark_saturn_red.png", 1); textures[TEXTURE_MARK_SATURN_GREEN] = gl_load_texture_png("gfx/mark_saturn_green.png", 1); textures[TEXTURE_MARK_SATURN_BLUE] = gl_load_texture_png("gfx/mark_saturn_blue.png", 1); textures[TEXTURE_MARK_SATURN_YELLOW] = gl_load_texture_png("gfx/mark_saturn_yellow.png", 1); textures[TEXTURE_MARK_GEAR_RED] = gl_load_texture_png("gfx/mark_gear_red.png", 1); textures[TEXTURE_MARK_GEAR_GREEN] = gl_load_texture_png("gfx/mark_gear_green.png", 1); textures[TEXTURE_MARK_GEAR_BLUE] = gl_load_texture_png("gfx/mark_gear_blue.png", 1); textures[TEXTURE_MARK_GEAR_YELLOW] = gl_load_texture_png("gfx/mark_gear_yellow.png", 1); textures[TEXTURE_MARK_WARP] = gl_load_texture_png("gfx/mark_warp.png", 1); glNewList(DRAW_LIST_TABLE, GL_COMPILE); draw_table(); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_TILE, GL_COMPILE); draw_tile(origin, DIR_LEFT, DRAW_TILE, 1.0f); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_TILE_TRANS, GL_COMPILE); draw_tile(origin, DIR_LEFT, DRAW_TILE, 0.75f); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_MARK, GL_COMPILE); glDisable(GL_DEPTH_TEST); draw_tile(origin, DIR_LEFT, DRAW_MARK, 1.0f); glEnable(GL_DEPTH_TEST); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_MARK_TRANS, GL_COMPILE); glDisable(GL_DEPTH_TEST); draw_tile(origin, DIR_LEFT, DRAW_MARK, 0.75f); glEnable(GL_DEPTH_TEST); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_WALL, GL_COMPILE); draw_tile(origin, DIR_LEFT, DRAW_WALL, 1.0f); glEndList(); tile_clear_flag(origin, TILE_DRAWN); glNewList(DRAW_LIST_PRISM, GL_COMPILE); draw_tile(origin, DIR_LEFT, DRAW_PRISM, 1.0f); glEndList(); compile_robots(); }
lui_list *lst_newA(tagitem *taglist) { tagitem *t; lui_list *lst; Uint32 bgcol=0; lst = calloc(1, sizeof(lui_list)); if(!lst) return NULL; lst->id = -1; lst->type = GAD_LIST; t = tag_next(&taglist); while(t) { switch(t->tag) { case LUI_NAME: lst->name = strdup((char *)t->data); break; case LUI_ID: lst->id = t->data; break; case LUI_DATA: lst->data = (void *)t->data; break; case LUI_ACTIVATEHOOK: lst->onactivate = (void *)t->data; break; case LUI_XPOS: lst->x = t->data; break; case LUI_YPOS: lst->y = t->data; break; case LUI_WIDTH: lst->w = t->data; break; case LUI_HEIGHT: lst->h = t->data; break; case LUI_SCREEN: lst->screen = (SDL_Surface *)t->data; break; case LST_UPHOOK: lst->onup = (void *)t->data; break; case LST_DOWNHOOK: lst->ondown = (void *)t->data; break; case LST_DRAWHOOK: lst->ondraw = (void *)t->data; break; case LST_BORDERWIDTH: lst->bw = t->data; break; case LST_BORDERHEIGHT: lst->bh = t->data; break; case LST_IMAGE: lst->bg = IMG_Load((char *)t->data); break; case LST_UPCLICKIMAGE: lst->upclick = view_new(XIVT_SCREEN, lst->screen, XIVT_XPOS, lst->x, XIVT_YPOS, lst->y, XIVT_BGCOL, bgcol, XIVT_IMAGE, t->data, XIVT_FLAGS, XIV_NOKEY, TAG_END); break; case LST_DOWNCLICKIMAGE: lst->downclick = view_new(XIVT_SCREEN, lst->screen, XIVT_XPOS, lst->x, XIVT_YPOS, (lst->y + lst->bg->h) - lst->bh, XIVT_BGCOL, bgcol, XIVT_IMAGE, t->data, XIVT_FLAGS, XIV_NOKEY, TAG_END); break; case LST_BGCOL: bgcol = t->data; } t = tag_next(&taglist); } if((!lst->screen) || (!lst->bg)) { lst_free(lst); return NULL; } if(!lst->w) lst->w = lst->bg->w; if(!lst->h) lst->h = lst->bg->h; lst->ia = iarea_new(IA_INPUT, IA_CTL_MOUSE, IA_MBUTTONS, IA_LMB_MASK, IA_XPOS, lst->x + lst->bw, IA_YPOS, lst->y + lst->bh, IA_WIDTH, lst->w - (lst->bw * 2), IA_HEIGHT, lst->h - (lst->bh * 2), IA_CLICK_HOOK, lst_activate, IA_PASS_HOOK, lui_highlight, IA_DATA, lst, IA_ID, lst->id, IA_DELAY, 75, TAG_END); lst->up = iarea_new(IA_INPUT, IA_CTL_MOUSE, IA_MBUTTONS, IA_LMB_MASK, IA_XPOS, lst->x, IA_YPOS, lst->y, IA_WIDTH, lst->w, IA_HEIGHT, lst->bh, IA_CLICK_HOOK, lst_upclick, IA_PASS_HOOK, lst_uprelease, IA_DATA, lst, IA_ID, lst->id, IA_DELAY, 75, TAG_END); lst->down = iarea_new(IA_INPUT, IA_CTL_MOUSE, IA_MBUTTONS, IA_LMB_MASK, IA_XPOS, lst->x, IA_YPOS, lst->y + lst->h - lst->bh, IA_WIDTH, lst->w, IA_HEIGHT, lst->bh, IA_CLICK_HOOK, lst_downclick, IA_PASS_HOOK, lst_downrelease, IA_DATA, lst, IA_ID, lst->id, IA_DELAY, 75, TAG_END); if((!lst->ia) || (!lst->up) || (!lst->down)){ lst_free(lst); return NULL; } lst->view = view_new(XIVT_SCREEN, lst->screen, XIVT_XPOS, lst->x + lst->bw, XIVT_YPOS, lst->y + lst->bh, XIVT_WIDTH, lst->w - (lst->bw * 2), XIVT_HEIGHT, lst->h - (lst->bh * 2), XIVT_BGCOL, bgcol, XIVT_FLAGS, XIV_FILLBACK | XIV_NOKEY | XIV_NOSTORE, TAG_END); if(!lst->view) { lst_free(lst); return NULL; } lst->add = lst_add; lst->rem = lst_rem; lst->destroy = lst_free; lst->activate = lst_activate; lst->draw = lst_draw; lst->highlight = 0; return lst; }