示例#1
0
void Ganash::ApplicationWindow::foo()
{
  // Ganash::Core::ContainerManager::remove_widget("main");
  // Ganash::Core::ContainerManager::add_widget(, "main");

  // Ganash::Core::ContainerManager::set_widget(, "main");
  // Ganash::Core::ContainerManager::get_widget("main");

  /*GdlDockMaster *master  = GDL_DOCK_MASTER (gdl_dock_object_get_master (GDL_DOCK_OBJECT (_dockbar->gobj())));
  const gchar *nick_name = "main";
  GdlDockObject *dockItem  = gdl_dock_master_get_object(master, nick_name);
  GList *children = gtk_container_get_children(GTK_CONTAINER(dockItem));
  gtk_container_remove(GTK_CONTAINER(dockItem), GTK_WIDGET(g_list_first(children)->data));

  GtkWidget *foo = gtk_label_new("Hello");
  gtk_widget_show(foo);
  gtk_container_add(GTK_CONTAINER(dockItem), foo);*/

  //GdlDockLayout * layout = gdl_dock_layout_new(GDL_DOCK(_dockbar->gobj()));
  //std::string filename("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/share/ganash/ui/layout-main-tools.xml");
  std::string filename("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/share/ganash/ui/layout.xml");

  set_layout(filename);

}
示例#2
0
gui::dialog::dimension_measurements file_dialog::layout(int xloc, int yloc)
{
	gui::dialog::dimension_measurements dim = dialog::layout(xloc, yloc);

	//shift the menu up
	unsigned y_shift = dim.menu_y - std::min<int>(dim.label_y, dim.textbox.y);
	int y_max = dim.menu_y + get_menu().height();
	dim.menu_y -= y_shift;

	//shift the extra buttons up
	if (show_directory_buttons_)
	{
		std::map<gui::dialog_button *, std::pair<int,int> >::iterator i;
		for(i = dim.buttons.begin(); i != dim.buttons.end(); ++i)
		{
			const int btn_h = i->first->height();
			int& btn_y = i->second.second;
			y_max = std::max<int>(y_max, btn_y + btn_h);
			btn_y -= y_shift;
		}
	}

	//shift the textbox down
	const int textbox_bottom_y = dim.textbox.y + get_textbox().height();
	const int label_bottom_y = dim.label_y + get_textbox().get_label()->height();
	y_shift = y_max - std::max<int>(textbox_bottom_y, label_bottom_y);
	dim.textbox.y += y_shift;
	dim.label_y += y_shift;

	set_layout(dim);
	return dim;
}
示例#3
0
文件: bar.c 项目: nqv/nilwm
static
void click_sym(struct bar_box_t *NIL_UNUSED(self), int NIL_UNUSED(x)) {
    struct arg_t arg;

    arg.i = -1;     /* next one */
    set_layout(&arg);
}
示例#4
0
	tab_bar::tab_bar(i_layout& aLayout, i_tab_page_container& aContainer) :
		widget(aLayout), iContainer(aContainer)
	{
		set_margins(neogfx::margins{});
		set_layout(std::make_shared<horizontal_layout>(*this));
		layout().set_margins(neogfx::margins{});
		layout().set_spacing(size{});
	}
