static int
node_editor(struct nk_context *ctx)
{
    int n = 0;
    struct nk_rect total_space;
    const struct nk_input *in = &ctx->input;
    struct nk_command_buffer *canvas;
    struct node *updated = 0;
    struct node_editor *nodedit = &nodeEditor;

    if (!nodeEditor.initialized) {
        node_editor_init(&nodeEditor);
        nodeEditor.initialized = 1;
    }

    if (nk_begin(ctx, "NodeEdit", nk_rect(0, 0, 800, 600),
        NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE))
    {
        /* allocate complete window space */
        canvas = nk_window_get_canvas(ctx);
        total_space = nk_window_get_content_region(ctx);
        nk_layout_space_begin(ctx, NK_STATIC, total_space.h, nodedit->node_count);
        {
            struct node *it = nodedit->begin;
            struct nk_rect size = nk_layout_space_bounds(ctx);
            struct nk_panel *node = 0;

            if (nodedit->show_grid) {
                /* display grid */
                float x, y;
                const float grid_size = 32.0f;
                const struct nk_color grid_color = nk_rgb(50, 50, 50);
                for (x = (float)fmod(size.x - nodedit->scrolling.x, grid_size); x < size.w; x += grid_size)
                    nk_stroke_line(canvas, x+size.x, size.y, x+size.x, size.y+size.h, 1.0f, grid_color);
                for (y = (float)fmod(size.y - nodedit->scrolling.y, grid_size); y < size.h; y += grid_size)
                    nk_stroke_line(canvas, size.x, y+size.y, size.x+size.w, y+size.y, 1.0f, grid_color);
            }

            /* execute each node as a movable group */
            while (it) {
                /* calculate scrolled node window position and size */
                nk_layout_space_push(ctx, nk_rect(it->bounds.x - nodedit->scrolling.x,
                    it->bounds.y - nodedit->scrolling.y, it->bounds.w, it->bounds.h));

                /* execute node window */
                if (nk_group_begin(ctx, it->name, NK_WINDOW_MOVABLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER|NK_WINDOW_TITLE))
                {
                    /* always have last selected node on top */

                    node = nk_window_get_panel(ctx);
                    if (nk_input_mouse_clicked(in, NK_BUTTON_LEFT, node->bounds) &&
                        (!(it->prev && nk_input_mouse_clicked(in, NK_BUTTON_LEFT,
                        nk_layout_space_rect_to_screen(ctx, node->bounds)))) &&
                        nodedit->end != it)
                    {
                        updated = it;
                    }

                    /* ================= NODE CONTENT =====================*/
                    nk_layout_row_dynamic(ctx, 25, 1);
                    nk_button_color(ctx, it->color);
                    it->color.r = (nk_byte)nk_propertyi(ctx, "#R:", 0, it->color.r, 255, 1,1);
                    it->color.g = (nk_byte)nk_propertyi(ctx, "#G:", 0, it->color.g, 255, 1,1);
                    it->color.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, it->color.b, 255, 1,1);
                    it->color.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, it->color.a, 255, 1,1);
                    /* ====================================================*/
                    nk_group_end(ctx);
                }
                {
                    /* node connector and linking */
                    float space;
                    struct nk_rect bounds;
                    bounds = nk_layout_space_rect_to_local(ctx, node->bounds);
                    bounds.x += nodedit->scrolling.x;
                    bounds.y += nodedit->scrolling.y;
                    it->bounds = bounds;

                    /* output connector */
                    space = node->bounds.h / (float)((it->output_count) + 1);
                    for (n = 0; n < it->output_count; ++n) {
                        struct nk_rect circle;
                        circle.x = node->bounds.x + node->bounds.w-4;
                        circle.y = node->bounds.y + space * (float)(n+1);
                        circle.w = 8; circle.h = 8;
                        nk_fill_circle(canvas, circle, nk_rgb(100, 100, 100));

                        /* start linking process */
                        if (nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, circle, nk_true)) {
                            nodedit->linking.active = nk_true;
                            nodedit->linking.node = it;
                            nodedit->linking.input_id = it->ID;
                            nodedit->linking.input_slot = n;
                        }

                        /* draw curve from linked node slot to mouse position */
                        if (nodedit->linking.active && nodedit->linking.node == it &&
                            nodedit->linking.input_slot == n) {
                            struct nk_vec2 l0 = nk_vec2(circle.x + 3, circle.y + 3);
                            struct nk_vec2 l1 = in->mouse.pos;
                            nk_stroke_curve(canvas, l0.x, l0.y, l0.x + 50.0f, l0.y,
                                l1.x - 50.0f, l1.y, l1.x, l1.y, 1.0f, nk_rgb(100, 100, 100));
                        }
                    }

                    /* input connector */
                    space = node->bounds.h / (float)((it->input_count) + 1);
                    for (n = 0; n < it->input_count; ++n) {
                        struct nk_rect circle;
                        circle.x = node->bounds.x-4;
                        circle.y = node->bounds.y + space * (float)(n+1);
                        circle.w = 8; circle.h = 8;
                        nk_fill_circle(canvas, circle, nk_rgb(100, 100, 100));
                        if (nk_input_is_mouse_released(in, NK_BUTTON_LEFT) &&
                            nk_input_is_mouse_hovering_rect(in, circle) &&
                            nodedit->linking.active && nodedit->linking.node != it) {
                            nodedit->linking.active = nk_false;
                            node_editor_link(nodedit, nodedit->linking.input_id,
                                nodedit->linking.input_slot, it->ID, n);
                        }
                    }
                }
                it = it->next;
            }

            /* reset linking connection */
            if (nodedit->linking.active && nk_input_is_mouse_released(in, NK_BUTTON_LEFT)) {
                nodedit->linking.active = nk_false;
                nodedit->linking.node = NULL;
                fprintf(stdout, "linking failed\n");
            }

            /* draw each link */
            for (n = 0; n < nodedit->link_count; ++n) {
                struct node_link *link = &nodedit->links[n];
                struct node *ni = node_editor_find(nodedit, link->input_id);
                struct node *no = node_editor_find(nodedit, link->output_id);
                float spacei = node->bounds.h / (float)((ni->output_count) + 1);
                float spaceo = node->bounds.h / (float)((no->input_count) + 1);
                struct nk_vec2 l0 = nk_layout_space_to_screen(ctx,
                    nk_vec2(ni->bounds.x + ni->bounds.w, 3.0f + ni->bounds.y + spacei * (float)(link->input_slot+1)));
                struct nk_vec2 l1 = nk_layout_space_to_screen(ctx,
                    nk_vec2(no->bounds.x, 3.0f + no->bounds.y + spaceo * (float)(link->output_slot+1)));

                l0.x -= nodedit->scrolling.x;
                l0.y -= nodedit->scrolling.y;
                l1.x -= nodedit->scrolling.x;
                l1.y -= nodedit->scrolling.y;
                nk_stroke_curve(canvas, l0.x, l0.y, l0.x + 50.0f, l0.y,
                    l1.x - 50.0f, l1.y, l1.x, l1.y, 1.0f, nk_rgb(100, 100, 100));
            }

            if (updated) {
                /* reshuffle nodes to have least recently selected node on top */
                node_editor_pop(nodedit, updated);
                node_editor_push(nodedit, updated);
            }

            /* node selection */
            if (nk_input_mouse_clicked(in, NK_BUTTON_LEFT, nk_layout_space_bounds(ctx))) {
                it = nodedit->begin;
                nodedit->selected = NULL;
                nodedit->bounds = nk_rect(in->mouse.pos.x, in->mouse.pos.y, 100, 200);
                while (it) {
                    struct nk_rect b = nk_layout_space_rect_to_screen(ctx, it->bounds);
                    b.x -= nodedit->scrolling.x;
                    b.y -= nodedit->scrolling.y;
                    if (nk_input_is_mouse_hovering_rect(in, b))
                        nodedit->selected = it;
                    it = it->next;
                }
            }

            /* contextual menu */
            if (nk_contextual_begin(ctx, 0, nk_vec2(100, 220), nk_window_get_bounds(ctx))) {
                const char *grid_option[] = {"Show Grid", "Hide Grid"};
                nk_layout_row_dynamic(ctx, 25, 1);
                if (nk_contextual_item_label(ctx, "New", NK_TEXT_CENTERED))
                    node_editor_add(nodedit, "New", nk_rect(400, 260, 180, 220),
                            nk_rgb(255, 255, 255), 1, 2);
                if (nk_contextual_item_label(ctx, grid_option[nodedit->show_grid],NK_TEXT_CENTERED))
                    nodedit->show_grid = !nodedit->show_grid;
                nk_contextual_end(ctx);
            }
        }
        nk_layout_space_end(ctx);

        /* window content scrolling */
        if (nk_input_is_mouse_hovering_rect(in, nk_window_get_bounds(ctx)) &&
            nk_input_is_mouse_down(in, NK_BUTTON_MIDDLE)) {
            nodedit->scrolling.x += in->mouse.delta.x;
            nodedit->scrolling.y += in->mouse.delta.y;
        }
    }
    nk_end(ctx);
    return !nk_window_is_closed(ctx, "NodeEdit");
}
Ejemplo n.º 2
0
void draw_credits_tab(struct nk_context *ctx, int *tab_screen_height, struct credits_tab *credits)
{
	static struct time before_time, after_time;
	const float start_time_ratio[] = { 0.005f, 0.26f, 0.18f, 0.1f, 0.25f, 0.18f };
	const float atleast_atmost_ratio[] = { 0.005f, 0.28, 0.1f, 0.36f, 0.1f, 0.1f };
	static int start_atleast_int, start_atmost_int;
	*tab_screen_height = 472;

	//Start Credits Group
	nk_layout_row_dynamic(ctx, 210, 1);
	if(nk_group_begin(ctx, "Start Credits", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Enable, write below text as soon as possible.", &credits->is_start_text);

		nk_layout_row_dynamic(ctx, 85, 1);
		nk_edit_string(ctx, NK_EDIT_BOX, credits->start_text, &credits->start_text_len, 1000, nk_filter_ascii);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 6, start_time_ratio);
		nk_spacing(ctx, 1);
		nk_checkbox_label(ctx, "Before (MM:SS)", &credits->is_before);


		if (nk_combo_begin_label(ctx, credits->before_time_buffer, nk_vec2(100, 100))) {
			nk_layout_row_dynamic(ctx, 25, 1);
			sprintf(credits->before_time_buffer, "%02d:%02d", before_time.minutes, before_time.seconds);
			before_time.seconds = nk_propertyi(ctx, "#S:", 0, before_time.seconds, 60, 1, 1);
			before_time.minutes = nk_propertyi(ctx, "#M:", 0, before_time.minutes, 60, 1, 1);
			nk_combo_end(ctx);
		}

		nk_spacing(ctx, 1);

		nk_checkbox_label(ctx, "After (MM:SS)", &credits->is_after);


		if (nk_combo_begin_label(ctx, credits->after_time_buffer, nk_vec2(100, 100))) {
			nk_layout_row_dynamic(ctx, 25, 1);
			sprintf(credits->after_time_buffer, "%02d:%02d", after_time.minutes, after_time.seconds);
			after_time.seconds = nk_propertyi(ctx, "#S:", 0, after_time.seconds, 60, 1, 1);
			after_time.minutes = nk_propertyi(ctx, "#M:", 0, after_time.minutes, 60, 1, 1);
			nk_combo_end(ctx);
		}

		nk_layout_row(ctx, NK_DYNAMIC, 25, 6, atleast_atmost_ratio);
		nk_spacing(ctx, 1);
		nk_label(ctx, "Display credits at least", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, credits->start_atleast_sec, &credits->start_atleast_sec_len, 3, nk_filter_decimal);
		nk_label(ctx, "seconds and not longer than", NK_TEXT_CENTERED);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, credits->start_atmost_sec, &credits->start_atmost_sec_len, 3, nk_filter_decimal);
		nk_label(ctx, "seconds", NK_TEXT_RIGHT);

		nk_group_end(ctx);
	}

	//End Credits Group
	nk_layout_row_dynamic(ctx, 180, 1);
	if(nk_group_begin(ctx, "End Credits", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Enable, write below text after last caption and as close as possible to video end.", &credits->is_end_text);
		nk_layout_row_dynamic(ctx, 85, 1);
		nk_edit_string(ctx, NK_EDIT_BOX, credits->end_text, &credits->end_text_len, 1000, nk_filter_ascii);
		nk_layout_row(ctx,NK_DYNAMIC, 25, 6, atleast_atmost_ratio);
		nk_spacing(ctx, 1);
		nk_label(ctx, "Display credits at least", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, credits->end_atleast_sec, &credits->end_atleast_sec_len, 3, nk_filter_decimal);
		nk_label(ctx, "seconds and not longer than", NK_TEXT_CENTERED);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, credits->end_atmost_sec, &credits->end_atmost_sec_len, 3, nk_filter_decimal);
		nk_label(ctx, "seconds", NK_TEXT_RIGHT);

		nk_group_end(ctx);
	}
}
Ejemplo n.º 3
0
void draw_hd_homerun_tab(struct nk_context *ctx, int *tab_screen_height,
		struct hd_homerun_tab *hd_homerun,
		struct main_tab *main_settings)
{
	*tab_screen_height = 472;
	int setup_device = nk_false;
	const float location_ratio[] = { 0.35f, 0.5f, 0.15f };
	const float devices_ratio[] = { 0.8f, 0.2f };
	const float tuner_ratio[] = { .35f, 0.4f, 0.13 };
	const float channel_ratio[] = { 0.35f, 0.4f };
	const float program_ratio[] = { 0.35f, 0.4f };
	const float done_ratio[] = { 0.45f, 0.1f };
	const float ipv4_ratio[] = { 0.35f, 0.4f};
	const float port_ratio[] = { 0.35f, 0.4f };
	static int before_selected, after_selected;
	static int done = nk_false;
#if HD_HOMERUN
	nk_layout_row_dynamic(ctx, 25, 1);
	nk_label_colored_wrap(ctx, "'hdhomerun_config' command line utility found in environment.", nk_rgb(60, 255, 60));
#else
	nk_layout_row(ctx, NK_DYNAMIC, 25, 3, location_ratio);
	nk_label(ctx, "'hdhomerun_config' utility*:", NK_TEXT_LEFT);
	nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->location, &hd_homerun->location_len, 260, nk_filter_ascii);
	if(nk_button_label(ctx, "Browse"))
	{
		hd_homerun->is_homerun_browser_active = nk_true;
		main_settings->scaleWindowForFileBrowser = nk_true;
	}
	nk_layout_row_dynamic(ctx, 40, 1);
	nk_label_wrap(ctx, "*Absolute location of 'hdhomerun_config' executable. Displaying this message means "
			"either utility is not installed or environment variables aren't set for proper detection.");

