X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fflexui%2Ffui_style.pas;h=e28aea7cdd8155568c42ea4abce3af20ff0c1ea8;hb=51374402c2585a179840350b3db9681c418c3e6f;hp=31bbf2151767023e7526f184db7e9091cd34504a;hpb=f671ef276ead1f6faafaf14bb9cd6be9293908b9;p=d2df-sdl.git diff --git a/src/flexui/fui_style.pas b/src/flexui/fui_style.pas index 31bbf21..e28aea7 100644 --- a/src/flexui/fui_style.pas +++ b/src/flexui/fui_style.pas @@ -3,8 +3,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *) -{$INCLUDE ../../shared/a_modes.inc} +{$INCLUDE ../shared/a_modes.inc} {.$DEFINE UI_STYLE_DEBUG_SEARCH} unit fui_style; @@ -122,29 +121,15 @@ function uiFindStyle (const stname: AnsiString): TUIStyle; implementation +uses + fui_wadread; + -// ////////////////////////////////////////////////////////////////////////// // -const - defaultStyleStr = - 'default {'#10+ - ' back-color: #008;'#10+ - ' #active: { text-color: #fff; hot-color: #f00; switch-color: #fff; frame-color: #fff; frame-text-color: #fff; frame-icon-color: #0f0; }'#10+ - ' #inactive: { text-color: #aaa; hot-color: #a00; switch-color: #aaa; frame-color: #aaa; frame-text-color: #aaa; frame-icon-color: #0a0; }'#10+ - ' #disabled: { text-color: #666; hot-color: #600; switch-color: #666; frame-color: #888; frame-text-color: #888; frame-icon-color: #080; }'#10+ - ' @window: { #inactive(#active): { darken: 128; } }'#10+ - ' @button: { back-color: #999; text-color: #000; hot-color: #600; #active: { back-color: #fff; hot-color: #c00; } #disabled: { back-color: #444; text-color: #333; hot-color: #333; } }'#10+ - ' @label: { #inactive(#active); }'#10+ - ' @static: { text-color: #ff0; #inactive(#active); }'#10+ - ' @box: { #inactive(#active); }'#10+ - ' @switchbox: { #active: { back-color: #080; } #inactive: { switch-color: #fff; } }'#10+ - ' @checkbox(@switchbox): {}'#10+ - ' @radiobox(@switchbox): {}'#10+ - '}'#10+ - ''; var styles: array of TUIStyle = nil; +{ function createDefaultStyle (): TUIStyle; var st: TStream; @@ -158,6 +143,7 @@ begin FreeAndNil(st); end; end; +} function uiFindStyle (const stname: AnsiString): TUIStyle; @@ -169,10 +155,13 @@ begin for stl in styles do if (strEquCI1251(stl.mId, stname)) then begin result := stl; exit; end; end; for stl in styles do if (strEquCI1251(stl.mId, 'default')) then begin result := stl; exit; end; + raise Exception.Create('FlexUI FATAL: no "default" style in stylesheet'); + { stl := createDefaultStyle(); SetLength(styles, Length(styles)+1); styles[High(styles)] := stl; result := stl; + } end; @@ -180,7 +169,8 @@ procedure uiLoadStyles (const fname: AnsiString); var st: TStream; begin - st := openDiskFileRO(fname); + st := fuiOpenFile(fname); + if (st = nil) then raise Exception.Create('FlexUI file '''+fname+''' not found!'); try uiLoadStyles(st); finally @@ -224,9 +214,12 @@ begin end; // we should have "default" style for f := 0 to High(styles) do if (strEquCI1251(styles[f].mId, 'default')) then exit; + raise Exception.Create('FlexUI FATAL: no "default" style in stylesheet'); + { stl := createDefaultStyle(); SetLength(styles, Length(styles)+1); styles[High(styles)] := stl; + } end;