示例#5
0
StructureClass::StructureClass(Value name, Value slots)
  : LispClass(WIDETAG_STRUCTURE_CLASS, 9)
{
  set_layout(structure_class_layout());
//   iset(3, make_value(structure_class_layout()));
  set_name(name);
  set_slots(slots);
}
示例#6
0
StructureClass::StructureClass(Value name)
  : LispClass(WIDETAG_STRUCTURE_CLASS, 9)
{
  set_layout(structure_class_layout());
  iset(3, make_value(structure_class_layout()));
  set_name(name);
//   set_slots(structure_class_instance_slots());
  set_slots(NIL);
}
示例#7
0
// TODO ContainerManager
void Ganash::ApplicationWindow::baz()
{
  //std::string filename("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/share/ganash/ui/layout-main-tools.xml");
  std::string filename("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/share/ganash/ui/layout.xml");
  filename = std::string("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/src/application/plugin/welcome/layout.xml");
  //filename = std::string("/home/sergio/Workspaces/Cpp/Gtk3/projects/ganash/trunk/share/ganash/ui/layout-welcome.xml");

  set_layout(filename);

}
示例#8
0
int main(int argc, char** argv) {
  // args
  FILE *outfile, *infile, *layoutfile;
  char *outfile_path = DEFAULT_OUTPUT_FILE;

  // sanity check on argument count
  if (argc < 3)
    err(ERR_USAGE, false, true);

  int optchar;
  while((optchar = getopt(argc, argv, "s:l:o:")) != -1) {
    switch (optchar) {
      case 's':
        // open script file
        infile = fopen(optarg, "rb");
        if (infile == NULL)
          err(ERR_CANNOT_OPEN_INFILE, true, true);
        break;
      case 'l':
        // open layout file
        layoutfile = fopen(optarg, "rb");
        if (layoutfile == NULL)
          err(ERR_CANNOT_OPEN_INFILE, true, true);
        break;
      case 'o':
        // get output file path
        outfile_path = optarg;
        break;
    }
  }

  // open output file
  outfile = fopen(outfile_path, "a");
  if (outfile == NULL)
    err(ERR_CANNOT_OPEN_OUTFILE, true, true);

  // load layout file
  struct Layout *layout = load_layout(layoutfile);
  if (layout == NULL)
    err(ERR_BAD_LAYOUTFILE, false, true);

  // set layout
  set_layout(layout);

  parse(infile, outfile);

  // free resources
  destroy_layout(layout);
  fclose(layoutfile);
  fclose(infile);
  fclose(outfile);


  return EXIT_SUCCESS;
}
示例#9
0
static void
set_style(Sheet *sheet, int row, int col,
          const psiconv_sheet_cell_layout psi_layout,
          const GnmStyle *default_style)
{
	GnmStyle *style = gnm_style_dup(default_style);
	if (!style)
		return;
	set_layout(style,psi_layout);
	sheet_style_set_pos(sheet,col,row,style);
}
示例#10
0
static void main_window_load(Window *window) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "main_window_load(%p)", (void*)window);

  set_layout(window, &layout);

  intialise_cylinder_layer(layout.hour_tens);
  intialise_cylinder_layer(layout.hour_ones);
  intialise_cylinder_layer(layout.minute_tens);
  intialise_cylinder_layer(layout.minute_ones);

  time_t start = time(NULL);
  update_time(localtime(&start), true);
}
示例#11
0
bool UnlitMaterialSystem::init(Context& context, const MaterialSystemContext& material_system_context)
{
	set_layout(StandartGeometryLayout::handle);

	if (!context.shader_manager.get(shader(), material_system_context.shader_name))
		return false;
	transform_uniform_ = context.uniform_pool.create();
	UniformBuffer& uniform = context.uniform_pool.get(transform_uniform_);
	UniformBufferDesc uniform_buffer_desc;
    uniform_buffer_desc.size = sizeof(TransformSimpleData);
    uniform_buffer_desc.unit = perframe_data_unit;
	return uniform.init(uniform_buffer_desc);
}
示例#12
0
StorageReserveWidget::StorageReserveWidget(ReserveStruct *rstruct,
                                           QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StorageReserveWidget)
{
    ui->setupUi(this);
    //ui->table_widget->set_
    this->source = rstruct->source_model;
    model = 0;

    set_columns_names();
    set_layout();
    fill_table();

    connects();
}
示例#13
0
bool SkyboxMaterialSystem::init(Context& context, const MaterialSystemContext& material_system_context)
{
    set_layout(SkyboxLayout::handle);

    if (!context.shader_manager.get(shader(), material_system_context.shader_name))
        return false;
    transform_uniform_ = context.uniform_pool.create();
    UniformBuffer& uniform = context.uniform_pool.get(transform_uniform_);
    UniformBufferDesc uniform_buffer_desc;
    create_uniform_buffer_element(uniform_buffer_desc, "inv_vp", mat4x4::identity());
    uniform_buffer_desc.name = "transform";
    uniform_buffer_desc.program = &default_program(context);
    if (!uniform.init(uniform_buffer_desc))
    {
        ERROR_LOG("Skybox material initialization failed - can't init uniform");
        return false;
    }
    return init_mesh(context, material_system_context);
}
示例#14
0
static void
add_worksheet(Workbook *wb, psiconv_sheet_worksheet psi_worksheet,int nr,
              psiconv_formula_list psi_formulas)
{
	Sheet *sheet;
	char *sheet_name;
	GnmStyle *default_style;
	psiconv_sheet_grid_section grid;

	sheet_name = g_strdup_printf (_("Sheet%d"),nr);
	sheet = sheet_new (wb, sheet_name, 256, 65536);
	g_free (sheet_name);
	if (!sheet)
		return;

	/* Default layout */
	default_style = gnm_style_new_default();
	if (!default_style) {
		g_object_unref (sheet);
		return;
	}
	set_layout(default_style,psi_worksheet->default_layout);

	/* TODO: Add show_zeros */
	grid = psi_worksheet->grid;
	if (grid) {
		sheet_row_set_default_size_pts
			(sheet, cm2pts (grid->default_row_height));
		sheet_col_set_default_size_pts
			(sheet, cm2pts (grid->default_column_width));
		if (grid->row_heights)
			set_row_heights (sheet, grid->row_heights);
		if (grid->column_heights)
			set_col_widths (sheet, grid->column_heights);
	}
	add_cells(sheet,psi_worksheet->cells,psi_formulas,default_style);

	/* TODO: What about the NULL? */
	sheet_flag_recompute_spans(sheet);
	workbook_sheet_attach (wb, sheet);
	gnm_style_unref (default_style);
}
示例#15
0
文件: mtable.cpp 项目: qks1/DocsPrint
MTable::MTable(QWidget *parent)
    : QWidget(parent)
{
    // создаём все кнопки и поя ввода даты, который для удобства размещения поместим на специальный виджет controls
    controls = new QWidget();
    from_label = new QLabel("С:");
    to_label = new QLabel("По:");
    type_label = new QLabel("Тип:");
    from_date = new QDateEdit();
    to_date = new QDateEdit;
    type_box = new QComboBox();
    refresh_button = new QPushButton("ОБНОВИТЬ");
    table = new QTableView();
    model = new QSqlQueryModel();
    pmodel = new MyProxyModel();

    // сохраним высоту строки, потом она нам понадобится, чтобы по неё калибровать ширину некоторых столбцов
    row_height = table->verticalHeader()->fontMetrics().height() + 2;

    //hidden - показываем или нет скрытые типы документов. По умолчанию - нет.
    hidden = false;
    // фильтр по типу документов. Пока пуст.
    filter = 0;

    // связываем модели и представления
    pmodel->setSourceModel(model);
    table->setModel(pmodel);

    // воплощаем всё в реальность
    set_columns_names();
    fill_checkbox();
    custom_dates();
    custom_table();
    set_layout();
    connects();
    fill();

}
示例#16
0
	toolbar::toolbar(i_layout& aLayout) : widget(aLayout)
	{
		set_margins(neogfx::margins{});
		set_layout(std::make_shared<horizontal_layout>(*this));
	}
