1
0
forked from 0ad/0ad

GUI engine cleanup.

Fix typos, remove unneeded comments.

This was SVN commit r18339.
This commit is contained in:
elexis 2016-06-07 12:02:33 +00:00
parent 29a069b6fb
commit a7b310f3bd
6 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -51,7 +51,6 @@ CCheckBox::CCheckBox()
AddSetting(GUIST_CStrW, "tooltip");
AddSetting(GUIST_CStr, "tooltip_style");
// Add text
AddText(new SGUIText());
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -419,7 +419,6 @@ bool CDropDown::MouseOver()
CRect rect(m_CachedActualSize.left, m_CachedActualSize.top,
m_CachedActualSize.right, GetListRect().bottom);
return rect.PointInside(GetMousePos());
}
else
@ -481,7 +480,6 @@ void CDropDown::Draw()
if (selected != -1) // TODO: Maybe check validity completely?
{
// figure out clipping rectangle
CRect cliparea(m_CachedActualSize.left, m_CachedActualSize.top,
m_CachedActualSize.right-button_width, m_CachedActualSize.bottom);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -73,7 +73,6 @@ void COList::SetupText()
if (scrollbar && GetScrollBar(0).GetStyle())
width -= GetScrollBar(0).GetStyle()->m_Width;
// Cache width for other use
m_TotalAvalibleColumnWidth = width;
float buffer_zone = 0.f;
@ -124,7 +123,6 @@ void COList::SetupText()
m_ItemsYPositions[pList->m_Items.size()] = buffered_y;
// Setup scrollbar
if (scrollbar)
{
GetScrollBar(0).SetScrollRange(m_ItemsYPositions.back());
@ -301,7 +299,6 @@ void COList::DrawList(const int& selected, const CStr& _sprite, const CStr& _spr
{
float bz = GetBufferedZ();
// First call draw on ScrollBarOwner
bool scrollbar;
GUI<bool>::GetSetting(this, "scrollbar", scrollbar);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -20,6 +20,9 @@
#include "GUI.h"
#include "CList.h"
/**
* Represents a column.
*/
struct ObjectDef
{
CColor m_TextColor;
@ -34,7 +37,7 @@ struct ObjectDef
* Individual cells are clipped if the contained text is too long.
*
* The list can be sorted dynamically by JS code when a
* heading is ckicked.
* heading is clicked.
* A scroll-bar will appear when needed.
*/
class COList : public CList
@ -57,8 +60,19 @@ protected:
virtual CRect GetListRect() const;
/**
* Available columns.
*/
std::vector<ObjectDef> m_ObjectsDefs;
/**
* Index of the selected column.
*/
size_t m_SelectedDef;
/**
* +1 for ascending, -1 for descending sort order.
*/
int m_SelectedColumnOrder;
private:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -25,11 +25,11 @@
#include "ps/CLogger.h"
// List of word demlimitor bounds
// The list contains ranges of word delimitors. The odd indexed chars are the start
// List of word delimiter bounds
// The list contains ranges of word delimiters. The odd indexed chars are the start
// of a range, the even are the end of a range. The list must be sorted in INCREASING ORDER
static const int NUM_WORD_DELIMITORS = 4*2;
static const u16 WordDelimitors[NUM_WORD_DELIMITORS] = {
static const int NUM_WORD_DELIMITERS = 4*2;
static const u16 WordDelimiters[NUM_WORD_DELIMITERS] = {
' ' , ' ', // spaces
'-' , '-', // hyphens
0x3000, 0x31FF, // ideographic symbols
@ -92,9 +92,9 @@ void CGUIString::GenerateTextCall(const CGUI* pGUI, SFeedback& Feedback, CStrInt
}
const TextChunk::Tag& tag = textChunk.m_Tags[0];
ENSURE(tag.m_TagType == TextChunk::Tag::TAG_IMGLEFT
|| tag.m_TagType == TextChunk::Tag::TAG_IMGRIGHT
|| tag.m_TagType == TextChunk::Tag::TAG_ICON);
ENSURE(tag.m_TagType == TextChunk::Tag::TAG_IMGLEFT ||
tag.m_TagType == TextChunk::Tag::TAG_IMGRIGHT ||
tag.m_TagType == TextChunk::Tag::TAG_ICON);
const std::string& path = utf8_from_wstring(tag.m_TagValue);
if (!pGUI->IconExists(path))
@ -450,13 +450,13 @@ void CGUIString::SetValue(const CStrW& str)
m_Words.push_back((int)i+1);
continue;
}
for (int n = 0; n < NUM_WORD_DELIMITORS; n += 2)
for (int n = 0; n < NUM_WORD_DELIMITERS; n += 2)
{
if (c <= WordDelimitors[n+1])
if (c <= WordDelimiters[n+1])
{
if (c >= WordDelimitors[n])
if (c >= WordDelimiters[n])
m_Words.push_back((int)i+1);
// assume the WordDelimitors list is stored in increasing order
// assume the WordDelimiters list is stored in increasing order
break;
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2016 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -186,22 +186,16 @@ CPos IGUIObject::GetMousePos() const
void IGUIObject::UpdateMouseOver(IGUIObject* const& pMouseOver)
{
// Check if this is the object being hovered.
if (pMouseOver == this)
{
if (!m_MouseHovering)
{
// It wasn't hovering, so that must mean it just entered
SendEvent(GUIM_MOUSE_ENTER, "mouseenter");
}
// Either way, set to true
m_MouseHovering = true;
// call mouse over
SendEvent(GUIM_MOUSE_OVER, "mousemove");
}
else // Some other object (or none) is hovered
else
{
if (m_MouseHovering)
{
@ -226,7 +220,6 @@ PSRETURN IGUIObject::SetSetting(const CStr& Setting, const CStrW& Value, const b
if (!SettingExists(Setting))
return PSRETURN_GUI_InvalidSetting;
// Get setting
SGUISetting set = m_Settings[Setting];
#define TYPE(type) \
@ -240,7 +233,6 @@ PSRETURN IGUIObject::SetSetting(const CStr& Setting, const CStrW& Value, const b
if (0)
;
// else...
#include "GUItypes.h"
#undef TYPE
else