#endif
	nk_layout_row_dynamic(ctx, 120, 1);
	if(nk_group_begin(ctx, "Choose a device:", NK_WINDOW_TITLE|NK_WINDOW_BORDER))
	{

		if(hd_homerun->device_num == 0)
		{
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "No devices found, yet. Please check your settings and try again.");
		}
		else
		{
			nk_layout_row_dynamic(ctx, 20, 1);
			for(int i = 0; i < hd_homerun->device_num; i++)
			{
				nk_selectable_label(ctx, hd_homerun->devices[i], NK_TEXT_LEFT, &hd_homerun->device_select[i]);
				if(hd_homerun->device_select[i])
				{
					before_selected = i - 1;
					after_selected = i + 1;
					for( int j = 0; j <= before_selected; j++)
						hd_homerun->device_select[j] = nk_false;
					for(int j = after_selected; j < hd_homerun->device_num; j++)
						hd_homerun->device_select[j] = nk_false;
				}
			}
			for(int i = 0; i < hd_homerun->device_num; i++)
			{
				if(hd_homerun->device_select[i] == nk_true)
				{
					hd_homerun->selected = i;
					break;
				}
				else
					hd_homerun->selected = -1;
			}
		}


		nk_group_end(ctx);
	}
	nk_layout_row(ctx, NK_DYNAMIC, 25, 2, devices_ratio);
	nk_spacing(ctx, 1);
	if(hd_homerun->selected == -1)
	{
		if(nk_button_label(ctx, "Find Devices"))
		{
			pthread_attr_init(&attr_find);

			int err = pthread_create(&tid_find, &attr_find, find_hd_homerun_devices, hd_homerun);
			if(!err)
				printf("Find Device thread created!\n");

		}
	}
	if(hd_homerun->selected != -1 && done == nk_false)
	{

		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, tuner_ratio);
		nk_label(ctx, "Tuner number in use:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->tuner, &hd_homerun->tuner_len, 2, nk_filter_decimal);
		nk_label(ctx, "(default is 0)", NK_TEXT_RIGHT);
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, channel_ratio);
		nk_label(ctx, "Channel number to select:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->channel, &hd_homerun->channel_len, 5, nk_filter_decimal);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, program_ratio);
		nk_label(ctx, "Program number for extraction:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->program, &hd_homerun->program_len, 10, nk_filter_decimal);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2,ipv4_ratio);
		nk_label(ctx, "Target IPv4 address:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->ipv4_address, &hd_homerun->ipv4_address_len, 16, nk_filter_ascii);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, port_ratio);
		nk_label(ctx, "Target Port number:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, hd_homerun->port_number, &hd_homerun->port_number_len, 7, nk_filter_decimal);


		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, done_ratio);
		nk_spacing(ctx, 1);
		if(nk_button_label(ctx, "Done"))
		{
				pthread_attr_init(&attr_setup);
				int err = pthread_create(&tid_setup, &attr_setup, setup_hd_homerun_device, hd_homerun);
				if(!err)
					printf("Setup Device thread created!\n");

				pthread_join(tid_setup, NULL);
				done = nk_true;
		}
	}
	if (done == nk_true)
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_label(ctx, "Stream is being transimitted to target.", NK_TEXT_CENTERED);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_label(ctx, "Please start CCExtractor with UDP settings if not started.", NK_TEXT_CENTERED);
	}



}
Ejemplo n.º 4
0
void draw_output_tab(struct nk_context *ctx, int *tab_screen_height, struct output_tab *output, struct main_tab *main_settings)
{
	const float roll_limit_ratio[] = { 0.55f, 0.45f };
	nk_flags active;
	static int len;
	static int cap_len;
	static int color_len = 6;
	const float gen_enc_ratio[] = { 0.701f, 0.302f };
	const float type_ratio[] = { 0.3f,0.7f };
	const float out_file_ratio[] = { 0.3f,0.53f,0.17f };
	const float cap_file_ratio[] = { 0.2f,0.63f,0.17f };
	const float delay_ratio[] = { 0.5f, 0.2f, 0.3f };
	const float color_roll_ratio[] = { 0.6f,0.401f };
	const float color_check_ratio[] = { 0.6f,0.23f,0.07f,0.1f };
	*tab_screen_height = 472;
	nk_layout_row(ctx, NK_DYNAMIC, 160, 2, gen_enc_ratio);

	//General Group
	if (nk_group_begin(ctx, "General", NK_WINDOW_TITLE |NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		int delay_secs = atoi(output->delay_sec_buffer);
		//Output Type
		nk_layout_row(ctx, NK_DYNAMIC, 20, 2, type_ratio);
		nk_label(ctx, "Output Type:", NK_TEXT_LEFT);
		output->type_select = nk_combo(ctx, output->type,  13, output->type_select, 25, nk_vec2(225, 200));

		//Output File
		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, out_file_ratio);
		nk_checkbox_label(ctx, "Output File:", &output->is_filename);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, output->filename, &output->filename_len, 255, nk_filter_ascii);
		if (nk_button_label(ctx, "Browse"))
		{
			main_settings->scaleWindowForFileBrowser = nk_true;
			output->is_output_browser_active = nk_true;
		}

		//Subtitle Delay
		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, delay_ratio);
		nk_checkbox_label(ctx, "Add delay in subtitles for", &output->is_delay);
		delay_secs = nk_propertyi(ctx, "", 0, delay_secs, 1000, 1, 1);
		sprintf(output->delay_sec_buffer, "%d", delay_secs);
		nk_label(ctx, "seconds", NK_TEXT_LEFT);
		
		//Export XDS info
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_checkbox_label(ctx, "Export XDS information (transcripts)", &output->is_export_xds);

		nk_group_end(ctx);
	}
	//Encoding Group
	if (nk_group_begin(ctx, "Encoding", NK_WINDOW_TITLE |NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		static int option = UTF;
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "Latin", output->encoding == LATIN)) {
			output->encoding = LATIN;
		}
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "Unicode", output->encoding == UNIC)) {
			output->encoding = UNIC;
		}
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "UTF-8", output->encoding == UTF)) {
			output->encoding = UTF;
		}

		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Byte Order Mark*", &output->is_bom);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_label(ctx, "*( For UNIX programs )", NK_TEXT_LEFT);
		nk_group_end(ctx);
	}


	nk_layout_row(ctx, NK_DYNAMIC, 100, 2, gen_enc_ratio);
	//Capitalization Group
	if(nk_group_begin(ctx, "Capitalization", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Standard capitalization rules.", &output->is_cap_standard);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, cap_file_ratio);
		nk_checkbox_label(ctx, "Cap file:", &output->is_cap_file);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, output->cap_dictionary, &output->cap_dictionary_len, 255, nk_filter_ascii);
		if (nk_button_label(ctx, "Browse"))
		{
			main_settings->scaleWindowForFileBrowser = nk_true;
			output->is_cap_browser_active = nk_true;
		}

		nk_group_end(ctx);
	}

	//Line Endings
	if (nk_group_begin(ctx, "Line Endings:", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR |NK_WINDOW_BORDER))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "CRLF (Windows)", output->line_ending == CRLF)) {
			output->line_ending = CRLF;
		}
		nk_layout_row_dynamic(ctx, 25, 1);
		if (nk_option_label(ctx, "LF (UNIX-like)", output->line_ending == LF)) {
			output->line_ending = LF;
		}

		nk_group_end(ctx);
	}

	nk_layout_row(ctx, NK_DYNAMIC, 170, 2, color_roll_ratio);
	//Colors and Styles Group
	if (nk_group_begin(ctx, "Colors and Styles", NK_WINDOW_TITLE | NK_WINDOW_BORDER))
	{

		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Center Text (remove left and right spaces)", &output->is_center);

		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Add dash (-) when speaker changes (for .srt)", &output->is_dash);
		
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Don't add typesetting tags(bold, italic, etc.)", &output->no_typesetting);

		nk_layout_row_dynamic(ctx, 20, 1);
		if(nk_option_label(ctx, "Don't add color information", output->font_color == NO_COLOR)) {
			output->font_color = NO_COLOR;
		}

		nk_layout_row(ctx, NK_DYNAMIC, 20, 4, color_check_ratio);
		if (nk_option_label(ctx, "Default color (RRGGBB)#", output->font_color == DEFAULT_COLOR)) {
			output->font_color = DEFAULT_COLOR;
		}
		active = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, output->color_hex, &color_len, 7, nk_filter_hex);
		nk_label(ctx, "or", NK_TEXT_CENTERED);
		if (nk_button_color(ctx, output->color_rgb))
			output->color_popup = nk_true;
		if (show_color_from_picker)
		{
			sprintf(output->color_hex, "%02X%02X%02X", output->color_rgb.r, output->color_rgb.g, output->color_rgb.b);
			show_color_from_picker = nk_false;
		}
		/*if (active & NK_EDIT_COMMITED) {
			output->color_rgb.r = (int)strtol(strncat(output->color_hex[0], output->color_hex[1], 2), NULL, 16);
			output->color_rgb.g = (int)strtol(strncat(output->color_hex[2], output->color_hex[3], 2), NULL, 16);
			output->color_rgb.b = (int)strtol(strncat(output->color_hex[4], output->color_hex[5], 2), NULL, 16);
			printf("%d%d%d", output->color_rgb.r, output->color_rgb.g, output->color_rgb.b);
		}*/

			
		nk_group_end(ctx);
	}

	

	//Roll-up Captions Group
	if (nk_group_begin(ctx, "Roll-up Captions", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		nk_layout_row_dynamic(ctx, 25, 1);
		if (nk_option_label(ctx, "Letters appear in realtime", output->onetime_or_realtime == REALTIME)) {
			output->onetime_or_realtime = REALTIME;
		}
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_label(ctx, "(Allows duplication of content)", NK_TEXT_LEFT);
		nk_layout_row(ctx, NK_DYNAMIC, 20, 2, roll_limit_ratio);
		nk_label(ctx, "Limit visible lines", NK_TEXT_LEFT);
		output->roll_limit_select = nk_combo(ctx, output->roll_limit, 4, output->roll_limit_select, 25, nk_vec2(80, 80));

		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "Letters appear line by line", output->onetime_or_realtime == ONETIME)) {
			output->onetime_or_realtime = ONETIME;
		}
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_label(ctx, "(No duplication of content)", NK_TEXT_LEFT);

		nk_group_end(ctx);
	}
	

}
Ejemplo n.º 5
0
void draw_decoders_tab(struct nk_context *ctx, int *tab_screen_height, struct decoders_tab *decoders)
{
	*tab_screen_height = 472;
	const float field_channel_ratio[] = { 0.5f, 0.5f };
	const float services_ratio[] = { 0.3f, 0.002f, 0.2f };
	const float min_distance_ratio[] = { 0.45f, 0.01f, 0.2f };
	const float max_distance_ratio[] = { 0.73f, 0.01f, 0.2f };

	nk_layout_row_dynamic(ctx, 160, 1);
	if(nk_group_begin(ctx, "608 Decoder", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row(ctx, NK_DYNAMIC, 85, 2, field_channel_ratio);
		if(nk_group_begin(ctx, "Field", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR))
		{
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_checkbox_label(ctx, "Extract captions from field 1", &decoders->is_field1);
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_checkbox_label(ctx, "Extract captions from field 2", &decoders->is_field2);

			nk_group_end(ctx);
		}
		if(nk_group_begin(ctx, "Channel", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR))
		{
			nk_layout_row_dynamic(ctx, 20, 1);
			if(nk_option_label(ctx, "Extract captions from channel 1", decoders->channel == CHANNEL_1))
			{
				decoders->channel = CHANNEL_1;
			}
			nk_layout_row_dynamic(ctx, 20, 1);
			if(nk_option_label(ctx, "Extract captions from channel 2", decoders->channel == CHANNEL_2))
			{
				decoders->channel = CHANNEL_2;
			}
			nk_group_end(ctx);
		}

		nk_layout_row_dynamic(ctx, 40, 1);
		nk_label_wrap(ctx, "In general, if you want English subtitles you don't need to use these options. "
				"If you want the second language (usually "
				"Spanish), you may need to try other combinations.");


		nk_group_end(ctx);
	}

	nk_layout_row_dynamic(ctx, 125, 1);
	if(nk_group_begin(ctx, "708 Decoder", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Enable 708 Decoder", &decoders->is_708);
		nk_layout_row(ctx, NK_DYNAMIC, 20, 3, services_ratio);
		nk_label(ctx, "Process these services", NK_TEXT_LEFT);
		nk_spacing(ctx, 1);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, decoders->services, &decoders->services_len, 15, nk_filter_ascii);
		nk_layout_row_dynamic(ctx, 45, 1);
		nk_label_wrap(ctx, "The service list is a comma seperated list of services to process. "
				"Valid values: 1 to 63. Ranges are NOT supported.");

		nk_group_end(ctx);
	}

	nk_layout_row_dynamic(ctx, 63, 1);
	if(nk_group_begin(ctx, "Teletext or DVB (if both are present)", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx,20, 2);
		if(nk_option_label(ctx, "Teletext", decoders->teletext_dvb == TELETEXT)){
			decoders->teletext_dvb = TELETEXT;
		}
		if(nk_option_label(ctx, "DVB", decoders->teletext_dvb == DVB)){
			decoders->teletext_dvb = DVB;
		}

		nk_group_end(ctx);
	}

	if(decoders->teletext_dvb == TELETEXT)
	{
		nk_layout_row_dynamic(ctx, 95, 1);
		if(nk_group_begin(ctx, "Teletext line duplication", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
		{
			nk_layout_row(ctx, NK_DYNAMIC, 25, 3, min_distance_ratio);
			nk_label(ctx, "Minimum allowed distance (default 2)", NK_TEXT_LEFT);
			nk_spacing(ctx, 1);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, decoders->min_distance, &decoders->min_distance_len, 3, nk_filter_decimal);
			nk_layout_row(ctx, NK_DYNAMIC, 25, 3, max_distance_ratio);
			nk_label(ctx, "Maximum allowed distance, as a %age of length (default is 10)", NK_TEXT_LEFT);
			nk_spacing(ctx, 1);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, decoders->max_distance, &decoders->max_distance_len, 3, nk_filter_decimal);


			nk_group_end(ctx);
		}
	}
}
Ejemplo n.º 6
0
/*Tab specific functions*/
void draw_input_tab(struct nk_context *ctx, int *tab_screen_height, struct input_tab *input,
		struct decoders_tab *decoders)
{
	const float screenful_limit_ratio[] = { 0.47f, 0.3f };
	static struct time from_time, until_time;
	const float stream_type_pid_ratio[] = { 0.7f,0.3f };
	const float mpeg_type_ratio[] = { 0.7f,0.3f };
	const float teletext_page_ratio[] = { 0.75f,0.25f };
	const float stream_teletext_ratio[] = { 0.5f, 0.501f };
	const float wait_data_ratio[] = { 0.6f, 0.25f, 0.15f };
	const float gen_type_ratio[] = { 0.3f, 0.7f };
	const float gen_time_ratio[] = { 0.6f ,0.401f};
	const char *split_type[] = { "Individual Files", "Parts of same video. Cut by generic tool", "Parts of same video. Cut by video tool" };
	static int split_num;
	*tab_screen_height = 472;

	nk_layout_row(ctx, NK_DYNAMIC, 150, 2, gen_time_ratio);
	//General Group
	if (nk_group_begin(ctx, "General", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		//Input Type
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, gen_type_ratio);
		nk_label(ctx, "Input Type:", NK_TEXT_LEFT);
		input->type_select = nk_combo(ctx, input->type, 9, input->type_select, 25, nk_vec2(225, 200));

		//Split Type
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, gen_type_ratio);
		nk_label(ctx, "Split Type:", NK_TEXT_LEFT);
		split_num = nk_combo(ctx, split_type, 3, split_num, 25, nk_vec2(240, 200));
		if (split_num == 2)
			input->is_split = nk_true;
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Live Stream.*", &input->is_live_stream);
		nk_layout_row(ctx, NK_DYNAMIC, 21, 3, wait_data_ratio);
		nk_label(ctx, "*Wait when no data arrives for", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, input->wait_data_sec, &input->wait_data_sec_len, 999, nk_filter_decimal);
		nk_label(ctx, "sec", NK_TEXT_LEFT);

		nk_group_end(ctx);
	}

	//Timing Group
	if (nk_group_begin(ctx, "Timing", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		//Process From
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Process From: (HH:MM:SS)", &input->is_process_from);
		nk_layout_row_dynamic(ctx, 25, 1);

		if (nk_combo_begin_label(ctx, input->from_time_buffer, nk_vec2(180, 250))) {
			sprintf(input->from_time_buffer, "%02d:%02d:%02d", from_time.hours, from_time.minutes, from_time.seconds);
			nk_layout_row_dynamic(ctx, 25, 1);
			from_time.seconds = nk_propertyi(ctx, "#Seconds:", 0, from_time.seconds, 60, 1, 1);
			from_time.minutes = nk_propertyi(ctx, "#Minutes:", 0, from_time.minutes, 60, 1, 1);
			from_time.hours = nk_propertyi(ctx, "#Hours:", 0, from_time.hours, 99, 1, 1);
			nk_combo_end(ctx);
		}


		//Process Until
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Process Until: (HH:MM:SS)", &input->is_process_until);
		nk_layout_row_dynamic(ctx, 25, 1);

		if (nk_combo_begin_label(ctx, input->until_time_buffer, nk_vec2(180, 250))) {
			sprintf(input->until_time_buffer, "%02d:%02d:%02d", until_time.hours, until_time.minutes, until_time.seconds);
			nk_layout_row_dynamic(ctx, 25, 1);
			until_time.seconds = nk_propertyi(ctx, "#Seconds:", 0, until_time.seconds, 60, 1, 1);
			until_time.minutes = nk_propertyi(ctx, "#Minutes:", 0, until_time.minutes, 60, 1, 1);
			until_time.hours = nk_propertyi(ctx, "#Hours:", 0, until_time.hours, 99, 1, 1);
			nk_combo_end(ctx);
		}

		nk_group_end(ctx);
	}

	nk_layout_row(ctx, NK_DYNAMIC, 150, 2, stream_teletext_ratio);
	//Elementary Stream Group
	if (nk_group_begin(ctx, "Elementary Stream", NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_TITLE | NK_WINDOW_BORDER))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "Auto", input->elementary_stream == AUTO_DETECT)) {
			input->elementary_stream = AUTO_DETECT;
		}
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, stream_type_pid_ratio);
		if (nk_option_label(ctx, "Process stream of type:", input->elementary_stream == STREAM_TYPE)) {
			input->elementary_stream = STREAM_TYPE;
		}
		nk_edit_string(ctx, NK_EDIT_SIMPLE, input->stream_type, &input->stream_type_len, 9, nk_filter_decimal);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, stream_type_pid_ratio);
		if (nk_option_label(ctx, "Process stream with PID:", input->elementary_stream == STREAM_PID)) {
			input->elementary_stream = STREAM_PID;
		}
		nk_edit_string(ctx, NK_EDIT_SIMPLE, input->stream_pid, &input->stream_pid_len, 9, nk_filter_decimal);

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, mpeg_type_ratio);
		nk_checkbox_label(ctx, "Assume MPEG type is:", &input->is_assume_mpeg);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, input->mpeg_type, &input->mpeg_type_len, 9, nk_filter_decimal);

		if(input->teletext_decoder == FORCE)
		{
			input->elementary_stream = STREAM_PID;
		}

		nk_group_end(ctx);
	}
	//Teletext Group
	if (nk_group_begin(ctx, "Teletext", NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_TITLE | NK_WINDOW_BORDER))
	{
		if(decoders->teletext_dvb == DVB){
			nk_layout_row_dynamic(ctx, 40, 1);
			nk_label_colored_wrap(ctx, "Teletext is disabled in Decoders->Teletext or DVB.", nk_rgb(255, 56, 38));
		}
		else
		{
			nk_layout_row_dynamic(ctx, 20, 1);
			if (nk_option_label(ctx, "Auto", input->teletext_decoder == AUTO_DECODE)) {
				input->teletext_decoder = AUTO_DECODE;
			}
			nk_layout_row_dynamic(ctx, 25, 1);
			if (nk_option_label(ctx, "Force Teletext decoder", input->teletext_decoder == FORCE)) {
				input->teletext_decoder = FORCE;
			}
			nk_layout_row_dynamic(ctx, 25, 1);
			if (nk_option_label(ctx, "Disable Teletext decoder", input->teletext_decoder == DISABLE)) {
				input->teletext_decoder = DISABLE;
			}

			nk_layout_row(ctx, NK_DYNAMIC, 20, 2, teletext_page_ratio);
			nk_checkbox_label(ctx, "Process Teletext Page #", &input->is_process_teletext_page);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, input->teletext_page_number, &input->teletext_page_numer_len, 99999, nk_filter_decimal);
		}

		nk_group_end(ctx);
	}


	//Screenfuls limit group
	nk_layout_row(ctx, NK_DYNAMIC, 95, 2, stream_teletext_ratio);
	if (nk_group_begin(ctx, "'Screenfuls' limit", NK_WINDOW_BORDER | NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR))
	{
		int screenful_limits = atoi(input->screenful_limit_buffer);
		
		nk_layout_row_dynamic(ctx, 20, 1);
		if (nk_option_label(ctx, "No limit", input->is_limit == NO_LIMIT))
		{
			input->is_limit = NO_LIMIT;
		}
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, screenful_limit_ratio);
		if (nk_option_label(ctx, "Screenful Limit:", input->is_limit == LIMITED)) {
			input->is_limit = LIMITED;
		}
		screenful_limits = nk_propertyi(ctx, "", 0, screenful_limits, 999, 1, 1);
		sprintf(input->screenful_limit_buffer, "%d", screenful_limits);
		


		nk_group_end(ctx);
	}

	//Clock group
	if (nk_group_begin(ctx, "Clock", NK_WINDOW_BORDER | NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 3);
		if (nk_option_label(ctx, "Auto", input->clock_input == AUTO))
		{
			input->clock_input = AUTO;
		}
		if (nk_option_label(ctx, "GOP", input->clock_input == GOP)) {
			input->clock_input = GOP;
		}
		if (nk_option_label(ctx, "PTS", input->clock_input == PTS)) {
			input->clock_input = PTS;
		}
		nk_group_end(ctx);
	}
}
Ejemplo n.º 7
0
void draw_advanced_input_tab(struct nk_context *ctx, int *tab_screen_height, struct advanced_input_tab *advanced_input)
{
	*tab_screen_height = 472;
	const float prog_myth_ratio[] = { 0.5f, 0.5f };
	const float prog_num_ratio[] = { 0.67f, 0.03f, 0.3f };

	nk_layout_row(ctx, NK_DYNAMIC, 125, 2, prog_myth_ratio);

	//Multiple Programs Group
	if(nk_group_begin(ctx, "Multiple Programs", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_TITLE))
	{
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_checkbox_label(ctx, "File contains multiple programs", &advanced_input->is_multiple_program);

		nk_layout_row_dynamic(ctx, 20, 1);
		if(nk_option_label(ctx, "Process first suitable program", advanced_input->multiple_program == FIRST_PROG))
		{
			advanced_input->multiple_program = FIRST_PROG;
		}
		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, prog_num_ratio);
		if(nk_option_label(ctx, "Process program with #", advanced_input->multiple_program == PROG_NUM))
		{
			advanced_input->multiple_program = PROG_NUM;
		}
		nk_spacing(ctx, 1);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, advanced_input->prog_number, &advanced_input->prog_number_len, 6, nk_filter_decimal);

		nk_group_end(ctx);
	}

	//Myth TV group
	if(nk_group_begin(ctx, "Myth TV", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		if(nk_option_label(ctx, "Auto", advanced_input->set_myth  == AUTO_MYTH))
		{
			advanced_input->set_myth = AUTO_MYTH;
		}

		nk_layout_row_dynamic(ctx, 20, 1);
		if(nk_option_label(ctx, "Force usage of Myth TV decoder", advanced_input->set_myth  == FORCE_MYTH))
		{
			advanced_input->set_myth = FORCE_MYTH;
		}

		nk_layout_row_dynamic(ctx, 20, 1);
		if(nk_option_label(ctx, "Disable Myth TV decoder", advanced_input->set_myth == DISABLE_MYTH))
		{
			advanced_input->set_myth = DISABLE_MYTH;
		}

		nk_group_end(ctx);
	}

	//Miscellaneous group
	nk_layout_row_dynamic(ctx, 210, 1);
	if(nk_group_begin(ctx, "Miscellaneous", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR))
	{
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Use 90090 as MPEG clock frequency instead of 90000 (needed for some DVDs", &advanced_input->is_mpeg_90090);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Use 0000 as CC padding instead of 8080", &advanced_input->is_padding_0000);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Use the pic_order_cnt_lsb in AVC/H.264 data streams to order the CC information", &advanced_input->is_order_ccinfo);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Work around  a bug in Win 7s software when converted from *.wtv to *.dvr-ms", &advanced_input->is_win_bug);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "File was captured from Hauppage card", &advanced_input->is_hauppage_file);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Force processing video track in MP4(instead of dedicated CC track", &advanced_input->is_process_mp4);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_checkbox_label(ctx, "Ignore broadcast date info (only affects Teletext in timed transcript with -datets)", &advanced_input->is_ignore_broadcast);


		nk_group_end(ctx);
	}
}
Ejemplo n.º 8
0
void draw_burned_subs_tab(struct nk_context *ctx, int *tab_screen_height, struct burned_subs_tab *burned_subs)
{
	*tab_screen_height = 472;
	const float color_mode_ratio[] = { 0.65f, 0.351f};
	const float preset_ratio[] = { 0.4f, 0.5f };
	const float custom_ratio[] = { 0.4f, 0.5f};
	const float delay_ratio[] = { 0.4f, 0.2f, 0.2f };
	const float threshold_ratio[] = { 0.9f, 0.1f };
	static char buffer[5];

	nk_layout_row_dynamic(ctx, 30, 1);
#if ENABLE_OCR
	nk_checkbox_label(ctx, "Enable Burned-in Subtitle Extraction", &burned_subs->is_burned_subs);
#else
	nk_label_colored(ctx, "Required Library not found. Cannot perform Burned subtitle extraction.", NK_TEXT_LEFT, nk_rgb(255, 56, 38));
#endif

	nk_layout_row(ctx, NK_DYNAMIC, 140, 2, color_mode_ratio);
	if(nk_group_begin(ctx, "Subtitle Color", NK_WINDOW_TITLE | NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, preset_ratio);
		if(nk_option_label(ctx, "Preset color:", burned_subs->color_type == PRESET)){
			burned_subs->color_type = PRESET;
		}
		burned_subs->subs_color_select = nk_combo(ctx, burned_subs->subs_color, 7, burned_subs->subs_color_select, 25, nk_vec2(100, 100));

		nk_layout_row(ctx, NK_DYNAMIC, 25, 2, custom_ratio);
		if(nk_option_label(ctx, "Custom Hue:", burned_subs->color_type == CUSTOM)){
			burned_subs->color_type = CUSTOM;
		}
		nk_edit_string(ctx, NK_EDIT_SIMPLE, burned_subs->custom_hue, &burned_subs->custom_hue_len, 4, nk_filter_decimal);
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_label_wrap(ctx, "Custom Hue can be between 1 and 360");
		nk_layout_row_dynamic(ctx, 20, 1);
		nk_label_wrap(ctx, "Refer to HSV color chart.");

		nk_group_end(ctx);
	}

	if(nk_group_begin(ctx, "OCR mode", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
	{
		nk_layout_row_dynamic(ctx, 25, 1);
		if(nk_option_label(ctx, "Frame - wise", burned_subs->ocr_mode == FRAME_WISE)){
			burned_subs->ocr_mode = FRAME_WISE;
		}
		nk_layout_row_dynamic(ctx, 25, 1);
		if(nk_option_label(ctx, "Word - wise", burned_subs->ocr_mode == WORD_WISE)){
			burned_subs->ocr_mode = WORD_WISE;
		}
		nk_layout_row_dynamic(ctx, 25, 1);
		if(nk_option_label(ctx, "Letter - wise", burned_subs->ocr_mode == LETTER_WISE)){
			burned_subs->ocr_mode = LETTER_WISE;
		}

		if(burned_subs->is_italic)
		{
			burned_subs->ocr_mode = WORD_WISE;
		}
		nk_group_end(ctx);
	}
	nk_layout_row_dynamic(ctx, 120, 1);
	if(nk_group_begin(ctx, "Minimum Subtitle Duration", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
	{
		nk_layout_row(ctx, NK_DYNAMIC, 25, 3, delay_ratio);
		nk_label(ctx, "Set the minimum subtitle duration to:", NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, burned_subs->min_duration, &burned_subs->min_duration_len, 4, nk_filter_float);
		nk_label(ctx, "seconds", NK_TEXT_LEFT);
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_label(ctx, "Lower values give better results but take more time.", NK_TEXT_LEFT);
		nk_layout_row_dynamic(ctx, 25, 1);
		nk_label(ctx, "0.5 is the recommended value.", NK_TEXT_LEFT);
		nk_group_end(ctx);
	}

	if(!burned_subs->subs_color_select && burned_subs->color_type == PRESET)
	{
		nk_layout_row_dynamic(ctx, 60, 1);
		if(nk_group_begin(ctx, "Luminance Threshold", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
		{
			nk_layout_row(ctx, NK_DYNAMIC, 20, 2, threshold_ratio);
			nk_slider_int(ctx, 0, &burned_subs->luminance_threshold, 100, 1);
			sprintf(buffer, "%d", burned_subs->luminance_threshold);
			nk_label(ctx, buffer, NK_TEXT_LEFT);

			nk_group_end(ctx);
		}
	}

	nk_layout_row_dynamic(ctx, 60, 1);
	if(nk_group_begin(ctx, "Confidence Threshold", NK_WINDOW_TITLE|NK_WINDOW_NO_SCROLLBAR | NK_WINDOW_BORDER))
	{
		nk_layout_row(ctx, NK_DYNAMIC, 20, 2, threshold_ratio);
		nk_slider_int(ctx, 0, &burned_subs->confidence_threshold, 100, 1);
		sprintf(buffer, "%d", burned_subs->confidence_threshold);
		nk_label(ctx, buffer, NK_TEXT_LEFT);

		nk_group_end(ctx);
	}

	nk_layout_row_dynamic(ctx, 30, 1);
	nk_checkbox_label(ctx, "Enable italics detection.", &burned_subs->is_italic);

}
Ejemplo n.º 9
0
int main(int argc, char** argv)
{
    if (argc > 2)
        message_and_abort_fmt("Usage: %s [filename]", argv[0]);

    Render::RenderSettings renderSettings;
    renderSettings.windowWidth = 800;
    renderSettings.windowHeight = 600;
    renderSettings.fullscreen = false;

    NuklearMisc::StandaloneGuiHandler guiHandler("Cel Viewer", renderSettings);

    nk_context* ctx = guiHandler.getNuklearContext();

    Settings::Settings settings;
    settings.loadFromFile("resources/celview.ini");

    bool faioInitDone = false;
    std::string listFile = settings.get<std::string>("celview", "listFile", "Diablo I.txt");
    std::string mpqFile = settings.get<std::string>("celview", "mpqFile", "DIABDAT.MPQ");

    std::vector<std::string> celFiles;

    std::string selectedImage = "";
    std::unique_ptr<NuklearMisc::GuiSprite> image;

    std::unique_ptr<NuklearMisc::GuiSprite> nextImage;

    int animate = false;
    int32_t frame = 0;

    float rowHeight = 30;
    auto lastFrame = std::chrono::high_resolution_clock::now();

    bool quit = false;
    while (!quit)
    {
        auto now = std::chrono::high_resolution_clock::now();

        if (nextImage)
            image = std::unique_ptr<NuklearMisc::GuiSprite>(nextImage.release());

        renderSettings = Render::getWindowSize();

        if (nk_begin(ctx, "main_window", nk_rect(0, 0, renderSettings.windowWidth, renderSettings.windowHeight), NK_WINDOW_NO_SCROLLBAR))
        {
            struct nk_rect bounds = nk_window_get_content_region(ctx);

            nk_layout_row_dynamic(ctx, bounds.h, 2);

            if (nk_group_begin(ctx, "image", 0))
            {
                nk_layout_row_dynamic(ctx, rowHeight, 1);

                std::string label = selectedImage;

                if (selectedImage == "")
                    label = "No image selected";

                nk_label(ctx, label.c_str(), NK_TEXT_CENTERED);

                nk_checkbox_label(ctx, "Animate", &animate);

                if (image)
                {
                    nk_label(ctx, (boost::format("Number of Frames: %1%") % image.get()->getSprite()->size()).str().c_str(), NK_TEXT_LEFT);
                    nk_label(ctx, (boost::format("Width: %1%") % image->getSprite()->getWidth()).str().c_str(), NK_TEXT_LEFT);
                    nk_label(ctx, (boost::format("Height: %1%") % image->getSprite()->getHeight()).str().c_str(), NK_TEXT_LEFT);
                    frame = nk_propertyi(ctx, "Frame", 0, frame, image->getSprite()->size(), 1, 0.2f);

                    if (nk_button_label(ctx, "save as png"))
                    {
                        nfdchar_t* outPath = NULL;
                        nfdresult_t result = NFD_SaveDialog("png", NULL, &outPath);
                        if (result == NFD_OKAY)
                        {
                            Render::SpriteGroup::toPng(selectedImage, outPath);
                            free(outPath);
                        }
                    }

                    if (nk_button_label(ctx, "save as gif"))
                    {
                        nfdchar_t* outPath = NULL;
                        nfdresult_t result = NFD_SaveDialog("gif", NULL, &outPath);
                        if (result == NFD_OKAY)
                        {
                            Render::SpriteGroup::toGif(selectedImage, outPath);
                            free(outPath);
                        }
                    }

                    auto msSinceLastFrame = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastFrame).count();
                    if (animate && msSinceLastFrame > 100)
                    {
                        lastFrame = now;
                        frame++;
                    }

                    if (frame >= (int32_t)image.get()->getSprite()->size())
                        frame = 0;

                    Render::Sprite sprite = image.get()->getSprite()->operator[](frame);

                    int32_t w, h;
                    Render::spriteSize(sprite, w, h);

                    nk_layout_space_begin(ctx, NK_STATIC, h, 1);
                    {
                        nk_layout_space_push(ctx, nk_rect(0, 0, w, h));

                        auto canvas = nk_window_get_canvas(ctx);

                        struct nk_rect imageRect;
                        nk_widget(&imageRect, ctx);
                        nk_fill_rect(canvas, imageRect, 0.0, nk_rgb(0, 255, 0));

                        auto img = image.get()->getNkImage(frame);
                        nk_draw_image(canvas, imageRect, &img, nk_rgb(255, 255, 255));
                    }
                    nk_layout_space_end(ctx);
                }

                nk_group_end(ctx);
            }

            if (nk_group_begin(ctx, "file list", 0))
            {
                if (!faioInitDone)
                {
                    nk_layout_row_dynamic(ctx, rowHeight * 2, 1);

                    NuklearMisc::nk_file_pick(ctx, "DIABDAT.MPQ", mpqFile, "mpq,MPQ", rowHeight);
                    NuklearMisc::nk_file_pick(ctx, "Diablo listfile", listFile, "txt", rowHeight);

                    if (nk_button_label(ctx, "load"))
                    {
                        FAIO::init(mpqFile, listFile);
                        celFiles = FAIO::listMpqFiles("*.cel");
                        auto tmp = FAIO::listMpqFiles("*.cl2");
                        celFiles.insert(celFiles.end(), tmp.begin(), tmp.end());

                        std::sort(celFiles.begin(), celFiles.end());

                        settings.set<std::string>("celview", "listFile", listFile);
                        settings.set<std::string>("celview", "mpqFile", mpqFile);
                        settings.save();

                        faioInitDone = true;

                        if (argc > 1)
                        {
                            selectedImage = argv[1];
                            frame = 0;
                            nextImage = std::unique_ptr<NuklearMisc::GuiSprite>(guiHandler.getSprite(new Render::SpriteGroup(selectedImage)));
                        }
                    }
                }

                nk_layout_row_dynamic(ctx, rowHeight, 1);

                for (size_t i = 0; i < celFiles.size(); i++)
                {
                    auto buttonStyle = ctx->style.button;

                    if (selectedImage == celFiles[i])
                        buttonStyle.normal = buttonStyle.hover;

                    if (nk_button_label_styled(ctx, &buttonStyle, celFiles[i].c_str()))
                    {
                        selectedImage = celFiles[i];
                        frame = 0;
                        nextImage = std::unique_ptr<NuklearMisc::GuiSprite>(guiHandler.getSprite(new Render::SpriteGroup(selectedImage)));
                    }
                }

                nk_group_end(ctx);
            }
        }
        nk_end(ctx);

        quit = guiHandler.update();
    }

    FAIO::quit();

    return 0;
}
Ejemplo n.º 10
0
void drawUI(nk_context* ctx, nk_colorf& bg)
{
    nk_glfw3_new_frame();

    /* GUI */
	if (nk_begin(ctx, "Buttons", nk_rect(1093, 0, 273, 360),
		NK_WINDOW_BORDER | NK_WINDOW_BACKGROUND)) {
		
		nk_layout_row_static(ctx, 30, 80, 1);
		nk_label(ctx, "Actions", NK_TEXT_LEFT);

		nk_layout_row_static(ctx, 30, 100, 2);
		if (nk_button_label(ctx, "Pause")) {
			Logger::ButtonPress(3);
			if (Controller::getInstance().state != Controller::paused) {
				prevstate = Controller::getInstance().state;
				Controller::getInstance().state = Controller::paused;
			}
		}
		if (nk_button_label(ctx, "Continue")) {
			Logger::ButtonPress(1);
			if (Controller::getInstance().state > 1)
				Controller::getInstance().state = prevstate;
		}
		if (nk_button_label(ctx, "Generate")) {
			Logger::ButtonPress(2);
			Controller::getInstance().way = Controller::getInstance().solver.Solve();

			if (Controller::getInstance().state == Controller::idle)
				Controller::getInstance().state = Controller::prepare;
		}
		if (nk_button_label(ctx, "Stop")) {
			Logger::ButtonPress(0);
			if (Controller::getInstance().way[0])
				Controller::getInstance().way = std::vector<spin>(1, Controller::getInstance().way[0]);
		}

		nk_layout_row_static(ctx, 30, 80, 1);
		nk_label(ctx, "Manual inputs", NK_TEXT_LEFT);

		nk_layout_row_begin(ctx, NK_STATIC, 30, 3); {

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(WL);
			}
			nk_label(ctx, "White", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(WR);
			}

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(YL);
			}
			nk_label(ctx, "Yellow", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(YR);
			}

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(RL);
			}
			nk_label(ctx, "Red", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(RR);
			}

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(BL);
			}
			nk_label(ctx, "Blue", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(BR);
			}

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(OL);
			}
			nk_label(ctx, "Orange", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(OR);
			}

			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Left")) {
				wayoverride(GL);
			}
			nk_label(ctx, "Green", NK_TEXT_CENTERED);
			if (nk_button_label(ctx, "Right")) {
				wayoverride(GR);
			}
		}
		nk_layout_row_end(ctx);
	}

    nk_end(ctx);

	if (nk_begin(ctx, "Code", nk_rect(1093, 350, 273, 350),
		NK_WINDOW_BORDER)) {

		static char linenums[256];
		std::string buf;
		std::istringstream str(Compiler::code);
		int linecount = 0;
		strcpy(linenums, "");
		while (std::getline(str, buf)) strcat(linenums, (std::to_string(++linecount) + "\n").c_str());
		strcat(linenums, (std::to_string(++linecount) + "\n").c_str());

		nk_layout_row_begin(ctx, NK_STATIC, 200, 2); {
			nk_layout_row_push(ctx, 40);
			if (nk_group_begin(ctx, "nums", NK_WINDOW_NO_SCROLLBAR)) {
				nk_layout_row_static(ctx, 1000, 40, 1);
				nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX, linenums, sizeof(linenums), nk_filter_default);
				nk_group_end(ctx);
			} 

			nk_layout_row_push(ctx, 200);
			if (nk_group_begin(ctx, "text", 0)) {
				nk_layout_row_static(ctx, 1000, 176, 1);
				nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX, Compiler::code, sizeof(Compiler::code), nk_filter_default);
				nk_group_end(ctx);
			}

			nk_uint *x = new nk_uint(0), *y = new nk_uint(0);
			nk_group_get_scroll(ctx, "text", x, y);
			nk_group_set_scroll(ctx, "nums", *x, *y);
			delete(x); delete(y);
		}

		nk_layout_row_begin(ctx, NK_STATIC, 30, 2); {
			nk_layout_row_push(ctx, 60);
			if (nk_button_label(ctx, "Run")) {
				Compiler::Compile();
			}
			if (nk_button_label(ctx, "Save")) {
				Compiler::Save();
			}
		}

		nk_layout_row_dynamic(ctx, 200, 1);
		nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX, Compiler::output, sizeof(Compiler::output), nk_filter_default);
	}

	nk_end(ctx);
}
Ejemplo n.º 11
0
void draw_network_popup(struct nk_context *ctx, struct network_popup *network_settings)
{
	const float save_ok_ratio[] = { 0.8f,0.1f,0.1f };
	const float udp_tcp_ratio[] = { 0.45f,0.1f,0.45f };
	static char udp_ipv4_buffer[30];
	static int udp_ipv4_len[30];
	static char tcp_pass_buf[30];
	static int tcp_pass_len[30];
	static char tcp_desc_buf[30];
	static int tcp_desc_len[30];
	static char send_port_buf[30];
	static int send_port_len[30];
	static char send_host_buf[30];
	static int send_host_len[30];
	const char network_attr[][30] = { "-udp port:", "-udp [host:]port:","-sendto host[:port]:","-tcp port:","-tcppassword password:"******"-tcpdesc description:" };
	static struct nk_rect s = { 20,30,480,500 };
	if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Network Settings", NK_WINDOW_CLOSABLE|NK_WINDOW_NO_SCROLLBAR, s))
	{
		nk_layout_row_dynamic(ctx, 220, 1);
		if(nk_group_begin(ctx, "Receive", NK_WINDOW_TITLE ))
		{
			nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
			nk_spacing(ctx, 1);
			nk_label(ctx, "UDP:", NK_TEXT_CENTERED);
			nk_layout_row_static(ctx, 20, 200, 2);
			nk_label(ctx, "Hostname/IPv4 Address:", NK_TEXT_LEFT);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->udp_ipv4, &network_settings->udp_ipv4_len, 50, nk_filter_default);

			nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
			nk_spacing(ctx, 1);
			nk_label(ctx, "TCP:", NK_TEXT_CENTERED);
			nk_layout_row_static(ctx, 20, 200, 2);
			nk_label(ctx, "Password:"******"Description:", NK_TEXT_LEFT);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->tcp_desc, &network_settings->tcp_desc_len, 25, nk_filter_default);

			nk_group_end(ctx);
		}

		nk_layout_row_dynamic(ctx, 200, 1);
		if (nk_group_begin(ctx, "Send", NK_WINDOW_TITLE ))
		{
			nk_layout_row(ctx, NK_DYNAMIC, 21, 3, udp_tcp_ratio);
			nk_spacing(ctx, 1);
			nk_label(ctx, "Send to:", NK_TEXT_CENTERED);
			nk_layout_row_static(ctx, 20, 200, 2);
			nk_label(ctx, "Port:", NK_TEXT_LEFT);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->send_port, &network_settings->send_port_len, 25, nk_filter_default);
			nk_layout_row_static(ctx, 20, 200, 2);
			nk_label(ctx, "Host:", NK_TEXT_LEFT);
			nk_edit_string(ctx, NK_EDIT_SIMPLE, network_settings->send_host, &network_settings->send_host_len, 25, nk_filter_default);

			nk_group_end(ctx);
		}

		/*nk_layout_row_static(ctx, 20, 200, 2);
		nk_label(ctx, network_attr[5], NK_TEXT_LEFT);
		nk_edit_string(ctx, NK_EDIT_SIMPLE, text_buffer[5], &text_len[5], 50, nk_filter_default);*/
	
		//OK Button
		nk_layout_row(ctx, NK_DYNAMIC, 27, 3, save_ok_ratio);
		nk_spacing(ctx, 1);
		if (nk_button_label(ctx, "Save")) {
			network_settings->save_network_settings = nk_true;
			network_settings->show_network_settings = nk_false;
			nk_popup_close(ctx);
		}
		if (nk_button_label(ctx, "OK")) {
			network_settings->save_network_settings = nk_false;
			network_settings->show_network_settings = nk_false;
			nk_popup_close(ctx);
		}

		nk_popup_end(ctx);
	}
	else
		network_settings->show_network_settings = nk_false;
}
Ejemplo n.º 12
0
void draw_about_ccx_popup(struct nk_context *ctx, int *show_about_ccx, struct nk_user_font *droid_big, struct nk_user_font *droid_head)
{
	const float ccx_ratio[] = { 0.3f,0.4f,0.3f };
	const float ok_ratio[] = { 0.9f,0.1f };
	static struct nk_rect s = { 20,30,480,500};
	if (nk_popup_begin(ctx, NK_POPUP_STATIC, "About CCExtractor", NK_WINDOW_CLOSABLE|NK_WINDOW_NO_SCROLLBAR, s))
	{
		nk_style_push_font(ctx, droid_big);
		nk_layout_row(ctx, NK_DYNAMIC, 30, 3, ccx_ratio);
		nk_spacing(ctx, 1);
		nk_label_wrap(ctx, "About CCExtractor"/*, NK_TEXT_LEFT*/);
		nk_style_pop_font(ctx);

		nk_layout_row_dynamic(ctx, 390, 1);
		if (nk_group_begin(ctx, "About CCExtractor", NK_WINDOW_BACKGROUND))
		{
			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "What's CCExtractor?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 65, 1);
			nk_label_wrap(ctx, "A tool that analyzes video files and produces independent subtitle files from the closed captions data. CCExtractor is portable, small, and very fast. It works in Linux, Windows, and OSX.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "What kind of closed captions does CCExtractor support?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 47, 1);
			nk_label_wrap(ctx, "American TV captions (CEA-608 is well supported, and CEA-708 is starting to look good) and Teletext based European subtitles.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "How easy is it to use CCExtractor?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 30, 1);
			nk_label_wrap(ctx, "Very. Just tell it what file to process and it does everything for you.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "CCExtractor integration with other tools");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 147, 1);
			nk_label_wrap(ctx, "It is possible to integrate CCExtractor in a larger process. A couple of tools already call CCExtractor as part their video process - this way they get subtitle support for free. Starting in 0.52, CCExtractor is very front - end friendly.Front - ends can easily get real - time status information.The GUI source code is provided and can be used for reference. Any tool, commercial or not, is specifically allowed to use CCExtractor for any use the authors seem fit. So if your favourite video tools still lacks captioning tool, feel free to send the authors here.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 50, 1);
			nk_label_wrap(ctx, "What's the point of generating separate files for subtitles, if they are already in the source file?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 367, 1);
			nk_label_wrap(ctx, "There are several reasons to have subtitles separated from the video file, including: - Closed captions never survive MPEG processing. If you take a MPEG file and encode it to any format (such as divx), your result file will not have closed captions. This means that if you want to keep the subtitles, you need to keep the original file. This is hardly practical if you are archiving HDTV shows for example. - Subtitles files are small - so small (around 250 Kb for a movie) that you can quickly download them, or email them, etc, in case you have a recording without subtitles. - Subtitles files are indexable: You can have a database with all your subtitles if you want (there are many available), so you can search the dialogs. - Subtitles files are a de-facto standard: Almost every player can use them. In fact, many setbox players accept subtitles files in .srt format - so you can have subtitles in your divx movies and not just in your original DVDs. - Closed captions are stored in many different formats by capture cards. Upgrading to a new card, if it comes with a new player, may mean that you can't use your previously recorded closed captions, even if the audio/video are fine. - Closed captions require a closed caption decoder. All US TV have one (it's a legal requirement), but no European TV does, since there are not closed captions in Europe (teletext is used instead). Basically this means that if you buy a DVD in the US which has closed captions but no DVD subtitles, you are out of luck. This is a problem with many (most) old TV shows DVDs, which only come with closed captions. DVD producers don't bother doing DVD subs, since it's another way to segment the market, same as with DVD regions. ");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "How I do use subtitles once they are in a separate file?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 80, 1);
			nk_label_wrap(ctx, "CCExtractor generates files in the two most common formats: .srt (SubRip) and .smi (which is a Microsoft standard). Most players support at least .srt natively. You just need to name the .srt file as the file you want to play it with, for example sample.avi and sample.srt.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "What kind of files can I extract closed captions from?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "CCExtractor currently handles:");
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- DVDs.");
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- Most HDTV captures(where you save the Transport Stream).");
			nk_layout_row_dynamic(ctx, 52, 1);
			nk_label_wrap(ctx, "- Captures where captions are recorded in bttv format.The number of cards that use this card is huge.My test samples came from a Hauppage PVR - 250. You can check the complete list here:");
			nk_layout_row_dynamic(ctx, 40, 1);
			nk_label_colored_wrap(ctx, "http://linuxtv.org/hg/v4l-dvb/file/tip/linux/Documentation/video4linux/CARDLIST.bttv", nk_rgb(61, 117, 206));
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- DVR - MS(microsoft digital video recording).");
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- Tivo files");
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- ReplayTV files");
			nk_layout_row_dynamic(ctx, 20, 1);
			nk_label_wrap(ctx, "- Dish Network files");
			nk_layout_row_dynamic(ctx, 80, 1);
			nk_label_wrap(ctx, "Usually, if you record a TV show with your capture card and CCExtractor produces the expected result, it will work for your all recordings.If it doesn't, which means that your card uses a format CCExtractor can't handle, please contact me and we'll try to make it work."); 

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "Can I edit the subtitles? ");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 43, 1);
			nk_label_wrap(ctx, ".srt files are just text files, with time information (when subtitles are supposed to be shown and for how long) and some basic formatting (use italics, bold, etc). So you can edit them with any text editor. If you need to do serious editing (such as adjusting timing), you can use subtitle editing tools - there are many available.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "Can CCExtractor generate other subtitles formats?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "At this time, CCExtractor can generate .srt, .smi and raw and bin files.");

			nk_style_push_font(ctx, droid_head);
			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "How I can contact the author?");
			nk_style_pop_font(ctx);

			nk_layout_row_dynamic(ctx, 23, 1);
			nk_label_wrap(ctx, "Send me an email: [email protected]");


			nk_group_end(ctx);
		}

		nk_layout_row(ctx, NK_DYNAMIC, 27, 2, ok_ratio);
		nk_spacing(ctx,1);
		if (nk_button_label(ctx, "OK")) {
			*show_about_ccx = nk_false;
			nk_popup_close(ctx);
		}
		nk_popup_end(ctx);
	}
	else
		*show_about_ccx = nk_false;
}