Esempio n. 1
0
void ui_object_destroy_list_items (ui_object *list)
{

	ui_object
		*destroy_item,
		*current_list_item;

	if (!list)
	{

		return;
	}

	current_list_item = get_ui_object_child (list);

	while (current_list_item)
	{

		destroy_item = current_list_item;

		current_list_item = get_ui_object_next (current_list_item);

		if (get_ui_object_type (destroy_item) != UI_TYPE_VSLIDER)
		{

			destroy_ui_object (destroy_item);
		}
	}

	set_ui_object_child (list, NULL);
}
Esempio n. 2
0
int ui_object_destroy_list_item (ui_object *list, ui_object *item)
{

	ui_object
		*current_list_item;

	if ((!list) || (!item))
	{

		return FALSE;
	}

	current_list_item = get_ui_object_child (list);

	while (current_list_item)
	{

		if ((current_list_item == item) && (get_ui_object_type (current_list_item) != UI_TYPE_VSLIDER))
		{

			destroy_ui_object (current_list_item);

			return TRUE;
		}

		current_list_item = get_ui_object_next (current_list_item);
	}

	return FALSE;
}
Esempio n. 3
0
static void set_list_ui_object_state (ui_object *obj, int flag)
{
	
	area_ui_object
		*child_area,
		*area;

	ui_object
		*child;

	if (flag == UI_OBJECT_STATE_OFF)
	{
	
		area = obj->data;
	
		area->state = flag;
	
		child = get_ui_object_child (obj);
	
		while (child)
		{
	
			child_area = child->data;
	
//			child_area->state = flag;
	
			child = get_ui_object_next (child);
		}
	}
}
Esempio n. 4
0
float get_next_list_virtual_position (ui_object *list_object)
{

	float
		y,
		y_max;

	ui_object
		*y_max_object,
		*current_list_item;

	list_ui_object
		*list;

	list = list_object->data;

	current_list_item = get_ui_object_child (list_object);

	y_max_object = current_list_item;

	y_max = 0;

	if (current_list_item)
	{
	
		while (current_list_item)
		{

			if (get_ui_object_y (current_list_item) > y_max)
			{

				y_max_object = current_list_item;

				y_max = get_ui_object_y (current_list_item);
			}
	
			current_list_item = get_ui_object_next (current_list_item);
		}

		y = get_ui_object_y (y_max_object);
		y += get_ui_object_y_size (y_max_object);
		y -= get_ui_object_y (list_object);

		y /= get_ui_object_y_size (list_object);
		y += list->y_space;

		return y;
	}

	//return LIST_ITEM_SPACING * 2;
	return 0;
}
Esempio n. 5
0
void set_frontend_slider_graphics (ui_object *parent)
{
	ui_object
		*temp,
		*slider;

	slider = get_ui_object_vslider (parent);

	ASSERT (slider);

	ASSERT (frontend_slider_bar_graphic);
	ASSERT (frontend_slider_bar_highlighted_graphic);
	ASSERT (frontend_slider_bar_selected_graphic);

	ASSERT (frontend_slider_up_graphic);
	ASSERT (frontend_slider_up_highlighted_graphic);
	ASSERT (frontend_slider_up_selected_graphic);

	ASSERT (frontend_slider_down_graphic);
	ASSERT (frontend_slider_down_highlighted_graphic);
	ASSERT (frontend_slider_down_selected_graphic);

	set_ui_object_texture_graphic (slider, frontend_slider_bdrop_graphic);

//	set_ui_object_clear (slider, TRUE);

	// get slider & set graphic
	temp = get_ui_object_child (slider);
	set_ui_object_texture_graphic (temp, frontend_slider_bar_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_bar_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_bar_selected_graphic);
	set_ui_object_text (temp, "");

	// get up button & set graphic
	temp = get_ui_object_next (temp);
	set_ui_object_texture_graphic (temp, frontend_slider_up_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_up_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_up_selected_graphic);
	set_ui_object_text (temp, "");

	// get down button & set graphic
	temp = get_ui_object_next (temp);
	set_ui_object_texture_graphic (temp, frontend_slider_down_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_down_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_down_selected_graphic);
	set_ui_object_text (temp, "");
}
Esempio n. 6
0
void ui_object_unselect_list (ui_object *list)
{

	area_ui_object
		*area;

	ui_object
		*item;

	item = get_ui_object_child (list);

	while (item)
	{

		area = item->data;

		area->state = UI_OBJECT_STATE_OFF;

		item = get_ui_object_next (item);
	}
}
Esempio n. 7
0
ui_object *locate_next_slider (ui_object *obj)
{

	ui_object
		*current_object,
		*parent;

	// search through all next objects, starting with the first.
	// if not parent then start from current position.

	current_object = obj;

	parent = get_ui_object_parent (obj);

	if (parent)
	{
		
		current_object = get_ui_object_child (parent);
	}

	while (current_object)
	{

		if
			(
				(current_object->type == UI_TYPE_VSLIDER) ||
				(current_object->type == UI_TYPE_HSLIDER) ||
				(current_object->type == UI_TYPE_HVSLIDER) ||
				(current_object->type == UI_TYPE_MSLIDER)
			)
		{

			return current_object;
		}

		current_object = get_ui_object_next (current_object);
	}

	return NULL;
}
Esempio n. 8
0
static void set_area_ui_object_parent (ui_object *obj, ui_object *parent)
{
	
	area_ui_object
		*area;

	ui_object
		*next_child;

	area = obj->data;

	next_child = get_ui_object_child (parent);

	if (next_child)
	{

		while (get_ui_object_next (next_child))
		{

			next_child = get_ui_object_next (next_child);
		}

		set_ui_object_prev (obj, next_child);

		set_ui_object_next (next_child, obj);

		area->parent = parent;
	}
	else
	{

		area->parent = parent;

		set_area_ui_object_child (parent, obj);
	}
}
Esempio n. 9
0
static void set_number_ui_object_state (ui_object *obj, int flag)
{
	
	number_ui_object
		*number;

	ui_object
		*next,
		*parent;

	number = obj->data;

	if (flag == UI_OBJECT_STATE_ON)
	{
	
		parent = get_ui_object_parent (obj);
	
		if (parent)
		{
	
			next = get_ui_object_child (parent);
		}
		else
		{
	
			next = get_ui_object_next (obj);
		}
	
		while (next)
		{

			if (next->type == UI_TYPE_NUMBER)
			{
		
				number = next->data;
		
				number->area.state = UI_OBJECT_STATE_OFF;
			}
		
			next = get_ui_object_next (next);
		}

		number = obj->data;
								
		number->area.state = flag;
	
		if (parent)
		{
	
			set_ui_object_redraw (parent, TRUE);

			while ((parent) && (get_ui_object_clear (parent)))
			{

				parent = get_ui_object_parent (parent);

				if (parent)
				{

					set_ui_object_redraw (parent, TRUE);
				}
			}
		}
		else
		{
	
			set_ui_object_redraw (obj, TRUE);
		}
	}
}
Esempio n. 10
0
static void set_radio_ui_object_state (ui_object *obj, int flag)
{
	
	area_ui_object
		*area;

	ui_object
		*next,
		*parent;

	area = obj->data;

	if (flag == UI_OBJECT_STATE_ON)
	{
	
		parent = get_ui_object_parent (obj);
	
		if (parent)
		{
	
			next = get_ui_object_child (parent);
		}
		else
		{
	
			next = get_ui_object_next (obj);
		}
	
		while (next)
		{

			if (next->type == UI_TYPE_RADIO)
			{
		
				area = next->data;
		
				area->state = UI_OBJECT_STATE_OFF;
			}
		
			next = get_ui_object_next (next);
		}

		area = obj->data;
								
		area->state = flag;
	
		if (parent)
		{
	
			set_ui_object_redraw (parent, TRUE);

			while ((parent) && (get_ui_object_clear (parent)))
			{
	
				parent = get_ui_object_parent (parent);
	
				if (parent)
				{
	
					set_ui_object_redraw (parent, TRUE);
				}
			}
		}
		else
		{
	
			set_ui_object_redraw (obj, TRUE);
		}
	}
	else if (flag == UI_OBJECT_STATE_HIGHLIGHTED)
	{

		area->state = flag;
	}
	else if (flag == UI_OBJECT_STATE_OFF)
	{

//		if (area->state == UI_OBJECT_STATE_HIGHLIGHTED)			// Removed - DL
		{

			area->state = flag;
		}
	}
}
Esempio n. 11
0
void ui_object_list_item_function (ui_object *obj, void *arg)
{

	int
		list_position;

	ui_object
		*parent,
		*next_parent,
		*current_list_item;

	void
		((*pfunction) (ui_object *obj, void *arg));

	parent = get_ui_object_parent (obj);

	next_parent = parent;

	// set the next non-clear parent to redraw

	while ((next_parent) && (get_ui_object_clear (next_parent)))
	{

		next_parent = get_ui_object_parent (next_parent);

		if (next_parent)
		{

			set_ui_object_redraw (next_parent, TRUE);
		}
	}

	current_list_item = get_ui_object_child (parent);

	// find out what its list position is

	list_position = 0;

  	while (current_list_item)
	{
		
		list_position ++;

		if (obj == current_list_item)
		{

			break;
		}

		current_list_item = get_ui_object_next (current_list_item);
	}

	#if LIST_DEBUG

	debug_log ("UI LIST: item %d", list_position);

	#endif
		
	// notify parents function

	pfunction = get_ui_object_function (parent);

	if (pfunction)
	{

		pfunction (obj, (void *) list_position);
	}
}
Esempio n. 12
0
void set_radio_buttons_off (ui_object *obj)
{

	area_ui_object
		*area;

	ui_object
		*next,
		*parent;

	area = obj->data;

	parent = get_ui_object_parent (obj);

	if (parent)
	{

		next = get_ui_object_child (parent);
	}
	else
	{

		next = get_ui_object_next (obj);
	}

	while (next)
	{

		if (next->type == UI_TYPE_RADIO)
		{
	
			area = next->data;
	
			area->state = UI_OBJECT_STATE_OFF;
		}
	
		next = get_ui_object_next (next);
	}

	if (parent)
	{

		set_ui_object_redraw (parent, TRUE);

		while ((parent) && (get_ui_object_clear (parent)))
		{

			parent = get_ui_object_parent (parent);

			if (parent)
			{

				set_ui_object_redraw (parent, TRUE);
			}
		}
	}
	else
	{

		set_ui_object_redraw (obj, TRUE);
	}
}
Esempio n. 13
0
static void set_area_ui_object_parent (ui_object *obj, ui_object *parent)
{
	
	area_ui_object
		*area;

	ui_object
		*next;

	//
	// Remove object from current_parents list
	//

	if (get_ui_object_parent (obj))
	{

		ui_object
			*prev,
			*parent;

		next = get_ui_object_next (obj);
		prev = get_ui_object_prev (obj);

		parent = get_ui_object_parent (obj);

		if (next)
		{

			set_ui_object_prev (next, prev);
		}

		if (prev)
		{

			set_ui_object_next (prev, next);
		}

		if (get_ui_object_child (parent) == obj)
		{

			if (prev)
			{

				set_ui_object_child (parent, prev);
			}
			else if (next)
			{

				set_ui_object_child (parent, next);
			}
			else
			{

				set_ui_object_child (parent, NULL);
			}
		}
	}

	//
	// insert obj into new_parents list
	//

	area = (area_ui_object *) obj->data;

	next = get_ui_object_child (parent);

	if (area->next)
	{

		set_ui_object_prev (obj, NULL);

		area->parent = parent;

		set_ui_object_child (parent, obj);

		if (next)
		{

			set_ui_object_prev (next, obj);
		}
	}
	else if (next)
	{

		while (get_ui_object_next (next))
		{

			next= get_ui_object_next (next);
		}

		set_ui_object_prev (obj, next);

		set_ui_object_next (next, obj);

		area->parent = parent;
	}
	else
	{

		area->parent = parent;

		set_area_ui_object_child (parent, obj);
	}
}
Esempio n. 14
0
static void set_text_ui_object_state (ui_object *obj, int flag)
{
	
	area_ui_object
		*area;

	ui_object
		*next,
		*parent;

	area = obj->data;

	if (flag == UI_OBJECT_STATE_ON)
	{
	
		parent = get_ui_object_parent (obj);
	
		if (parent)
		{
	
			next = get_ui_object_child (parent);
		}
		else
		{
	
			next = get_ui_object_next (obj);
		}
	
		while (next)
		{

			if (next->type == UI_TYPE_TEXT)
			{
		
				area = next->data;
		
				area->state = UI_OBJECT_STATE_OFF;
			}
		
			next = get_ui_object_next (next);
		}

		area = obj->data;
								
		area->state = flag;
	
		if (parent)
		{

			set_ui_object_redraw (parent, TRUE);

			while ((parent) && (get_ui_object_clear (parent)))
			{

				parent = get_ui_object_parent (parent);

				if (parent)
				{

					set_ui_object_redraw (parent, TRUE);
				}
			}
		}
		else
		{
	
			set_ui_object_redraw (obj, TRUE);
		}
	}
}
Esempio n. 15
0
int combat_zone_read_text (void)
{

	ui_object
		*ui_line,
		*destroy_ui_line;

	int
		long_text_flag,
		value,
		line_count;

	FILE
		*file_ptr;

	char
		variable [64],
		operator_ [64],
		line [1024],
		filename [1024];

	file_tags
		tag;

	ui_line = get_ui_object_child (combat_zone_text_area);

	while (ui_line)
	{

		destroy_ui_line = ui_line;

		ui_line = get_ui_object_next (ui_line);

		destroy_ui_object (destroy_ui_line);
	}

	//
	//
	//

	line_count = 0;

	sprintf (filename, "%s\\%s\\%s", current_game_session->data_path, current_game_session->campaign_directory, current_game_session->campaign_filename);

	file_ptr = safe_fopen (filename, "r");

	long_text_flag = FALSE;

	while (TRUE)
	{

		tag = (file_tags) get_next_file_tag (file_ptr, application_tag_strings, FILE_TAG_APPLICATION_LAST_TAG);

		switch (tag)
		{

			case FILE_TAG_LANGUAGE_TEXT_START:
			{

				get_next_file_word (file_ptr, operator_, sizeof (operator_));

				// skip script till correct language

				while (tag = (file_tags) get_next_file_tag (file_ptr, application_tag_strings, FILE_TAG_APPLICATION_LAST_TAG))
				{

					#if (LANGUAGE == LANGUAGE_FRENCH)

					if (tag == FILE_TAG_LANGUAGE_FRENCH)
					{

						break;
					}
					#elif (LANGUAGE == LANGUAGE_GERMAN)

					if (tag == FILE_TAG_LANGUAGE_GERMAN)
					{

						break;
					}
					#elif (LANGUAGE == LANGUAGE_ITALIAN)

					if (tag == FILE_TAG_LANGUAGE_ITALIAN)
					{

						break;
					}
					#elif (LANGUAGE == LANGUAGE_SPANISH)

					if (tag == FILE_TAG_LANGUAGE_SPANISH)
					{

						break;
					}
					#else //LANGUAGE_ENGLISH

					if (tag == FILE_TAG_LANGUAGE_ENGLISH)
					{

						break;
					}
					#endif

					if (tag == FILE_TAG_LANGUAGE_TEXT_STOP)
					{

						break;
					}
				}

				break;
			}

			case FILE_TAG_LANGUAGE_TEXT_END:
			{

				get_next_file_word (file_ptr, operator_, sizeof (operator_));

				// skip script till end of languages

				while (tag = (file_tags) get_next_file_tag (file_ptr, application_tag_strings, FILE_TAG_APPLICATION_LAST_TAG))
				{

					if (tag == FILE_TAG_LANGUAGE_TEXT_STOP)
					{

						break;
					}
				}

				break;
			}

			case FILE_TAG_LONG_TEXT_START:
			{

				long_text_flag = TRUE;

				while (TRUE)
				{

					get_next_file_string (file_ptr, line, sizeof (line));

					if (strcmp ((line + 1), application_tag_strings [FILE_TAG_TEXT_END]) == 0)
					{

						break;
					}

					create_ui_object
								(
									UI_TYPE_TEXT,
									UI_ATTR_PARENT (combat_zone_text_area),
									UI_ATTR_POSITION (10, (line_count + 1) * 12),
									UI_ATTR_TEXT (line),
									UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_10),
									UI_ATTR_END
							  );

					line_count ++;
				}

				break;
			}

			case FILE_TAG_IF:
			{

				ASSERT (get_current_player_log ());
	
				get_next_file_word (file_ptr, variable, sizeof (variable));

				get_next_file_word (file_ptr, operator_, sizeof (operator_));

				value = get_next_file_int (file_ptr);

				if (!if_file_tag_variable (variable, operator_, value))
				{

					// skip script till endif

					while (tag = (file_tags) get_next_file_tag (file_ptr, application_tag_strings, FILE_TAG_APPLICATION_LAST_TAG))
					{

						if ((tag == FILE_TAG_ENDIF) || (tag == FILE_TAG_END))
						{

							break;
						}
					}
				}

				break;
			}

			case FILE_TAG_ENDIF:
			{

				break;
			}

			case FILE_TAG_END:
			{

				fclose (file_ptr);

				return long_text_flag;
			}
		}
	}

	return FALSE;
}