SkinData.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:137k
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- IniFile.WriteInteger(IDName, 'unenabledfontcolor', UnEnabledFontColor);
- IniFile.WriteInteger(IDName, 'framefontcolor', FrameFontColor);
- WriteBoolean(IniFile, IDName, 'morphing', Morphing);
- WriteMorphKind(IniFile, IDName, 'morphkind', MorphKind);
- WriteRect(IniFile, IDName, 'activeskinrect', ActiveSkinRect);
- WriteRect(IniFile, IDName, 'checkimagearea', CheckImageArea);
- WriteRect(IniFile, IDName, 'textarea', TextArea);
- WriteRect(IniFile, IDName, 'checkimagerect', CheckImageRect);
- WriteRect(IniFile, IDName, 'uncheckimagerect', UnCheckImageRect);
- WriteRect(IniFile, IDName, 'activecheckimagerect', ActiveCheckImageRect);
- WriteRect(IniFile, IDName, 'activeuncheckimagerect', ActiveUnCheckImageRect);
- WriteRect(IniFile, IDName, 'unenabledcheckimagerect', UnEnabledCheckImageRect);
- WriteRect(IniFile, IDName, 'unenableduncheckimagerect', UnEnabledUnCheckImageRect);
- end;
- constructor TspDataSkinMenuButtonControl.Create;
- begin
- inherited;
- end;
- procedure TspDataSkinMenuButtonControl.LoadFromFile;
- begin
- inherited;
- TrackButtonRect := ReadRect(IniFile, IDName, 'trackbuttonrect');
- end;
- procedure TspDataSkinMenuButtonControl.SaveToFile;
- begin
- inherited;
- WriteRect(IniFile, IDName, 'trackbuttonrect', TrackButtonRect);
- end;
- constructor TspDataSkinButtonControl.Create;
- begin
- inherited;
- FontName := 'Arial';
- FontStyle := [];
- FontHeight := 12;
- FontColor := 0;
- ActiveFontColor := 0;
- DownFontColor := 0;
- FontColor := 0;
- ActiveSkinRect := NullRect;
- DownSkinRect := NullRect;
- MorphKind := mkDefault;
- end;
- procedure TspDataSkinButtonControl.LoadFromFile;
- begin
- inherited;
- FontName := IniFile.ReadString(IDName, 'fontname', 'Arial');
- FontHeight := IniFile.ReadInteger(IDName, 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, IDName, 'fontstyle');
- FontColor := IniFile.ReadInteger(IDName, 'fontcolor', 0);
- ActiveFontColor := IniFile.ReadInteger(IDName, 'activefontcolor', 0);
- DisabledFontColor := IniFile.ReadInteger(IDName, 'disabledfontcolor', 0);
- DownFontColor := IniFile.ReadInteger(IDName, 'downfontcolor', 0);
- Morphing := ReadBoolean(IniFile, IDName, 'morphing');
- MorphKind := ReadMorphKind(IniFile, IDName, 'morphkind');
- ActiveSkinRect := ReadRect(IniFile, IDName, 'activeskinrect');
- DownSkinRect := ReadRect(IniFile, IDName, 'downskinrect');
- DisabledSkinRect := ReadRect(IniFile, IDName, 'disabledskinrect');
- end;
- procedure TspDataSkinButtonControl.SaveToFile;
- begin
- inherited;
- IniFile.WriteString(IDName, 'fontname', FontName);
- IniFile.WriteInteger(IDName, 'fontheight', FontHeight);
- WriteFontStyles(IniFile, IDName, 'fontstyle', FontStyle);
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- IniFile.WriteInteger(IDName, 'downfontcolor', DownFontColor);
- IniFile.WriteInteger(IDName, 'disabledfontcolor', DisabledFontColor);
- WriteBoolean(IniFile, IDName, 'morphing', Morphing);
- WriteMorphKind(IniFile, IDName, 'morphkind', MorphKind);
- WriteRect(IniFile, IDName, 'activeskinrect', ActiveSkinRect);
- WriteRect(IniFile, IDName, 'downskinrect', DownSkinRect);
- WriteRect(IniFile, IDName, 'disabledskinrect', DisabledSkinRect);
- end;
- constructor TspDataSkinArea.Create(AIDName: String; ARect: TRect);
- begin
- IDName := AIDName;
- AreaRect := ARect;
- end;
- constructor TspDataSkinObject.Create;
- begin
- IDName := AIDName;
- Hint := '';
- ActivePictureIndex := -1;
- SkinRect := NullRect;
- ActiveSkinRect := SkinRect;
- Morphing := False;
- CursorIndex := -1;
- RollUp := False;
- end;
- procedure TspDataSkinObject.LoadFromFile;
- begin
- Hint := IniFile.ReadString(IDName, 'hint', '');
- RollUp := ReadBoolean(IniFile, IDName, 'rollup');
- ActivePictureIndex := IniFile.ReadInteger(IDName, 'activepictureindex', -1);
- SkinRectInAPicture := ReadBoolean(IniFile, IDName, 'skinrectinapicture');
- CursorIndex := IniFile.ReadInteger(IDName, 'cursorindex', -1);
- SkinRect := ReadRect(IniFile, IDName, 'skinrect');
- ActiveSkinRect := ReadRect(IniFile, IDName, 'activeskinrect');
- Morphing := ReadBoolean(IniFile, IDName, 'morphing');
- MorphKind := ReadMorphKind(IniFile, IDName, 'morphkind');
- end;
- procedure TspDataSkinObject.SaveToFile;
- begin
- IniFile.EraseSection(IDName);
- IniFile.WriteString(IDName, 'hint', Hint);
- WriteBoolean(IniFile, IDName, 'rollup', RollUp);
- IniFile.WriteInteger(IDName, 'activepictureindex', ActivePictureIndex);
- WriteBoolean(IniFile, IDName, 'skinrectinapicture', SkinRectInAPicture);
- IniFile.WriteInteger(IDName, 'cursorindex', CursorIndex);
- WriteRect(IniFile, IDName, 'skinrect', SkinRect);
- WriteRect(IniFile, IDName, 'activeskinrect', ActiveSkinRect);
- WriteBoolean(IniFile, IDName, 'morphing', Morphing);
- WriteMorphKind(IniFile, IDName, 'morphkind', MorphKind);
- end;
- procedure TspDataUserObject.LoadFromFile;
- begin
- RollUp := ReadBoolean(IniFile, IDName, 'rollup');
- SkinRect := ReadRect(IniFile, IDName, 'skinrect');
- CursorIndex := IniFile.ReadInteger(IDName, 'cursorindex', -1);
- end;
- procedure TspDataUserObject.SaveToFile;
- begin
- IniFile.EraseSection(IDName);
- WriteBoolean(IniFile, IDName, 'rollup', RollUp);
- WriteRect(IniFile, IDName, 'skinrect', SkinRect);
- IniFile.WriteInteger(IDName, 'cursorindex', CursorIndex);
- end;
- procedure TspDataSkinFrameGaugeObject.LoadFromFile;
- var
- S: String;
- begin
- inherited;
- MinValue := IniFile.ReadInteger(IDName, 'minvalue', 0);
- MaxValue := IniFile.ReadInteger(IDName, 'maxvalue', 0);
- CountFrames := IniFile.ReadInteger(IDName, 'countframes', 0);
- S := IniFile.ReadString(IDName, 'framesplacement', 'fphorizontal');
- if S = 'fphorizontal'
- then FramesPlacement := fpHorizontal
- else FramesPlacement := fpVertical;
- end;
- procedure TspDataSkinFrameGaugeObject.SaveToFile;
- var
- S: String;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'minvalue', MinValue);
- IniFile.WriteInteger(IDName, 'maxvalue', MaxValue);
- IniFile.WriteInteger(IDName, 'countframes', CountFrames);
- if FramesPlacement = fpHorizontal
- then S := 'fphorizontal'
- else S := 'fpvertical';
- IniFile.WriteString(IDName, 'framesplacement', S);
- end;
- procedure TspDataSkinFrameRegulatorObject.LoadFromFile;
- var
- S: String;
- begin
- inherited;
- MinValue := IniFile.ReadInteger(IDName, 'minvalue', 0);
- MaxValue := IniFile.ReadInteger(IDName, 'maxvalue', 0);
- CountFrames := IniFile.ReadInteger(IDName, 'countframes', 0);
- S := IniFile.ReadString(IDName, 'framesplacement', 'fphorizontal');
- if S = 'fphorizontal'
- then FramesPlacement := fpHorizontal
- else FramesPlacement := fpVertical;
- S := IniFile.ReadString(IDName, 'kind', 'rkround');
- if S = 'rkround'
- then Kind := rkRound
- else
- if S = 'rkhorizontal'
- then Kind := rkHorizontal
- else Kind := rkVertical;
- end;
- procedure TspDataSkinFrameRegulatorObject.SaveToFile;
- var
- S: String;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'minvalue', MinValue);
- IniFile.WriteInteger(IDName, 'maxvalue', MaxValue);
- IniFile.WriteInteger(IDName, 'countframes', CountFrames);
- if FramesPlacement = fpHorizontal
- then S := 'fphorizontal'
- else S := 'fpvertical';
- IniFile.WriteString(IDName, 'framesplacement', S);
- case Kind of
- rkRound: S := 'rkround';
- rkVertical: S := 'rkvertical';
- rkHorizontal: S := 'rkhorizontal';
- end;
- IniFile.WriteString(IDName, 'kind', S);
- end;
- procedure TspDataSkinGauge.LoadFromFile;
- var
- S: String;
- begin
- inherited;
- MinValue := IniFile.ReadInteger(IDName, 'minvalue', 0);
- MaxValue := IniFile.ReadInteger(IDName, 'maxvalue', 0);
- S := IniFile.ReadString(IDName, 'kind', 'gkhorizontal');
- if S = 'gkhorizontal' then Kind := gkHorizontal else Kind := gkVertical;
- end;
- procedure TspDataSkinGauge.SaveToFile;
- var
- S: String;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'minvalue', MinValue);
- IniFile.WriteInteger(IDName, 'maxvalue', MaxValue);
- if Kind = gkHorizontal then S := 'gkhorizontal' else S := 'gkvertical';
- IniFile.WriteString(IDName, 'kind', S);
- end;
- procedure TspDataSkinTrackBar.LoadFromFile;
- begin
- inherited;
- ButtonRect := ReadRect(IniFile, IDName, 'buttonrect');
- ActiveButtonRect := ReadRect(IniFile, IDName, 'activebuttonrect');
- BeginPoint := ReadPoint(IniFile, IDName, 'beginpoint');
- EndPoint := ReadPoint(IniFile, IDName, 'endpoint');
- MinValue := IniFile.ReadInteger(IDName, 'minvalue', 0);
- MaxValue := IniFile.ReadInteger(IDName, 'maxvalue', 0);
- MouseDownChangeValue := ReadBoolean(IniFile, IDName, 'mousedownchangevalue');
- Morphing := False;
- end;
- procedure TspDataSkinTrackBar.SaveToFile;
- begin
- inherited;
- WriteRect(IniFile, IDName, 'buttonrect', ButtonRect);
- WriteRect(IniFile, IDName, 'activebuttonrect', ActiveButtonRect);
- WritePoint(IniFile, IDName, 'beginpoint', BeginPoint);
- WritePoint(IniFile, IDName, 'endpoint', EndPoint);
- IniFile.WriteInteger(IDName, 'minvalue', MinValue);
- IniFile.WriteInteger(IDName, 'maxvalue', MaxValue);
- WriteBoolean(IniFile, IDName, 'mousedownchangevalue', MouseDownChangeValue);
- end;
- procedure TspDataSkinAnimate.LoadFromFile;
- var
- S: String;
- begin
- inherited;
- Morphing := False;
- CountFrames := IniFile.ReadInteger(IDName, 'countframes', 1);
- Cycle := ReadBoolean(IniFile, IDName, 'cycle');
- ButtonStyle := ReadBoolean(IniFile, IDName, 'buttonstyle');
- TimerInterval := IniFile.ReadInteger(IDName, 'timerinterval', 50);
- S := IniFile.ReadString(IDName, 'command', 'cmdefault');
- if S = 'cmclose' then Command := cmClose else
- if S = 'cmmaximize' then Command := cmMaximize else
- if S = 'cmminimize' then Command := cmMinimize else
- if S = 'cmsysmenu' then Command := cmSysMenu else
- if S = 'cmdefault' then Command := cmDefault else
- Command := cmRollUp;
- end;
- procedure TspDataSkinAnimate.SaveToFile;
- var
- S: String;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'countframes', CountFrames);
- WriteBoolean(IniFile, IDName, 'cycle', Cycle);
- WriteBoolean(IniFile, IDName, 'buttonstyle', ButtonStyle);
- IniFile.WriteInteger(IDName, 'timerinterval', TimerInterval);
- if Command = cmClose then S := 'cmclose' else
- if Command = cmMaximize then S := 'cmmaximize' else
- if Command = cmMinimize then S := 'cmminimize' else
- if Command = cmSysMenu then S := 'cmsysmenu' else
- if Command = cmDefault then S := 'cmdefault' else
- S := 'cmrollup';
- IniFile.WriteString(IDName, 'command', S);
- end;
- constructor TspDataSkinPopupWindow.Create;
- begin
- inherited;
- WindowPictureIndex := -1;
- MaskPictureIndex := -1;
- LTPoint := Point(0, 0);
- LBPoint := Point(0, 0);
- RTPoint := Point(0, 0);
- RBPoint := Point(0, 0);
- CursorIndex := -1;
- ScrollMarkerColor := 0;
- ScrollMarkerActiveColor := 0;
- end;
- procedure TspDataSkinPopupWindow.LoadFromFile;
- begin
- WindowPictureIndex := IniFile.ReadInteger(
- 'POPUPWINDOW', 'windowpictureindex', -1);
- MaskPictureIndex := IniFile.ReadInteger(
- 'POPUPWINDOW', 'maskpictureindex', -1);
- LTPoint := ReadPoint(IniFile, 'POPUPWINDOW', 'lefttoppoint');
- RTPoint := Readpoint(IniFile, 'POPUPWINDOW', 'righttoppoint');
- LBPoint := ReadPoint(IniFile, 'POPUPWINDOW', 'leftbottompoint');
- RBPoint := ReadPoint(IniFile, 'POPUPWINDOW', 'rightbottompoint');
- CursorIndex := IniFile.ReadInteger('POPUPWINDOW', 'cursorindex', -1);
- ItemsRect := ReadRect(IniFile, 'POPUPWINDOW', 'itemsrect');
- ScrollMarkerColor := IniFile.ReadInteger('POPUPWINDOW', 'scrollmarkercolor', 0);
- ScrollMarkerActiveColor := IniFile.ReadInteger('POPUPWINDOW', 'scrollmarkeractivecolor', 0);
- end;
- procedure TspDataSkinPopupWindow.SaveToFile;
- begin
- IniFile.EraseSection('POPUPWINDOW');
- IniFile.WriteInteger('POPUPWINDOW', 'windowpictureindex',
- WindowPictureIndex);
- IniFile.WriteInteger( 'POPUPWINDOW', 'maskpictureindex',
- MaskPictureIndex);
- WritePoint(IniFile, 'POPUPWINDOW', 'lefttoppoint', LTPoint);
- WritePoint(IniFile, 'POPUPWINDOW', 'righttoppoint', RTPoint);
- WritePoint(IniFile, 'POPUPWINDOW', 'leftbottompoint', LBPoint);
- WritePoint(IniFile, 'POPUPWINDOW', 'rightbottompoint', RBPoint);
- WriteRect(IniFile, 'POPUPWINDOW', 'itemsrect', ItemsRect);
- IniFile.WriteInteger('POPUPWINDOW', 'cursorindex', CursorIndex);
- IniFile.WriteInteger('POPUPWINDOW', 'scrollmarkercolor', ScrollMarkerColor);
- IniFile.WriteInteger('POPUPWINDOW', 'scrollmarkeractivecolor', ScrollMarkerActiveColor);
- end;
- constructor TspDataSkinHintWindow.Create;
- begin
- inherited;
- WindowPictureIndex := -1;
- MaskPictureIndex := -1;
- LTPoint := Point(0, 0);
- LBPoint := Point(0, 0);
- RTPoint := Point(0, 0);
- RBPoint := Point(0, 0);
- ClRect := NullRect;
- FontName := 'Arial';
- FontStyle := [];
- FontHeight := 12;
- FontColor := 0;
- end;
- procedure TspDataSkinHintWindow.LoadFromFile;
- begin
- WindowPictureIndex := IniFile.ReadInteger(
- 'HINTWINDOW', 'windowpictureindex', -1);
- MaskPictureIndex := IniFile.ReadInteger(
- 'HINTWINDOW', 'maskpictureindex', -1);
- LTPoint := ReadPoint(IniFile, 'HINTWINDOW', 'lefttoppoint');
- RTPoint := Readpoint(IniFile, 'HINTWINDOW', 'righttoppoint');
- LBPoint := ReadPoint(IniFile, 'HINTWINDOW', 'leftbottompoint');
- RBPoint := ReadPoint(IniFile, 'HINTWINDOW', 'rightbottompoint');
- ClRect := ReadRect(IniFile, 'HINTWINDOW', 'clientrect');
- FontName := IniFile.ReadString('HINTWINDOW', 'fontname', 'Arial');
- FontHeight := IniFile.ReadInteger('HINTWINDOW', 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, 'HINTWINDOW', 'fontstyle');
- FontColor := IniFile.ReadInteger('HINTWINDOW', 'fontcolor', 0);
- end;
- procedure TspDataSkinHintWindow.SaveToFile;
- begin
- IniFile.EraseSection('HINTWINDOW');
- IniFile.WriteInteger('HINTWINDOW', 'windowpictureindex',
- WindowPictureIndex);
- IniFile.WriteInteger( 'HINTWINDOW', 'maskpictureindex',
- MaskPictureIndex);
- WritePoint(IniFile, 'HINTWINDOW', 'lefttoppoint', LTPoint);
- WritePoint(IniFile, 'HINTWINDOW', 'righttoppoint', RTPoint);
- WritePoint(IniFile, 'HINTWINDOW', 'leftbottompoint', LBPoint);
- WritePoint(IniFile, 'HINTWINDOW', 'rightbottompoint', RBPoint);
- WriteRect(IniFile, 'HINTWINDOW', 'clientrect', ClRect);
- IniFile.WriteString('HINTWINDOW', 'fontname', FontName);
- IniFile.WriteInteger('HINTWINDOW', 'fontheight', FontHeight);
- WriteFontStyles(IniFile, 'HINTWINDOW', 'fontstyle', FontStyle);
- IniFile.WriteInteger('HINTWINDOW', 'fontcolor', FontColor);
- end;
- procedure TspDataSkinMenuItem.LoadFromFile;
- begin
- inherited;
- ItemLO := IniFile.ReadInteger(IDName, 'itemleftoffset', 0);
- ItemRO := IniFile.ReadInteger(IDName, 'itemrightoffset', 0);
- DividerRect := ReadRect(IniFile, IDName, 'dividerrect');
- DividerLO := IniFile.ReadInteger(IDName, 'dividerleftoffset', 0);
- DividerRO := IniFile.ReadInteger(IDName, 'dividerrightoffset', 0);
- TextRct := ReadRect(IniFile, IDName, 'textrect');
- FontName := IniFile.ReadString(IDName, 'fontname', 'Arial');
- FontHeight := IniFile.ReadInteger(IDName, 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, IDName, 'fontstyle');
- FontColor := IniFile.ReadInteger(IDName, 'fontcolor', 0);
- ActiveFontColor := IniFile.ReadInteger(IDName, 'activefontcolor', 0);
- UnEnabledFontColor := IniFile.ReadInteger(IDName, 'unenabledfontcolor', 0);
- end;
- procedure TspDataSkinMenuItem.SaveToFile;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'itemleftoffset', ItemLO);
- IniFile.WriteInteger(IDName, 'itemrightoffset', ItemRO);
- WriteRect(IniFile, IDName, 'dividerrect', DividerRect);
- IniFile.WriteInteger(IDName, 'dividerleftoffset', DividerLO);
- IniFile.WriteInteger(IDName, 'dividerrightoffset', DividerRO);
- WriteRect(IniFile, IDName, 'textrect', TextRct);
- IniFile.WriteString(IDName, 'fontname', FontName);
- IniFile.WriteInteger(IDName, 'fontheight', FontHeight);
- WriteFontStyles(IniFile, IDName, 'fontstyle', FontStyle);
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- IniFile.WriteInteger(IDName, 'unenabledfontcolor', UnEnabledFontColor);
- end;
- procedure TspDataSkinMainMenuItem.LoadFromFile;
- begin
- inherited;
- ItemLO := IniFile.ReadInteger(IDName, 'itemleftoffset', 0);
- ItemRO := IniFile.ReadInteger(IDName, 'itemrightoffset', 0);
- DownRect := ReadRect(IniFile, IDName, 'downrect');
- TextRct := ReadRect(IniFile, IDName, 'textrect');
- FontName := IniFile.ReadString(IDName, 'fontname', 'Arial');
- FontHeight := IniFile.ReadInteger(IDName, 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, IDName, 'fontstyle');
- FontColor := IniFile.ReadInteger(IDName, 'fontcolor', 0);
- ActiveFontColor := IniFile.ReadInteger(IDName, 'activefontcolor', 0);
- DownFontColor := IniFile.ReadInteger(IDName, 'downfontcolor', 0);
- UnEnabledFontColor := IniFile.ReadInteger(IDName, 'unenabledfontColor', 0);
- end;
- procedure TspDataSkinMainMenuItem.SaveToFile;
- begin
- inherited;
- IniFile.WriteInteger(IDName, 'itemleftoffset', ItemLO);
- IniFile.WriteInteger(IDName, 'itemrightoffset', ItemRO);
- WriteRect(IniFile, IDName, 'downrect', DownRect);
- WriteRect(IniFile, IDName, 'textrect', TextRct);
- IniFile.WriteString(IDName, 'fontname', FontName);
- IniFile.WriteInteger(IDName, 'fontheight', FontHeight);
- WriteFontStyles(IniFile, IDName, 'fontstyle', FontStyle);
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- IniFile.WriteInteger(IDName, 'downfontcolor', DownFontColor);
- IniFile.WriteInteger(IDName, 'unenabledfontColor', UnEnabledFontColor);
- end;
- constructor TspDataSkinButton.Create(AIDName: String);
- begin
- inherited;
- GroupIndex := -1;
- DownRect := NullRect;
- end;
- procedure TspDataSkinButton.SaveToFile;
- begin
- inherited;
- WriteRect(IniFile, IDName, 'downrect', DownRect);
- WriteRect(IniFile, IDName, 'disableskinrsect', DisableSkinRect);
- IniFile.WriteInteger(IDName, 'groupindex', GroupIndex);
- end;
- procedure TspDataSkinButton.LoadFromFile;
- begin
- inherited;
- DownRect := ReadRect(IniFile, IDName, 'downrect');
- DisableSkinRect := ReadRect(IniFile, IDName, 'disableskinrsect');
- GroupIndex := IniFile.ReadInteger(IDName, 'groupindex', -1);
- end;
- procedure TspDataSkinStdButton.LoadFromFile;
- var
- S: String;
- begin
- inherited;
- S := IniFile.ReadString(IDName, 'command', 'cmdefault');
- if S = 'cmclose' then Command := cmClose else
- if S = 'cmmaximize' then Command := cmMaximize else
- if S = 'cmminimize' then Command := cmMinimize else
- if S = 'cmsysmenu' then Command := cmSysMenu else
- if S = 'cmdefault' then Command := cmDefault else
- Command := cmRollUp;
- RestoreRect := ReadRect(IniFile, IDName, 'restorerect');
- RestoreActiveRect := ReadRect(IniFile, IDName, 'restoreactiverect');
- RestoreDownRect := ReadRect(IniFile, IDName, 'restoredownrect');
- end;
- procedure TspDataSkinStdButton.SaveToFile;
- var
- S: String;
- begin
- inherited;
- if Command = cmClose then S := 'cmclose' else
- if Command = cmMaximize then S := 'cmmaximize' else
- if Command = cmMinimize then S := 'cmminimize' else
- if Command = cmSysMenu then S := 'cmsysmenu' else
- if Command = cmDefault then S := 'cmdefault' else
- S := 'cmrollup';
- IniFile.WriteString(IDName, 'command', S);
- WriteRect(IniFile, IDName, 'restorerect', RestoreRect);
- WriteRect(IniFile, IDName, 'restoreactiverect', RestoreActiveRect);
- WriteRect(IniFile, IDName, 'restoredownrect', RestoreDownRect);
- end;
- constructor TspDataSkinBitLabel.Create;
- begin
- inherited;
- TextValue := '';
- Symbols := TStringList.Create;
- SymbolWidth := 0;
- SymbolHeight := 0;
- end;
- destructor TspDataSkinBitLabel.Destroy;
- begin
- Symbols.Clear;
- Symbols.Free;
- inherited;
- end;
- procedure TspDataSkinBitLabel.LoadFromFile;
- begin
- inherited;
- Morphing := False;
- TextValue := IniFile.ReadString(IDName, 'textvalue', '');
- SymbolWidth := IniFile.ReadInteger(IDName, 'symbolwidth', 0);
- SymbolHeight := IniFile.ReadInteger(IDName, 'symbolheight', 0);
- ReadStrings(IniFile, IDName, 'symbols', Symbols);
- end;
- procedure TspDataSkinBitLabel.SaveToFile;
- begin
- inherited;
- IniFile.WriteString(IDName, 'textvalue', TextValue);
- IniFile.WriteInteger(IDName, 'symbolwidth', SymbolWidth);
- IniFile.WriteInteger(IDName, 'symbolheight', SymbolHeight);
- WriteStrings(IniFile, IDName, 'symbols', Symbols);
- end;
- procedure TspDataSkinLabel.LoadFromFile;
- begin
- inherited;
- FontName := IniFile.ReadString(IDName, 'fontName', 'Arial');
- FontHeight := IniFile.ReadInteger(IDName, 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, IDName, 'fontstyle');
- FontColor := IniFile.ReadInteger(IDName, 'fontcolor', 0);
- ActiveFontColor := IniFile.ReadInteger(IDName, 'activefontcolor', 0);
- Alignment := ReadAlignment(IniFile, IDName, 'alignment');
- TextValue := IniFile.ReadString(IDName, 'textvalue', '');
- end;
- procedure TspDataSkinLabel.SaveToFile;
- begin
- inherited;
- IniFile.WriteString(IDName, 'fontname', FontName);
- IniFile.WriteInteger(IDName, 'fontheight', FontHeight);
- WriteFontStyles(IniFile, IDName, 'fontstyle', FontStyle);
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- WriteAlignment(IniFile, IDName, 'alignment', Alignment);
- IniFile.WriteString(IDName, 'textvalue', TextValue);
- end;
- procedure TspDataSkinCaption.SaveToFile;
- begin
- inherited;
- WriteBoolean(IniFile, IDName, 'defaultcaption', DefaultCaption);
- WriteRect(IniFile, IDName, 'textrect', TextRct);
- IniFile.WriteString(IDName, 'fontname', FontName);
- IniFile.WriteInteger(IDName, 'fontheight', FontHeight);
- WriteFontStyles(IniFile, IDName, 'fontstyle', FontStyle);
- IniFile.WriteInteger(IDName, 'fontcolor', FontColor);
- IniFile.WriteInteger(IDName, 'activefontcolor', ActiveFontColor);
- WriteAlignment(IniFile, IDName, 'alignment', Alignment);
- WriteBoolean(IniFile, IDName, 'shadow', Shadow);
- IniFile.WriteInteger(IDName, 'shadowcolor', ShadowColor);
- IniFile.WriteInteger(IDName, 'activeshadowcolor', ActiveShadowColor);
- WriteRect(IniFile, IDName, 'framerect', FrameRect);
- WriteRect(IniFile, IDName, 'activeframerect', ActiveFrameRect);
- WriteRect(IniFile, IDName, 'frametextrect', FrameTextRect);
- IniFile.WriteInteger(IDName, 'frameleftoffset', FrameLeftOffset);
- IniFile.WriteInteger(IDName, 'framerightoffset', FrameRightOffset);
- end;
- procedure TspDataSkinCaption.LoadFromFile;
- begin
- inherited;
- DefaultCaption := ReadBoolean(IniFile, IDName, 'defaultcaption');
- TextRct := ReadRect(IniFile, IDName, 'textrect');
- FontName := IniFile.ReadString(IDName, 'fontname', 'Arial');
- FontHeight := IniFile.ReadInteger(IDName, 'fontheight', 14);
- FontStyle := ReadFontStyles(IniFile, IDName, 'fontstyle');
- FontColor := IniFile.ReadInteger(IDName, 'fontcolor', 0);
- ActiveFontColor := IniFile.ReadInteger(IDName, 'activefontcolor', 0);
- Alignment := ReadAlignment(IniFile, IDName, 'alignment');
- Shadow := ReadBoolean(IniFile, IDName, 'shadow');
- ShadowColor := IniFile.ReadInteger(IDName, 'shadowcolor', 0);
- ActiveShadowColor := IniFile.ReadInteger(IDName, 'activeshadowcolor', 0);
- FrameRect := ReadRect(IniFile, IDName, 'framerect');
- ActiveFrameRect := ReadRect(IniFile, IDName, 'activeframerect');
- FrameTextRect := ReadRect(IniFile, IDName, 'frametextrect');
- FrameLeftOffset := IniFile.ReadInteger(IDName, 'frameleftoffset', 0);
- FrameRightOffset := IniFile.ReadInteger(IDName, 'framerightoffset', 0);
- end;
- constructor TspStoredSkin.Create;
- begin
- inherited Create(AOwner);
- FPicture := TBitMap.Create;
- FMask := TBitMap.Create;
- FRollUpPicture := TBitMap.Create;
- FRollUpMask := TBitMap.Create;
- FActivePictures := TList.Create;
- FIniStrings := TStringList.Create;
- FFileName := '';
- end;
- destructor TspStoredSkin.Destroy;
- begin
- FPicture.Free;
- FMask.Free;
- FRollUpPicture.Free;
- FRollUpMask.Free;
- FIniStrings.Free;
- ClearBitMaps;
- FActivePictures.Free;
- inherited;
- end;
- procedure TspStoredSkin.SetFileName;
- var
- OD: TOpenDialog;
- begin
- if (csDesigning in ComponentState) and not
- (csLoading in ComponentState)
- then
- begin
- OD := TOpenDialog.Create(Self);
- if OD.Execute
- then
- begin
- FFileName := ExtractFileName(OD.FileName);
- LoadFromFile(OD.FileName);
- end;
- OD.Free;
- end
- else
- FFileName := Value;
- end;
- procedure TspStoredSkin.SetIniStrings;
- begin
- FIniStrings.Assign(Value);
- end;
- procedure TspStoredSkin.ClearBitMaps;
- var
- i, Count: Integer;
- begin
- Count := FActivePictures.Count;
- if Count > 0
- then
- for i := 0 to Count - 1 do
- begin
- TBitMap(FActivePictures.Items[i]).Free;
- end;
- FActivePictures.Clear;
- end;
- procedure TspStoredSkin.DefineProperties(Filer: TFiler);
- begin
- inherited;
- Filer.DefineBinaryProperty('Pictures', ReadData, WriteData, True);
- end;
- procedure TspStoredSkin.ReadData;
- var
- IsEmpty: Boolean;
- i, Count: Integer;
- begin
- Reader.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FPicture.Assign(nil)
- else FPicture.LoadFromStream(Reader);
- Reader.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FMask.Assign(nil)
- else FMask.LoadFromStream(Reader);
- Reader.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FRollUpPicture.Assign(nil)
- else FRollUpPicture.LoadFromStream(Reader);
- Reader.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FRollUpMask.Assign(nil)
- else FRollUpMask.LoadFromStream(Reader);
- ClearBitMaps;
- Reader.Read(Count, SizeOf(Count));
- if Count > 0
- then
- for i := 0 to Count - 1 do
- begin
- FActivePictures.Add(TBitMap.Create);
- TBitMap(FActivePictures.Items[i]).LoadFromStream(Reader);
- end;
- end;
- procedure TspStoredSkin.WriteData;
- var
- IsEmpty: Boolean;
- i, Count: Integer;
- begin
- IsEmpty := FPicture.Empty;
- Writer.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty then FPicture.SaveToStream(Writer);
- IsEmpty := FMask.Empty;
- Writer.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty then FMask.SaveToStream(Writer);
- IsEmpty := FRollUpPicture.Empty;
- Writer.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty then FRollUpPicture.SaveToStream(Writer);
- IsEmpty := FRollUpMask.Empty;
- Writer.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty then FRollUpMask.SaveToStream(Writer);
- Count := FActivePictures.Count;
- Writer.Write(Count, SizeOf(Count));
- if Count > 0
- then
- for i := 0 to Count - 1 do
- begin
- TBitMap(FActivePictures.Items[i]).SaveToStream(Writer);
- end;
- end;
- procedure TspStoredSkin.LoadFromFile;
- var
- F: TMemIniFile;
- PNames: TStrings;
- PName, Path: String;
- i: Integer;
- begin
- FIniStrings.Clear;
- FIniStrings.LoadFromFile(AFileName);
- Path := ExtractFilePath(AFileName);
- F := TMemIniFile.Create(FileName);
- // load base pictures
- PName := F.ReadString('PICTURES', 'picture', '');
- if PName <> ''
- then
- begin
- if IsJPegFile(PName)
- then
- LoadFromJpegFile(FPicture, Path + PName)
- else
- FPicture.LoadFromFile(Path + PName);
- end
- else FPicture.Assign(nil);
- PName := F.ReadString('PICTURES', 'mask', '');
- if PName <> ''
- then
- begin
- if IsJPegFile(PName)
- then
- LoadFromJpegFile(FMask, Path + PName)
- else
- FMask.LoadFromFile(Path + PName);
- end
- else FMask.Assign(nil);
- PName := F.ReadString('PICTURES', 'rolluppicture', '');
- if PName <> ''
- then
- begin
- if IsJPegFile(PName)
- then
- LoadFromJpegFile(FRollUpPicture, Path + PName)
- else
- FRollUpPicture.LoadFromFile(Path + PName);
- end
- else FRollUpPicture.Assign(nil);
- PName := F.ReadString('PICTURES', 'rollupmask', '');
- if PName <> ''
- then
- begin
- if IsJPegFile(PName)
- then
- LoadFromJpegFile(FRollUpMask, Path + PName)
- else
- FRollUpMask.LoadFromFile(Path + PName);
- end
- else FRollUpMask.Assign(nil);
- // load activepictures
- PNames := TStringList.Create;
- ReadStrings1(F, 'PICTURES', 'activepictures', PNames);
- ClearBitMaps;
- for i := 0 to PNames.Count - 1 do
- begin
- FActivePictures.Add(TBitMap.Create);
- if IsJpegFile(PNames[i])
- then
- LoadFromJPegFile(TBitMap(FActivePictures.Items[i]), Path + PNames[i])
- else
- TBitMap(FActivePictures.Items[i]).LoadFromFile(Path + PNames[i]);
- end;
- PNames.Free;
- //
- F.Free;
- end;
- constructor TspSkinData.Create(AOwner: TComponent);
- begin
- inherited Create(AOwner);
- FStoredSkin := nil;
- ObjectList := TList.Create;
- CtrlList := TList.Create;
- AreaList := TList.Create;
- FActivePictures := TList.Create;
- FPicture := TBitMap.Create;
- FMask := TBitMap.Create;
- FRollUpPicture := TBitMap.Create;
- FRollUpMask := TBitMap.Create;
- FPictureName := '';
- FMaskName := '';
- FRollUpPictureName := '';
- FRollUpMaskName := '';
- FActivePicturesNames := TStringList.Create;
- FCursorsNames := TStringList.Create;
- Names := TStringList.Create;
- SkinName := '';
- Empty := True;
- PopupWindow := TspDataSkinPopupWindow.Create;
- HintWindow := TspDataSkinHintWindow.Create;
- MainMenuPopupUp := False;
- BuildMode := False;
- StartCursorIndex := 1;
- CursorIndex := -1;
- BGPictureIndex := -1;
- end;
- destructor TspSkinData.Destroy;
- begin
- Empty := True;
- ClearObjects;
- ObjectList.Free;
- CtrlList.Free;
- AreaList.Free;
- FActivePictures.Free;
- FPicture.Free;
- FMask.Free;
- FRollUpPicture.Free;
- FRollUpMask.Free;
- FActivePicturesNames.Free;
- FCursorsNames.Free;
- Names.Free;
- PopupWindow.Free;
- HintWindow.Free;
- inherited Destroy;
- end;
- procedure TspSkinData.Notification;
- begin
- inherited Notification(AComponent, Operation);
- if (Operation = opRemove) and (AComponent = FStoredSkin)
- then FStoredSkin := nil;
- if (Operation = opRemove) and (AComponent = FCompressedStoredSkin)
- then FCompressedStoredSkin := nil;
- end;
- procedure TspSkinData.SetCompressedStoredSkin;
- begin
- FCompressedStoredSkin := Value;
- if not (csDesigning in ComponentState) and (FCompressedStoredSkin <> nil)
- then
- LoadCompressedStoredSkin(FCompressedStoredSkin);
- end;
- procedure TspSkinData.SetStoredSkin;
- begin
- FStoredSkin := Value;
- if not (csDesigning in ComponentState) and (FStoredSkin <> nil)
- then
- LoadStoredSkin(FStoredSkin);
- end;
- procedure TspSkinData.LoadNames;
- var
- i: Integer;
- begin
- Names.Clear;
- for i := 0 to ObjectList.Count - 1 do
- Names.Add(TspDataSkinObject(ObjectList.Items[i]).IDName);
- for i := 0 to CtrlList.Count - 1 do
- Names.Add(TspDataSkinControl(CtrlList.Items[i]).IDName);
- end;
- procedure TspSkinData.EraseSections;
- var
- i: Integer;
- begin
- if Names.Count = 0 then Exit;
- for i := 0 to Names.Count - 1 do
- F.EraseSection(Names[i]);
- end;
- procedure TspSkinData.SendSkinDataMessage;
- var
- i: Integer;
- F: TForm;
- begin
- F := TForm(Owner);
- SendMessage(F.Handle, M, Integer(Self), 1000);
- with Screen do
- for i := 0 to FormCount - 1 do
- if Forms[i] <> F
- then
- SendMessage(Forms[i].Handle, M, Integer(Self), 1000);
- end;
- function TspSkinData.GetAreaIndex;
- var
- i: Integer;
- begin
- Result := -1;
- for i := 0 to AreaList.Count - 1 do
- begin
- if AIDName = TspDataSkinArea(AreaList.Items[i]).IDName
- then
- begin
- Result := i;
- Break;
- end;
- end;
- end;
- function TspSkinData.GetIndex;
- var
- i: Integer;
- begin
- Result := -1;
- for i := 0 to ObjectList.Count - 1 do
- begin
- if AIDName = TspDataSkinObject(ObjectList.Items[i]).IDName
- then
- begin
- Result := i;
- Break;
- end;
- end;
- end;
- function TspSkinData.GetControlIndex;
- var
- i: Integer;
- begin
- Result := -1;
- for i := 0 to CtrlList.Count - 1 do
- begin
- if AIDName = TspDataSkinControl(CtrlList.Items[i]).IDName
- then
- begin
- Result := i;
- Break;
- end;
- end;
- end;
- procedure TspSkinData.ClearObjects;
- var
- i: Integer;
- begin
- for i := 0 to AreaList.Count - 1 do
- TspDataSkinArea(AreaList.Items[i]).Free;
- AreaList.Clear;
- for i := 0 to ObjectList.Count - 1 do
- TspDataSkinObject(ObjectList.Items[i]).Free;
- ObjectList.Clear;
- for i := 0 to CtrlList.Count - 1 do
- TspDataSkinControl(CtrlList.Items[i]).Free;
- CtrlList.Clear;
- for i := 0 to FActivePictures.Count - 1 do
- TBitMap(FActivePictures.Items[i]).Free;
- PopupWindow.WindowPictureIndex := -1;
- HintWindow.WindowPictureIndex := -1;
- FCursorsNames.Clear;
- FActivePictures.Clear;
- FActivePicturesNames.Clear;
- FCursorsNames.Clear;
- end;
- procedure TspSkinData.ClearAll;
- begin
- ClearObjects;
- FPicture.Assign(nil);
- FMask.Assign(nil);
- FRollUpPicture.Assign(nil);
- FRollUpMask.Assign(nil);
- FPictureName := '';
- FMaskName := '';
- FRollUpPictureName := '';
- FRollUpMaskName := '';
- Empty := True;
- end;
- const
- symbols = ',: ';
- procedure TspSkinData.GetObjectTypeName(S: String; var AName, AType: String);
- var
- i, j: Integer;
- begin
- AName := '';
- AType := '';
- j := 0;
- for i := 1 to Length(S) do
- if S[i] = ':'
- then
- begin
- j := i;
- Break;
- end;
- if j <> 0
- then
- begin
- AName := Copy(S, 1, j - 1);
- AType := Copy(S, j + 1, Length(S) - j);
- end;
- end;
- procedure TspSkinData.GetAreaNameRect(S: String; var AName: String; var ARect: TRect);
- var
- i, j: Integer;
- ARectStr: String;
- begin
- AName := '';
- ARectStr := '';
- j := 0;
- for i := 1 to Length(S) do
- if S[i] = ':'
- then
- begin
- j := i;
- Break;
- end;
- if j <> 0
- then
- begin
- AName := Copy(S, 1, j - 1);
- ARectStr := Copy(S, j + 1, Length(S) - j);
- ARect := GetRect(ARectStr);
- end;
- end;
- procedure TspSkinData.AddSkinArea;
- begin
- AreaList.Add(TspDataSkinArea.Create(AName, ARect));
- end;
- procedure TspSkinData.WriteAreas(F: TCustomIniFile);
- var
- S: String;
- i: Integer;
- begin
- F.EraseSection('SKINAREAS');
- F.WriteInteger('SKINAREAS', 'count', AreaList.Count);
- for i := 0 to AreaList.Count - 1 do
- with TspDataSkinArea(AreaList.Items[i]) do
- begin
- S := IDName + ':' + SetRect(AreaRect);
- F.WriteString('SKINAREAS', IntToStr(i), S);
- end;
- end;
- procedure TspSkinData.ReadAreas(F: TCustomIniFile);
- var
- i, Count: Integer;
- S, FName: String;
- FRect: TRect;
- begin
- Count := F.ReadInteger('SKINAREAS', 'count', 0);
- for i := 0 to Count - 1 do
- begin
- S := F.ReadString('SKINAREAS', IntToStr(i), '');
- GetAreaNameRect(S, FName, FRect);
- AddSkinArea(FName, FRect);
- end;
- end;
- procedure TspSkinData.WriteObjects;
- var
- i: Integer;
- S: String;
- begin
- F.EraseSection('SKINOBJECTS');
- F.WriteInteger('SKINOBJECTS', 'count', ObjectList.Count);
- for i := 0 to ObjectList.Count - 1 do
- begin
- S := TspDataSkinObject(ObjectList.Items[i]).IDName + ':';
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinMenuItem
- then S := S + 'menuitem' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinMainMenuBarItem
- then S := S + 'mainmenubaritem' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinMainMenuItem
- then S := S + 'mainmenuitem' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinMainMenuBarButton
- then S := S + 'mainmenubarbutton' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinStdButton
- then S := S + 'stdbutton' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinButton
- then S := S + 'button' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinCaption
- then S := S + 'caption' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinTrackBar
- then S := S + 'trackbar' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinGauge
- then S := S + 'gauge' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinFrameGaugeObject
- then S := S + 'framegauge' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinFrameRegulatorObject
- then S := S + 'frameregulator' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinLabel
- then S := S + 'label' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinBitLabel
- then S := S + 'bitlabel' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinSwitch
- then S := S + 'switch' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataSkinAnimate
- then S := S + 'animate' else
- if TspDataSkinObject(ObjectList.Items[i]) is TspDataUserObject
- then S := S + 'userobject';
- F.WriteString('SKINOBJECTS', IntToStr(i), S);
- TspDataSkinObject(ObjectList.Items[i]).SaveToFile(F);
- end;
- end;
- procedure TspSkinData.WriteCtrls(F: TCustomIniFile);
- var
- i: Integer;
- S: String;
- begin
- F.EraseSection('SKINCONTROLS');
- F.WriteInteger('SKINCONTROLS', 'count', CtrlList.Count);
- for i := 0 to CtrlList.Count - 1 do
- begin
- S := TspDataSkinControl(CtrlList.Items[i]).IDName + ':';
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinSlider
- then S := S + 'slider'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinBevel
- then S := S + 'bevel'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinPanelControl
- then S := S + 'panel'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinExPanelControl
- then S := S + 'expanel'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinMenuButtonControl
- then S := S + 'menubutton'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinButtonControl
- then S := S + 'button'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinCheckRadioControl
- then S := S + 'checkradio'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinGaugeControl
- then S := S + 'gauge'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinSplitterControl
- then S := S + 'splitter'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinTrackBarControl
- then S := S + 'trackbar'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinLabelControl
- then S := S + 'label'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinStdLabelControl
- then S := S + 'stdlabel'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinBitLabelControl
- then S := S + 'bitlabel'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinFrameRegulator
- then S := S + 'frameregulator'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinFrameGauge
- then S := S + 'framegauge'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinAnimateControl
- then S := S + 'animate'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinUpDownControl
- then S := S + 'updown'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinSwitchControl
- then S := S + 'switch'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinGridControl
- then S := S + 'grid'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinTabControl
- then S := S + 'tab'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinMainMenuBar
- then S := S + 'mainmenubar'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinControlBar
- then S := S + 'controlbar'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinMemoControl
- then S := S + 'memo'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinEditControl
- then S := S + 'edit'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinCheckListBox
- then S := S + 'checklistbox'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinListBox
- then S := S + 'listbox'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinComboBox
- then S := S + 'combobox'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinScrollBarControl
- then S := S + 'scrollbar'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinSpinEditControl
- then S := S + 'spinedit'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinScrollBoxControl
- then S := S + 'scrollbox'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinTreeView
- then S := S + 'treeview'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinListView
- then S := S + 'listview'
- else
- if TspDataSkinControl(CtrlList.Items[i]) is TspDataSkinRichEdit
- then S := S + 'richedit';
- F.WriteString('SKINCONTROLS', IntToStr(i), S);
- TspDataSkinControl(CtrlList.Items[i]).SaveToFile(F);
- end;
- end;
- procedure TspSkinData.ReadCtrls(F: TCustomIniFile);
- var
- i, Count: Integer;
- S, FName, FType: String;
- begin
- Count := F.ReadInteger('SKINCONTROLS', 'count', 0);
- for i := 0 to Count - 1 do
- begin
- S := F.ReadString('SKINCONTROLS', IntToStr(i), '');
- GetObjectTypeName(S, FName, FType);
- if FType = 'slider'
- then CtrlList.Add(TspDataSkinSlider.Create(FName))
- else
- if FType = 'bevel'
- then CtrlList.Add(TspDataSkinBevel.Create(FName))
- else
- if FType = 'panel'
- then CtrlList.Add(TspDataSkinPanelControl.Create(FName))
- else
- if FType = 'expanel'
- then CtrlList.Add(TspDataSkinExPanelControl.Create(FName))
- else
- if FType = 'menubutton'
- then CtrlList.Add(TspDataSkinMenuButtonControl.Create(FName))
- else
- if FType = 'button'
- then CtrlList.Add(TspDataSkinButtonControl.Create(FName))
- else
- if FType = 'checkradio'
- then CtrlList.Add(TspDataSkinCheckRadioControl.Create(FName))
- else
- if FType = 'gauge'
- then CtrlList.Add(TspDataSkinGaugeControl.Create(FName))
- else
- if FType = 'splitter'
- then CtrlList.Add(TspDataSkinSplitterControl.Create(FName))
- else
- if FType = 'trackbar'
- then CtrlList.Add(TspDataSkinTrackBarControl.Create(FName))
- else
- if FType = 'label'
- then CtrlList.Add(TspDataSkinLabelControl.Create(FName))
- else
- if FType = 'stdlabel'
- then CtrlList.Add(TspDataSkinStdLabelControl.Create(FName))
- else
- if FType = 'bitlabel'
- then CtrlList.Add(TspDataSkinBitLabelControl.Create(FName))
- else
- if FType = 'frameregulator'
- then CtrlList.Add(TspDataSkinFrameRegulator.Create(FName))
- else
- if FType = 'framegauge'
- then CtrlList.Add(TspDataSkinFrameGauge.Create(FName))
- else
- if FType = 'animate'
- then CtrlList.Add(TspDataSkinAnimateControl.Create(FName))
- else
- if FType = 'updown'
- then CtrlList.Add(TspDataSkinUpDownControl.Create(FName))
- else
- if FType = 'switch'
- then CtrlList.Add(TspDataSkinSwitchControl.Create(FName))
- else
- if FType = 'grid'
- then CtrlList.Add(TspDataSkinGridControl.Create(FName))
- else
- if FType = 'tab'
- then CtrlList.Add(TspDataSkinTabControl.Create(FName))
- else
- if FType = 'mainmenubar'
- then CtrlList.Add(TspDataSkinMainMenuBar.Create(FName))
- else
- if FType = 'controlbar'
- then CtrlList.Add(TspDataSkinControlBar.Create(FName))
- else
- if FType = 'memo'
- then CtrlList.Add(TspDataSkinMemoControl.Create(FName))
- else
- if FType = 'edit'
- then CtrlList.Add(TspDataSkinEditControl.Create(FName))
- else
- if FType = 'checklistbox'
- then CtrlList.Add(TspDataSkinCheckListBox.Create(FName))
- else
- if FType = 'listbox'
- then CtrlList.Add(TspDataSkinListBox.Create(FName))
- else
- if FType = 'combobox'
- then CtrlList.Add(TspDataSkinComboBox.Create(FName))
- else
- if FType = 'scrollbar'
- then CtrlList.Add(TspDataSkinScrollBarControl.Create(FName))
- else
- if FType = 'spinedit'
- then CtrlList.Add(TspDataSkinSpinEditControl.Create(FName))
- else
- if FType = 'scrollbox'
- then CtrlList.Add(TspDataSkinScrollBoxControl.Create(FName))
- else
- if FType = 'treeview'
- then CtrlList.Add(TspDataSkinTreeView.Create(FName))
- else
- if FType = 'listview'
- then CtrlList.Add(TspDataSkinListView.Create(FName))
- else
- if FType = 'richedit'
- then CtrlList.Add(TspDataSkinRichEdit.Create(FName));
- TspDataSkinControl(CtrlList[CtrlList.Count - 1]).LoadFromFile(F);
- end;
- end;
- procedure TspSkinData.WriteActivePictures;
- begin
- WriteStrings1(F, 'PICTURES', 'activepictures', FActivePicturesNames);
- end;
- procedure TspSkinData.WriteCursors;
- begin
- F.WriteInteger('CURSORS', 'startcursorindex', StartCursorIndex);
- WriteStrings1(F, 'CURSORS', 'cursors', FCursorsNames);
- end;
- procedure TspSkinData.ReadActivePictures;
- var
- i: Integer;
- begin
- ReadStrings1(F, 'PICTURES', 'activepictures', FActivePicturesNames);
- for i := 0 to FActivePicturesNames.Count - 1 do
- begin
- FActivePictures.Add(TBitMap.Create);
- if IsJpegFile(FActivePicturesNames[i])
- then
- LoadFromJPegFile(TBitMap(FActivePictures.Items[i]), Path + FActivePicturesNames[i])
- else
- TBitMap(FActivePictures.Items[i]).LoadFromFile(Path + FActivePicturesNames[i]);
- end;
- end;
- procedure TspSkinData.ReadCursors;
- var
- i: Integer;
- CN: PChar;
- begin
- StartCursorIndex := F.ReadInteger('CURSORS', 'startcursorindex', 1);
- if StartCursorIndex < 1 then StartCursorIndex := 1;
- ReadStrings1(F, 'CURSORS', 'cursors', FCursorsNames);
- if not BuildMode and (FCursorsNames.Count <> 0)
- then
- begin
- for i := StartCursorIndex to StartCursorIndex + FCursorsNames.Count - 1 do
- begin
- CN := PChar(Path + FCursorsNames[i - StartCursorIndex]);
- Screen.Cursors[i] := LoadCursorFromFile(CN);
- end;
- end;
- end;
- procedure TspSkinData.ReadObjects;
- var
- i, Count: Integer;
- S, FName, FType: String;
- begin
- Count := F.ReadInteger('SKINOBJECTS', 'count', 0);
- for i := 0 to Count - 1 do
- begin
- S := F.ReadString('SKINOBJECTS', IntToStr(i), '');
- GetObjectTypeName(S, FName, FType);
- if FType = 'menuitem'
- then ObjectList.Add(TspDataSkinMenuItem.Create(FName)) else
- if FType = 'mainmenubaritem'
- then ObjectList.Add(TspDataSkinMainMenuBarItem.Create(FName)) else
- if FType = 'mainmenuitem'
- then ObjectList.Add(TspDataSkinMainMenuItem.Create(FName)) else
- if FType = 'stdbutton'
- then ObjectList.Add(TspDataSkinStdButton.Create(FName)) else
- if FType = 'mainmenubarbutton'
- then ObjectList.Add(TspDataSkinMainMenuBarButton.Create(FName)) else
- if FType = 'button'
- then ObjectList.Add(TspDataSkinButton.Create(FName)) else
- if FType = 'caption'
- then ObjectList.Add(TspDataSkinCaption.Create(FName)) else
- if FType = 'trackbar'
- then ObjectList.Add(TspDataSkinTrackBar.Create(FName)) else
- if FType = 'gauge'
- then ObjectList.Add(TspDataSkinGauge.Create(FName)) else
- if FType = 'framegauge'
- then ObjectList.Add(TspDataSkinFrameGaugeObject.Create(FName))
- else
- if FType = 'frameregulator'
- then ObjectList.Add(TspDataSkinFrameRegulatorObject.Create(FName)) else
- if FType = 'label'
- then ObjectList.Add(TspDataSkinLabel.Create(FName)) else
- if FType = 'bitlabel'
- then ObjectList.Add(TspDataSkinBitLabel.Create(FName)) else
- if FType = 'switch'
- then ObjectList.Add(TspDataSkinSwitch.Create(FName)) else
- if FType = 'animate'
- then ObjectList.Add(TspDataSkinAnimate.Create(FName)) else
- if FType = 'userobject'
- then ObjectList.Add(TspDataUserObject.Create(FName));
- TspDataSkinObject(ObjectList[ObjectList.Count - 1]).LoadFromFile(F);
- end;
- end;
- procedure TspSkinData.AddBitMap(FileName: String);
- begin
- FActivePicturesNames.Add(ExtractFileName(FileName));
- FActivePictures.Add(TBitMap.Create);
- if IsJPegFile(ExtractFileName(FileName))
- then
- LoadFromJpegFile(TBitMap(FActivePictures.Items[FActivePictures.Count - 1]),
- FileName)
- else
- TBitMap(FActivePictures.Items[FActivePictures.Count - 1]).LoadFromFile(FileName);
- end;
- procedure TspSkinData.DeleteBitMap(Index: Integer);
- begin
- FActivePicturesNames.Delete(Index);
- TBitMap(FActivePictures.Items[Index]).Free;
- FActivePictures.Delete(Index);
- end;
- procedure TspSkinData.WriteFormInfo;
- begin
- WritePoint(F, 'FORMINFO', 'lefttoppoint', LTPoint);
- Writepoint(F, 'FORMINFO', 'righttoppoint', RTPoint);
- WritePoint(F, 'FORMINFO', 'leftbottompoint', LBPoint);
- WritePoint(F, 'FORMINFO', 'rightbottompoint', RBPoint);
- WriteRect(F, 'FORMINFO', 'clientrect', ClRect);
- F.WriteInteger('FORMINFO', 'bgpictureindex', BGPictureIndex);
- WriteRect(F, 'FORMINFO', 'maskrectarea', MaskRectArea);
- //
- WriteRect(F, 'FORMINFO', 'buttonsrect', ButtonsRect);
- WriteRect(F, 'FORMINFO', 'captionrect', CaptionRect);
- F.WriteInteger('FORMINFO', 'buttonsoffset', ButtonsOffset);
- WriteBoolean(F, 'FORMINFO', 'buttonsinleft', CapButtonsInLeft);
- //
- WritePoint(F, 'FORMINFO', 'hittestlefttoppoint', HitTestLTPoint);
- WritePoint(F, 'FORMINFO', 'hittestrighttoppoint', HitTestRTPoint);
- WritePoint(F, 'FORMINFO', 'hittestleftbottompoint', HitTestLBPoint);
- WritePoint(F, 'FORMINFO', 'hittestrightbottompoint', HitTestRBPoint);
- //
- WritePoint(F, 'FORMINFO', 'rollupleftpoint', RollUpLeftPoint);
- WritePoint(F, 'FORMINFO', 'rolluprightpoint', RollUpRightPoint);
- //
- WriteRect(F, 'FORMINFO', 'mainmenurect', MainMenuRect);
- WriteRect(F, 'FORMINFO', 'iconrect', IconRect);
- WriteBoolean(F, 'FORMINFO', 'mainmenupopupup', MainMenuPopupUp);
- F.WriteInteger('FORMINFO', 'borderwidth', BorderW);
- F.WriteInteger('FORMINFO', 'cursorindex', CursorIndex);
- WriteBoolean(F, 'FORMINFO', 'autorenderinginactiveimage', AutoRenderingInActiveImage);
- WriteInActiveEffect(F, 'FORMINFO', 'inactiveeffect', InActiveEffect);
- end;
- procedure TspSkinData.ReadFormInfo;
- begin
- LTPoint := ReadPoint(F, 'FORMINFO', 'lefttoppoint');
- RTPoint := Readpoint(F, 'FORMINFO', 'righttoppoint');
- LBPoint := ReadPoint(F, 'FORMINFO', 'leftbottompoint');
- RBPoint := ReadPoint(F, 'FORMINFO', 'rightbottompoint');
- ClRect := ReadRect(F, 'FORMINFO', 'clientrect');
- BGPictureIndex := F.ReadInteger('FORMINFO', 'bgpictureindex', -1);
- //
- ButtonsRect := ReadRect(F, 'FORMINFO', 'buttonsrect');
- CaptionRect := ReadRect(F, 'FORMINFO', 'captionrect');
- ButtonsOffset := F.ReadInteger('FORMINFO', 'buttonsoffset', 0);
- CapButtonsInLeft := ReadBoolean(F, 'FORMINFO', 'buttonsinleft');
- //
- MaskRectArea := ReadRect(F, 'FORMINFO', 'maskrectarea');
- HitTestLTPoint := ReadPoint(F, 'FORMINFO', 'hittestlefttoppoint');
- HitTestRTPoint := ReadPoint(F, 'FORMINFO', 'hittestrighttoppoint');
- HitTestLBPoint := ReadPoint(F, 'FORMINFO', 'hittestleftbottompoint');
- HitTestRBPoint := ReadPoint(F, 'FORMINFO', 'hittestrightbottompoint');
- //
- RollUpLeftPoint := ReadPoint(F, 'FORMINFO', 'rollupleftpoint');
- RollUpRightPoint := ReadPoint(F, 'FORMINFO', 'rolluprightpoint');
- //
- if FMaskName <> ''
- then
- begin
- if isNullRect(MaskRectArea)
- then
- MaskRectArea := ClRect
- else
- begin
- if MaskRectArea.Left > ClRect.Left
- then MaskRectArea.Left := ClRect.Left;
- if MaskRectArea.Top > ClRect.Top
- then MaskRectArea.Top := ClRect.Top;
- if MaskRectArea.Right < ClRect.Right
- then MaskRectArea.Right := ClRect.Right;
- if MaskRectArea.Bottom < ClRect.Bottom
- then MaskRectArea.Bottom := ClRect.Bottom;
- end;
- if isNullPoint(HitTestLTPoint) then HitTestLTPoint := LTPoint;
- if isNullPoint(HitTestRTPoint) then HitTestRTPoint := RTPoint;
- if isNullPoint(HitTestLBPoint) then HitTestLBPoint := LBPoint;
- if isNullPoint(HitTestRBPoint) then HitTestRBPoint := RBPoint;
- end;
- //
- MainMenuRect := ReadRect(F, 'FORMINFO', 'mainmenurect');
- IconRect := ReadRect(F, 'FORMINFO', 'iconrect');
- MainMenuPopupUp := ReadBoolean(F, 'FORMINFO', 'mainmenupopupup');
- BorderW := F.ReadInteger('FORMINFO', 'borderwidth', 0);
- CursorIndex := F.ReadInteger('FORMINFO', 'cursorindex', -1);
- AutoRenderingInActiveImage := ReadBoolean(F, 'FORMINFO', 'autorenderinginactiveimage');
- InActiveEffect := ReadInActiveEffect(F, 'FORMINFO', 'inactiveeffect');
- //
- if (RBPoint.X - LTPoint.X <> 0) and
- (RBPoint.Y - LTPoint.Y <> 0)
- then
- begin
- if LTPoint.X < CLRect.Left then LTPoint.X := CLRect.Left;
- if LTPoint.Y < CLRect.Top then LTPoint.Y := CLRect.Top;
- if RTPoint.X > CLRect.Right then RTPoint.X := CLRect.Right;
- if RTPoint.Y < CLRect.Top then RTPoint.Y := CLRect.Top;
- if LBPoint.X < CLRect.Left then LBPoint.X := CLRect.Left;
- if LBPoint.Y > CLRect.Bottom then LBPoint.Y := CLRect.Bottom;
- if RBPoint.X > CLRect.Right then RBPoint.X := CLRect.Right;
- if RBPoint.Y > CLRect.Bottom then RBPoint.Y := CLRect.Bottom;
- end;
- end;
- const
- SkinDataFileFormat = 2;
- procedure TspSkinData.SaveToFile;
- var
- F: TIniFile;
- Version: Integer;
- begin
- //
- F := TIniFile.Create(FileName);
- if BuildMode
- then
- begin
- EraseSections(F);
- LoadNames;
- end;
- //
- F.EraseSection('VERSION');
- Version := SkinDataFileFormat;
- F.WriteInteger('VERSION', 'ver', Version);
- F.WriteString('VERSION', 'skinname', SkinName);
- F.WriteString('VERSION', 'skinauthor', SkinAuthor);
- F.WriteString('VERSION', 'authoremail', AuthorEmail);
- F.WriteString('VERSION', 'authorurl', AuthorURL);
- F.WriteString('VERSION', 'skincomments', SkinComments);
- //
- F.EraseSection('PICTURES');
- F.WriteString('PICTURES', 'picture', FPictureName);
- F.WriteString('PICTURES', 'mask', FMaskName);
- F.WriteString('PICTURES', 'rolluppicture', FRollUpPictureName);
- F.WriteString('PICTURES', 'rollupmask', FRollUpMaskName);
- WriteActivePictures(F);
- //
- F.EraseSection('CURSORS');
- WriteCursors(F);
- //
- F.EraseSection('FORMINFO');
- WriteFormInfo(F);
- //
- F.EraseSection('POPUPWINDOW');
- PopupWindow.SaveToFile(F);
- //
- F.EraseSection('HINTWINDOW');
- HintWindow.SaveToFile(F);
- //
- WriteAreas(F);
- //
- WriteObjects(F);
- //
- WriteCtrls(F);
- //
- F.Free;
- end;
- procedure TspSkinData.LoadFromFile;
- var
- F: TIniFile;
- FilePath: String;
- begin
- Empty := True;
- SendSkinDataMessage(WM_BEFORECHANGESKINDATA);
- ClearAll;
- F := TIniFile.Create(FileName);
- if not CheckSkinFile(F)
- then
- begin
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- F.Free;
- Exit;
- end;
- FilePath := ExtractFilePath(FileName);
- //
- SkinName := F.ReadString('VERSION', 'skinname', '');
- SkinAuthor := F.ReadString('VERSION', 'skinauthor', '');
- AuthorEmail := F.ReadString('VERSION', 'authoremail', '');
- AuthorURL := F.ReadString('VERSION', 'authorurl', '');
- SkinComments := F.ReadString('VERSION', 'skincomments', '');
- //
- FPictureName := F.ReadString('PICTURES', 'picture', '');
- FMaskName := F.ReadString('PICTURES', 'mask', '');
- FRollUpPictureName := F.ReadString('PICTURES', 'rolluppicture', '');
- FRollUpMaskName := F.ReadString('PICTURES', 'rollupmask', '');
- if FPictureName <> ''
- then
- begin
- if IsJpegFile(FPictureName)
- then
- LoadFromJPegFile(FPicture, FilePath + FPictureName)
- else
- FPicture.LoadFromFile(FilePath + FPictureName);
- end
- else
- FPicture.Assign(nil);
- if FMaskName <> ''
- then
- begin
- if IsJpegFile(FMaskName)
- then
- LoadFromJpegFile(FMask, FilePath + FMaskName)
- else
- FMask.LoadFromFile(FilePath + FMaskName);
- end
- else
- FMask.Assign(nil);
- if FRollUpPictureName <> ''
- then
- begin
- if IsJpegFile(FRollUpPictureName)
- then
- LoadFromJPegFile(FRollUpPicture, FilePath + FRollUpPictureName)
- else
- FRollUpPicture.LoadFromFile(FilePath + FRollUpPictureName);
- end
- else
- FRollUpPicture.Assign(nil);
- if FRollUpMaskName <> ''
- then
- begin
- if IsJpegFile(FRollUpMaskName)
- then
- LoadFromJPegFile(FRollUpMask, FilePath + FRollUpMaskName)
- else
- FRollUpMask.LoadFromFile(FilePath + FRollUpMaskName);
- end
- else
- FRollUpMask.Assign(nil);
- ReadActivePictures(F, FilePath);
- ReadCursors(F, FilePath);
- //
- ReadFormInfo(F);
- //
- PopupWindow.LoadFromFile(F);
- //
- HintWindow.LoadFromFile(F);
- //
- ReadAreas(F);
- //
- ReadObjects(F);
- //
- ReadCtrls(F);
- //
- if BuildMode then LoadNames;
- F.UpdateFile;
- F.Free;
- Empty := False;
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- end;
- procedure TspSkinData.LoadCompressedStoredSkin(AStoredSkin: TspCompressedStoredSkin);
- var
- TmpStream: TMemoryStream;
- CV: Integer;
- FIniStrings: TStrings;
- F: TMemIniFile;
- IsEmpty: Boolean;
- i, Count: Integer;
- begin
- if AStoredSkin.Empty then Exit;
- Empty := True;
- SendSkinDataMessage(WM_BEFORECHANGESKINDATA);
- ClearAll;
- TmpStream := TMemoryStream.Create;
- AStoredSkin.DeCompressToStream(TmpStream);
- TmpStream.Seek(0, 0);
- TmpStream.Read(CV, SizeOf(CV));
- if CV <> 1
- then
- begin
- TmpStream.Free;
- Exit;
- end;
- //
- TmpStream.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FPicture.Assign(nil)
- else FPicture.LoadFromStream(TmpStream);
- TmpStream.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FMask.Assign(nil)
- else FMask.LoadFromStream(TmpStream);
- TmpStream.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FRollUpPicture.Assign(nil)
- else FRollUpPicture.LoadFromStream(TmpStream);
- TmpStream.Read(IsEmpty, SizeOf(IsEmpty));
- if IsEmpty
- then FRollUpMask.Assign(nil)
- else FRollUpMask.LoadFromStream(TmpStream);
- TmpStream.Read(Count, SizeOf(Count));
- if Count > 0
- then
- for i := 0 to Count - 1 do
- begin
- FActivePictures.Add(TBitMap.Create);
- TBitMap(FActivePictures.Items[i]).LoadFromStream(TmpStream);
- end;
- //
- FIniStrings := TStringList.Create;
- FIniStrings.LoadFromStream(TmpStream);
- F := TMemIniFile.Create('');
- F.SetStrings(FIniStrings);
- //
- SkinName := F.ReadString('VERSION', 'skinname', '');
- SkinAuthor := F.ReadString('VERSION', 'skinauthor', '');
- AuthorEmail := F.ReadString('VERSION', 'authoremail', '');
- AuthorURL := F.ReadString('VERSION', 'authorurl', '');
- SkinComments := F.ReadString('VERSION', 'skincomments', '');
- ReadFormInfo(F);
- PopupWindow.LoadFromFile(F);
- HintWindow.LoadFromFile(F);
- ReadObjects(F);
- ReadCtrls(F);
- //
- FIniStrings.Free;
- F.Free;
- TmpStream.Free;
- //
- Empty := False;
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- end;
- procedure TspSkinData.LoadStoredSkin;
- var
- F: TMemIniFile;
- i: Integer;
- begin
- Empty := True;
- SendSkinDataMessage(WM_BEFORECHANGESKINDATA);
- ClearAll;
- F := TMemIniFile.Create('');
- //
- F.SetStrings(AStoredSkin.FIniStrings);
- if not CheckSkinFile(F)
- then
- begin
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- F.Free;
- Exit;
- end;
- //
- SkinName := F.ReadString('VERSION', 'skinname', '');
- // load base pictures
- FPicture.Assign(AStoredSkin.FPicture);
- FMask.Assign(AStoredSkin.FMask);
- FRollUpPicture.Assign(AStoredSkin.FRollUpPicture);
- FRollUpMask.Assign(AStoredSkin.FRollUpMask);
- // load activepictures
- if AStoredSkin.FActivePictures.Count > 0
- then
- for i := 0 to AStoredSkin.FActivePictures.Count - 1 do
- begin
- FActivePictures.Add(TBitMap.Create);
- TBitMap(FActivePictures.Items[i]).Assign(TBitMap(AStoredSkin.FActivePictures.Items[i]));
- end;
- // load cursors
- StartCursorIndex := F.ReadInteger('CURSORS', 'startcursorindex', 1);
- if StartCursorIndex < 1 then StartCursorIndex := 1;
- //
- ReadFormInfo(F);
- //
- PopupWindow.LoadFromFile(F);
- //
- HintWindow.LoadFromFile(F);
- //
- ReadAreas(F);
- //
- ReadObjects(F);
- //
- ReadCtrls(F);
- //
- F.Free;
- Empty := False;
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- end;
- procedure TspSkinData.ClearSkin;
- begin
- ClearAll;
- SendSkinDataMessage(WM_BEFORECHANGESKINDATA);
- SendSkinDataMessage(WM_CHANGESKINDATA);
- SendSkinDataMessage(WM_AFTERCHANGESKINDATA);
- end;
- constructor TspCompressedStoredSkin.Create(AOwner: TComponent);
- begin
- inherited;
- FCompressedStream := TMemoryStream.Create;
- end;
- destructor TspCompressedStoredSkin.Destroy;
- begin
- FCompressedStream.Free;
- inherited;
- end;
- function TspCompressedStoredSkin.GetEmpty: Boolean;
- begin
- Result := FCompressedStream.Size = 0;
- end;
- procedure TspCompressedStoredSkin.SetFileName;
- begin
- if (csDesigning in ComponentState) and not
- (csLoading in ComponentState)
- then
- begin
- FFileName := ExtractFileName(Value);
- LoadFromIniFile(Value);
- end
- else
- FFileName := Value;
- end;
- procedure TspCompressedStoredSkin.DefineProperties(Filer: TFiler);
- begin
- inherited;
- Filer.DefineBinaryProperty('CompressedData', ReadData, WriteData, True);
- end;
- const
- CompressVersion = 1;
- procedure TspCompressedStoredSkin.ReadData;
- begin
- FCompressedStream.LoadFromStream(Reader);
- end;
- procedure TspCompressedStoredSkin.WriteData;
- begin
- FCompressedStream.SaveToStream(Writer);
- end;
- procedure TspCompressedStoredSkin.DeCompressToStream;
- begin
- DecompressStream(S, FCompressedStream);
- end;
- procedure TspCompressedStoredSkin.LoadFromIniFile(AFileName: String);
- var
- TmpStream: TMemoryStream;
- F: TMemIniFile;
- Path: String;
- FIniStrings: TStrings;
- BitMapName: String;
- BitMap: TBitMap;
- IsEmpty: Boolean;
- i, Count, CV: Integer;
- PNames: TStrings;
- begin
- FIniStrings := TStringList.Create;
- FIniStrings.LoadFromFile(AFileName);
- F := TMemIniFile.Create(AFileName);
- if not CheckSkinFile(F)
- then
- begin
- F.Free;
- FIniStrings.Free;
- Exit;
- end;
- Path := ExtractFilePath(AFileName);
- FCompressedStream.Clear;
- TmpStream := TMemoryStream.Create;
- //
- CV := CompressVersion;
- TmpStream.Write(CV, SizeOf(CV));
- // load bitmaps to stream
- BitMap := TBitMap.Create;
- //
- BitMapName := F.ReadString('PICTURES', 'picture', '');
- if BitMapName <> ''
- then BitMap.LoadFromFile(Path + BitMapName)
- else BitMap.Assign(nil);
- IsEmpty := BitMap.Empty;
- TmpStream.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty
- then BitMap.SaveToStream(TmpStream);
- //
- BitMapName := F.ReadString('PICTURES', 'mask', '');
- if BitMapName <> ''
- then BitMap.LoadFromFile(Path + BitMapName)
- else BitMap.Assign(nil);
- IsEmpty := BitMap.Empty;
- TmpStream.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty then BitMap.SaveToStream(TmpStream);
- //
- BitMapName := F.ReadString('PICTURES', 'rolluppicture', '');
- if BitMapName <> ''
- then BitMap.LoadFromFile(Path + BitMapName)
- else BitMap.Assign(nil);
- IsEmpty := BitMap.Empty;
- TmpStream.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty
- then BitMap.SaveToStream(TmpStream);
- //
- BitMapName := F.ReadString('PICTURES', 'rollupmask', '');
- if BitMapName <> ''
- then BitMap.LoadFromFile(Path + BitMapName)
- else BitMap.Assign(nil);
- IsEmpty := BitMap.Empty;
- TmpStream.Write(IsEmpty, SizeOf(IsEmpty));
- if not IsEmpty
- then BitMap.SaveToStream(TmpStream);
- //
- PNames := TStringList.Create;
- ReadStrings1(F, 'PICTURES', 'activepictures', PNames);
- Count := PNames.Count;
- TmpStream.Write(Count, SizeOf(Count));
- if Count > 0
- then
- for i := 0 to Count - 1 do
- begin
- BitMapName := Path + PNames[i];
- BitMap.LoadFromFile(BitMapName);
- BitMap.SaveToStream(TmpStream);
- end;
- PNames.Free;
- //
- FIniStrings.SaveToStream(TmpStream);
- //
- CompressStream(TmpStream, FCompressedStream);
- BitMap.Free;
- FIniStrings.Free;
- TmpStream.Free;
- F.Free;
- end;
- procedure TspCompressedStoredSkin.LoadFromCompressFile(AFileName: String);
- var
- F: TFileStream;
- CV, Size: LongInt;
- begin
- FCompressedStream.Clear;
- F := TFileStream.Create(AFileName, fmOpenRead);
- F.Read(CV, SizeOf(CV));
- if CV = 1
- then
- begin
- F.Read(Size, SizeOf(Size));
- FCompressedStream.CopyFrom(F, Size);
- end;
- F.Free;
- end;
- procedure TspCompressedStoredSkin.SaveToCompressFile(AFileName: String);
- var
- F: TFileStream;
- CV, Size: LongInt;
- begin
- if Empty then Exit;
- F := TFileStream.Create(AFileName, fmCreate);
- CV := CompressVersion;
- F.Write(CV, SizeOf(CV));
- Size := FCompressedStream.Size;
- F.Write(Size, SizeOf(Size));
- FCompressedStream.SaveToStream(F);
- F.Free;
- end;
- end.