git-svn-id: svn://ultimatepp.org/upp/trunk@1847 f0d560ea-af0d-0410-9eb7-867de7ffcac7

This commit is contained in:
sergeynikitin 2009-12-27 12:20:05 +00:00
parent dbe9b51ede
commit eee2da4355
5 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,5 @@
file
splash-sv.h,
splash-sv-init.h,
splash-sv.cpp;

3
bazaar/SplashSV/init Normal file
View file

@ -0,0 +1,3 @@
#ifndef _SplashSV_icpp_init_stub
#define _SplashSV_icpp_init_stub
#endif

View file

@ -0,0 +1,5 @@
SetSplashQtf((String)(SPLASHQTF));
SetSplashLogo(SPLASH_LOGO_NATIVE,SPLASH_LOGO_INTERNATIONAL);
SetSplashNativeLang(SPLASH_NATIVE_LANG);
ShowSplash();

View file

@ -0,0 +1,92 @@
#include <Core/Core.h>
#include <CtrlLib/CtrlLib.h>
#include "splash-sv.h"
//#include "PrintProject.h"
static String splashqtf;
static Image logoNative;
static Image logoInternational;
String native_lang;
Label* SplashStatusPtr;
Size SplashScreen(Ctrl& parent, Array<Ctrl>& ctrl)
{
Image logo;
if(ToLower(LNGAsText(GetSystemLNG()& 0xfffff))==native_lang)
logo = logoNative;
else
logo = logoInternational;
Size isz = logo.GetSize();
ImageCtrl& l = ctrl.Create<ImageCtrl>();
l.SetImage(logo);
Size sz = Size(isz.cx, isz.cy + 260);
parent.Add(ctrl.Create<StaticRect>().Color(White).SizePos());
parent.Add(l.TopPos(0, isz.cy).LeftPos(0, isz.cx));
RichTextView& w = ctrl.Create<RichTextView>();
SetLanguage(GetSystemLNG()& 0xfffff);
Topic t;
t = GetTopic(splashqtf+"$"+ ToLower(LNGAsText(GetSystemLNG()& 0xfffff)));
if (t.text.IsEmpty()) {
t = GetTopic(splashqtf+"$en-us");
}
w.SetQTF(t);
w.PageWidth(3900);
w.NoSb();
w.SetFrame(NullFrame());
parent.Add(w.TopPos(isz.cy , 240).LeftPos(0, isz.cx));
Label& SplashStatus=ctrl.Create<Label>();
SplashStatus.SetText(t_("Program Loading..."));
SplashStatus.SetFont(Arial(12));
SplashStatus.SetAlign(ALIGN_CENTER);
SplashStatusPtr = &SplashStatus;
parent.Add(SplashStatus.HCenterPos(380, 0).BottomPos(2, 20));
return sz;
}
void ShowSplashStatus(String SplashStatusString){
if(Single<Splash>().IsOpen()) {
SplashStatusPtr->SetText(SplashStatusString);
Cout() << SplashStatusString << "\n";
Ctrl::ProcessEvents();
}
}
void HideSplash()
{
if(Single<Splash>().IsOpen())
Single<Splash>().Close();
}
void ShowSplash()
{
Single<Splash>().PopUp(NULL, false, false,false,true);
SetTimeCallback (40000, callback(HideSplash));
Ctrl::ProcessEvents();
}
void SetSplashTimer(int time)
{
SetTimeCallback(time, callback(HideSplash));
}
void SetSplashQtf(String s) {
splashqtf = s;
}
void SetSplashLogo(const Image& lruru,const Image& lenus) {
logoNative = lruru;
logoInternational = lenus;
}
void SetSplashLogo(const Image& logo) {
logoNative = logo;
logoInternational = logo;
}
void SetSplashNativeLang(String s){
native_lang = s;
}

View file

@ -0,0 +1,29 @@
using namespace Upp ;
Size SplashScreen(Ctrl& parent, Array<Ctrl>& ctrl);
struct Splash : Ctrl {
Array<Ctrl> ctrl;
Splash() {
SetRect(GetWorkArea().CenterRect(SplashScreen(*this, ctrl) + 2));
SetFrame(BlackFrame());
}
};
void SetSplashQtf(String s);
void SetSplashLogo(const Image& lruru,const Image& lenus);
void SetSplashLogo(const Image& logo);
void ShowSplashStatus(String SplashStatusString);
void HideSplash();
void ShowSplash();
void SetSplashTimer(int time);
void SetSplashNativeLang(String s);
#define SplashInit() \
SetSplashQtf((String)(SPLASHQTF));\
SetSplashLogo(SPLASH_LOGO_NATIVE,SPLASH_LOGO_INTERNATIONAL);\
SetSplashNativeLang(SPLASH_NATIVE_LANG);\
ShowSplash();