aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UCommon.pas
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-15 17:57:15 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-15 17:57:15 +0000
commit962f21e84feb128c650c0478a6f7af337dacaee6 (patch)
tree3400c21a7d5c4a8533905db658838eba3694b1e7 /src/base/UCommon.pas
parent769eec744bdddb57279168deef4989eda85f9908 (diff)
downloadusdx-962f21e84feb128c650c0478a6f7af337dacaee6.tar.gz
usdx-962f21e84feb128c650c0478a6f7af337dacaee6.tar.xz
usdx-962f21e84feb128c650c0478a6f7af337dacaee6.zip
- port theme detection code from UIni to UThemes
- load new value DefaultSkin from themefiles - load value Color (skins default color) from skinfiles - use default skin and color on first start - use default skin and color on theme/skin change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2241 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/UCommon.pas')
-rw-r--r--src/base/UCommon.pas25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/base/UCommon.pas b/src/base/UCommon.pas
index fa0faf3c..18022337 100644
--- a/src/base/UCommon.pas
+++ b/src/base/UCommon.pas
@@ -45,6 +45,7 @@ uses
type
TStringDynArray = array of string;
+ TUTF8StringDynArray = array of UTF8String;
const
SepWhitespace = [#9, #10, #13, ' ']; // tab, lf, cr, space
@@ -88,6 +89,8 @@ procedure MergeSort(List: TList; CompareFunc: TListSortCompare);
function GetAlignedMem(Size: cardinal; Alignment: integer): pointer;
procedure FreeAlignedMem(P: pointer);
+function GetArrayIndex(const SearchArray: array of UTF8String; Value: string; CaseInsensitiv: boolean = false): integer;
+
implementation
@@ -514,6 +517,28 @@ begin
TempList.Free;
end;
+(**
+ * Returns the index of Value in SearchArray
+ * or -1 if Value is not in SearchArray.
+ *)
+function GetArrayIndex(const SearchArray: array of UTF8String; Value: string;
+ CaseInsensitiv: boolean = false): integer;
+var
+ i: integer;
+begin
+ Result := -1;
+
+ for i := 0 to High(SearchArray) do
+ begin
+ if (SearchArray[i] = Value) or
+ (CaseInsensitiv and (CompareText(SearchArray[i], Value) = 0)) then
+ begin
+ Result := i;
+ Break;
+ end;
+ end;
+end;
+
type
// stores the unaligned pointer of data allocated by GetAlignedMem()