示例#17
0
	toolbar::toolbar()
	{
		set_margins(neogfx::margins{});
		set_layout(std::make_shared<horizontal_layout>(*this));
	}
示例#18
0
static void
kbd_defaults(int kbd)
{
    scf_handle_t *h = NULL;
    scf_snapshot_t *snap = NULL;
    scf_instance_t *inst = NULL;
    scf_propertygroup_t *pg = NULL;
    scf_property_t *prop = NULL;
    scf_value_t *val = NULL;

    int layout_num;
    char *val_layout = NULL, *val_abort = NULL;
    uint8_t val_click;
    int64_t val_delay, val_rate;
    int64_t val_kbd_beeper, val_console_beeper;

    if ((h = scf_handle_create(SCF_VERSION)) == NULL ||
            scf_handle_bind(h) != 0 ||
            (inst = scf_instance_create(h)) == NULL ||
            (snap = scf_snapshot_create(h)) == NULL ||
            (pg = scf_pg_create(h)) == NULL ||
            (prop = scf_property_create(h)) == NULL ||
            (val = scf_value_create(h)) == NULL) {
        goto out;
    }

    if (scf_handle_decode_fmri(h, KBD_FMRI, NULL, NULL, inst,
                               NULL, NULL, SCF_DECODE_FMRI_REQUIRE_INSTANCE) != 0) {
        goto out;
    }

    if (scf_instance_get_snapshot(inst, "running", snap) != 0) {
        scf_snapshot_destroy(snap);
        snap = NULL;
    }

    if (scf_instance_get_pg_composed(inst, snap, KBD_PG, pg) != 0) {
        goto out;
    }

    if ((val_abort = malloc(KBD_MAX_NAME_LEN)) == NULL) {
        (void) fprintf(stderr,
                       "Can not alloc memory for keyboard properties\n");
        goto out;
    }

    if ((val_layout = malloc(KBD_MAX_NAME_LEN)) == NULL) {
        (void) fprintf(stderr,
                       "Can not alloc memory for keyboard properties\n");
        goto out;
    }

    if (scf_pg_get_property(pg, KBD_PROP_KEYCLICK, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_boolean(val, &val_click) == -1) {
        (void) fprintf(stderr, "Can not get KEYCLICK\n");
    }

    if (val_click == 1)
        (void) click("on", kbd);
    else if (val_click == 0)
        (void) click("off", kbd);
    else
        (void) fprintf(stderr,
                       BAD_DEFAULT_INT, KBD_PROP_KEYCLICK, val_click);

    if (scf_pg_get_property(pg, KBD_PROP_KEYBOARD_ABORT, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_astring(val, val_abort, KBD_MAX_NAME_LEN) == -1) {
        (void) fprintf(stderr, "Can not get KEYBOARD_ABORT\n");
    }

    if (*val_abort != '\0') {
        /*
         * ABORT must equal "enable", "disable" or "alternate"
         */
        if ((strcmp(val_abort, "enable") == 0) ||
                (strcmp(val_abort, "alternate") == 0) ||
                (strcmp(val_abort, "disable") == 0))
            (void) abort_enable(val_abort, kbd);
        else
            (void) fprintf(stderr, BAD_DEFAULT_STR,
                           KBD_PROP_KEYBOARD_ABORT, val_abort);
    }

    if (scf_pg_get_property(pg, KBD_PROP_RPTDELAY, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_integer(val, &val_delay) == -1) {
        (void) fprintf(stderr, "Can not get RPTDELAY\n");
    }

    if (val_delay > 0)
        (void) set_rptdelay(val_delay, kbd);
    else
        (void) fprintf(stderr,
                       BAD_DEFAULT_LLINT, KBD_PROP_RPTDELAY, val_delay);

    if (scf_pg_get_property(pg, KBD_PROP_RPTRATE, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_integer(val, &val_rate) == -1) {
        (void) fprintf(stderr, "Can not get RPTRATE\n");
    }

    if (val_rate > 0)
        (void) set_rptrate(val_rate, kbd);
    else
        (void) fprintf(stderr,
                       BAD_DEFAULT_LLINT, KBD_PROP_RPTRATE, val_rate);

    if (scf_pg_get_property(pg, KBD_PROP_LAYOUT, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_astring(val, val_layout, KBD_MAX_NAME_LEN) == -1) {
        (void) fprintf(stderr, "Can not get LAYOUT\n");
    }

    if (*val_layout != '\0') {
        /*
         * LAYOUT must be one of the layouts supported in kbd_layouts
         */
        if (get_layouts() != 0)
            goto out;

        if ((layout_num = get_layout_number(val_layout)) == -1) {
            (void) fprintf(stderr,
                           BAD_DEFAULT_STR, KBD_PROP_LAYOUT, val_layout);
            goto out;
        }

        (void) set_layout(kbd, layout_num);
    }

    if (scf_pg_get_property(pg, KBD_PROP_FREQ, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_integer(val, &val_kbd_beeper) == -1) {
        (void) fprintf(stderr, "Can not get FREQ\n");
    }

    if (val_kbd_beeper >= 0 && val_kbd_beeper <= INT16_MAX)
        (void) set_beep_freq(kbd, "keyboard", val_kbd_beeper);
    else
        (void) fprintf(stderr,
                       BAD_DEFAULT_LLINT, KBD_PROP_FREQ, val_kbd_beeper);

    if (scf_pg_get_property(pg, KBD_PROP_CONSFREQ, prop) != 0 ||
            scf_property_get_value(prop, val) != 0 ||
            scf_value_get_integer(val, &val_console_beeper) == -1) {
        (void) fprintf(stderr, "Can not get CONSFREQ\n");
    }

    if (val_console_beeper >= 0 && val_console_beeper <= INT16_MAX)
        (void) set_beep_freq(kbd, "console", val_console_beeper);
    else
        (void) fprintf(stderr,
                       BAD_DEFAULT_LLINT, KBD_PROP_CONSFREQ, val_console_beeper);

out:
    if (val_layout != NULL)
        free(val_layout);
    if (val_abort != NULL)
        free(val_abort);
    if (snap != NULL)
        scf_snapshot_destroy(snap);
    scf_value_destroy(val);
    scf_property_destroy(prop);
    scf_pg_destroy(pg);
    scf_instance_destroy(inst);
    scf_handle_destroy(h);
}
示例#19
0
/*
 * this routine gets the type of the keyboard being used
 */
static int
set_kbd_layout(int kbd, char *layout_name)
{
    int layout_num;
    int error = 1;

    /* layout setting is possible only for USB type keyboards */
    if (get_type(kbd) != KB_USB) {
        (void) fprintf(stderr, "The -s option does not apply for this"
                       " keyboard type.\n"
                       "Only USB/PS2 type keyboards support this option.\n");
        return (error);
    }

    /* get the language info from the layouts file */
    if (get_layouts() != 0)
        return (error);

    if (layout_name != NULL) {
        if ((layout_num = get_layout_number(layout_name)) == -1) {
            (void) fprintf(stderr, "%s: unknown layout name\n"
                           "Please refer to 'kbd -s' to get the "
                           "supported layouts.\n", layout_name);
            return (error);
        }
    } else {
        int i, j, print_cnt, input_num;
        boolean_t input_right = B_TRUE;
        boolean_t default_input = B_FALSE;
        char input[8]; /* 8 chars is enough for numbers */

        print_cnt = (layout_count % 2) ?
                    layout_count/2+1 : layout_count/2;

        for (i = 1; i <= print_cnt; i++) {
            (void) printf("%2d. %-30s", i,
                          layout_names[i-1]);
            j = i + print_cnt;
            if (j <= layout_count) {
                (void) printf("%-2d. %-30s\n", j,
                              layout_names[j-1]);
            }
        }
        (void) printf(gettext("\nTo select the keyboard layout,"
                              " enter a number [default %d]:"),
                      default_layout_number+1);

        for (;;) {
            if (input_right == B_FALSE)
                (void) printf(gettext("Invalid input. "
                                      "Please input a number "
                                      "(1,2,...):"));
            (void) memset(input, 0, 8);
            (void) fflush(stdin);
            (void) fgets(input, 8, stdin);
            if (strlen(input) > 4) {
                input_right = B_FALSE;
                continue;
            }
            if (input[0] == '\n') {
                default_input = B_TRUE;
                break;
            }
            input_right = B_TRUE;
            /* check if the inputs are numbers 0~9 */
            for (i = 0; i < (strlen(input) - 1); i++) {
                if ((input[i] < '0') ||
                        (input[i] > '9')) {
                    input_right = B_FALSE;
                    break;
                }
            }
            if (input_right == B_FALSE)
                continue;
            input_num = atoi(input);
            if ((input_num > 0) &&
                    (input_num <= layout_count))
                break;
            else
                input_right = B_FALSE;
        }
        if (default_input == B_TRUE)
            layout_num = DEFAULT_KBD_LAYOUT;
        else
            layout_num = layout_numbers[--input_num];
    }

    if ((error = set_layout(kbd, layout_num)) != 0)
        return (error);

    return (0);
}
示例#20
0
// ==========================================================================
// CONSTRUCTOR
// ==========================================================================
gm_tools_screen::gm_tools_screen()
    : pimpl_(std::make_shared<impl>())
{
    pimpl_->bestiary_page_           = std::make_shared<bestiary_page>();
    pimpl_->beast_editor_            = std::make_shared<beast_editor>();
    pimpl_->encounters_page_         = std::make_shared<encounters_page>();
    pimpl_->encounter_editor_        = std::make_shared<encounter_editor>();
    pimpl_->delete_beast_dialog_     = std::make_shared<delete_confirmation_dialog>();
    pimpl_->delete_encounter_dialog_ = std::make_shared<delete_confirmation_dialog>();

    pimpl_->bestiary_tab_card_ = munin::make_card();
    pimpl_->bestiary_tab_card_->add_face(pimpl_->bestiary_page_, bestiary_face);
    pimpl_->bestiary_tab_card_->add_face(pimpl_->beast_editor_, beast_editor_face);
    pimpl_->bestiary_tab_card_->add_face(pimpl_->delete_beast_dialog_, delete_beast_face);
    pimpl_->bestiary_tab_card_->select_face(bestiary_face);

    pimpl_->encounter_tab_card_ = munin::make_card();
    pimpl_->encounter_tab_card_->add_face(pimpl_->encounters_page_, encounters_face);
    pimpl_->encounter_tab_card_->add_face(pimpl_->encounter_editor_, encounter_editor_face);
    pimpl_->encounter_tab_card_->add_face(pimpl_->delete_encounter_dialog_, delete_encounter_face);
    pimpl_->encounter_tab_card_->select_face(encounters_face);

    pimpl_->bestiary_page_->on_edit.connect(
        [this](auto beast){pimpl_->on_edit_beast();});
    pimpl_->bestiary_page_->on_new.connect([this]{pimpl_->on_new_beast();});
    pimpl_->bestiary_page_->on_clone.connect(
        [this](auto beast){pimpl_->on_clone_beast();});
    pimpl_->bestiary_page_->on_fight.connect(on_fight_beast);
    pimpl_->bestiary_page_->on_delete.connect(
        [this](auto beast){pimpl_->on_delete_beast();});
    
    pimpl_->beast_editor_->on_save.connect([this]{pimpl_->on_save_beast();});
    pimpl_->beast_editor_->on_revert.connect([this]{pimpl_->on_revert_beast();});
    
    pimpl_->encounters_page_->on_new.connect([this]{pimpl_->on_new_encounter();});
    pimpl_->encounters_page_->on_edit.connect(
        [this](auto encounter){pimpl_->on_edit_encounter();});
    pimpl_->encounters_page_->on_clone.connect(
        [this](auto encounter){pimpl_->on_clone_encounter();});
    pimpl_->encounters_page_->on_fight.connect(on_fight_encounter);
    pimpl_->encounters_page_->on_delete.connect(
        [this](auto encounter){pimpl_->on_delete_encounter();});
    
    pimpl_->encounter_editor_->on_save.connect(
        [this]{pimpl_->on_save_encounter();});
    pimpl_->encounter_editor_->on_revert.connect(
        [this]{pimpl_->on_revert_encounter();});
    
    pimpl_->delete_beast_dialog_->on_delete_confirmation.connect(
        [this]{pimpl_->on_delete_beast_confirmation();});
    pimpl_->delete_beast_dialog_->on_delete_rejection.connect(
        [this]{pimpl_->on_delete_beast_rejection();});
    
    pimpl_->delete_encounter_dialog_->on_delete_confirmation.connect(
        [this]{pimpl_->on_delete_encounter_confirmation();});
    pimpl_->delete_encounter_dialog_->on_delete_rejection.connect(
        [this]{pimpl_->on_delete_encounter_rejection();});
    
    pimpl_->back_button_ = munin::make_button("Back");
    pimpl_->back_button_->on_click.connect(on_back);

    pimpl_->tabbed_panel_ = munin::make_tabbed_panel();
    pimpl_->tabbed_panel_->insert_tab("Bestiary", pimpl_->bestiary_tab_card_);
    pimpl_->tabbed_panel_->insert_tab("Encounters", pimpl_->encounter_tab_card_);

    auto content = get_container();
    content->set_layout(munin::make_compass_layout());
    content->add_component(pimpl_->tabbed_panel_, munin::COMPASS_LAYOUT_CENTRE);
    content->add_component(
        munin::view(
            munin::make_compass_layout(),
            pimpl_->back_button_, munin::COMPASS_LAYOUT_WEST,
            munin::make_background_fill(), munin::COMPASS_LAYOUT_CENTRE),
        munin::COMPASS_LAYOUT_SOUTH);
}
bool CSMDepthRenderingMaterialSystem::init(Context& context, const MaterialSystemContext& material_system_context)
{
    set_layout(StandartGeometryLayout::handle);

    if (!init_default(context, material_system_context))
        return false;

    size_t cascades_number = material_system_context.options.get<size_t>("cascades");
    size_t rt_height = material_system_context.options.get<size_t>("height");
    size_t rt_width = material_system_context.options.get<size_t>("width");
    const string& percentage_string = material_system_context.options.get<string>("percentage");
    const std::vector<string>& percentage = utils::split(percentage_string, string(","));
    ASSERT(percentage.size() == cascades_number, "The CSM configuration is invalid");
    for (size_t i = 0; i < cascades_number; ++i)
        percentage_.push_back(types_cast<float>(utils::trim_copy(percentage[i])) / 100.0f);

    pool_initializer<RenderTargetPool> render_target_wr(context.render_target_pool);
    RenderTarget& render_target = render_target_wr.object();
    RenderTargetDesc desc;
    desc.target = rt_readwrite;
    desc.color_targets = 0;
    desc.use_depth = true;
    desc.use_stencil = false;
    desc.depth_datatype = format_float;
    desc.depth_format = format_d24f;
    desc.width = rt_width * cascades_number;
    desc.height = rt_height;
    desc.depth_anisotropy = 1.0f;
    desc.depth_filter = texture_filter_nearest;
    if (!render_target.init(context, desc)) return false;

    texture_size_.set(desc.width, desc.height);
    cascade_size_.set(rt_width, rt_height);

    render_target.depth_texture(shadowmap_);

    for (size_t i = 0; i < cascades_number; ++i)
    {
        UniformBuffer& uniform_buffer = create_and_get(context.uniform_pool);
        UniformBufferDesc uniform_desc;
        uniform_desc.name = "transform";
        uniform_desc.program = &(default_program(context));
        if (!uniform_buffer.init(uniform_desc))
        {
            destroy(context);
            return false;
        }
        transform_uniform_id_.push_back(uniform_buffer.id());

        RenderState& render_state = create_and_get(context.render_state_pool);
        RenderStateDesc render_state_desc;
        render_state_desc.viewport.viewport.set(i * rt_width, 0, rt_width, rt_height);
        if (!render_state.init(render_state_desc))
        {
            destroy(context);
            return false;
        }

        render_states_[i] = render_state.id();
    }

    render_target_id_ = render_target_wr.take();

    profile_command_.set_stages(render_stage_begin_priority | render_stage_end_priority);
    list_of_commands_.add_command(&clear_command_);
    list_of_commands_.add_command(&profile_command_);

    cascades_number_ = cascades_number;

    UberShader::Info info = ubershader(context).info("SKINNING");
    UberShader::Index index;
    index.set(info, 1);
    shader_program_with_skinning_ = ubershader(context).get(index);

    return true;
}