emAvFileModel::emAvFileModel( emContext & context, const emString & name, const emString & filePath, const emString & serverProcPath ) : emFileModel(context,name), emAvClient(emAvServerModel::Acquire(context.GetRootContext(),serverProcPath)) { FilePath=filePath; States=emAvStates::Acquire(GetRootContext()); ActiveList=emVarModel<emAvFileModel*>::Lookup( GetRootContext(),"emAvFileModel::ActiveList" ); if (!ActiveList) { ActiveList=emVarModel<emAvFileModel*>::Acquire( GetRootContext(),"emAvFileModel::ActiveList" ); ActiveList->Var=NULL; } ALNext=NULL; ALThisPtr=NULL; Video=false; PlayLength=0; PlayState=PS_STOPPED; PlayPos=0; AudioVolume=0; AudioMute=false; AudioVisu=0; AudioChannel=0; SpuChannel=0; Tallness=1.0; }
emFileManModel::emFileManModel(emContext & context, const emString & name) : emModel(context,name) { SetMinCommonLifetime(UINT_MAX); Sel[0].SetTuningLevel(1); Sel[1].SetTuningLevel(1); SelCmdCounter=0; IpcServer=new IpcServerClass(*this); FileUpdateSignalModel=emFileModel::AcquireUpdateSignalModel(GetRootContext()); AddWakeUpSignal(FileUpdateSignalModel->Sig); LoadCommands(emGetConfigDirOverloadable(GetRootContext(),"emFileMan","Commands")); }
bool emTestPanel::TkTest::Cycle() { emContext * ctx; emTkDialog * dlg; emView::ViewFlags vFlags; emWindow::WindowFlags wFlags; if (IsSignaled(SFLen->GetValueSignal())) { SFPos->SetMaxValue(SFLen->GetValue()); } if (IsSignaled(BtCreateDlg->GetClickSignal())) { ctx=&GetView(); if (CbTopLev->IsChecked()) ctx=&GetRootContext(); vFlags=emView::VF_ROOT_SAME_TALLNESS; if (CbPZoom->IsChecked()) vFlags|=emView::VF_POPUP_ZOOM; wFlags=0; if (CbModal->IsChecked()) wFlags|=emWindow::WF_MODAL; if (CbUndec->IsChecked()) wFlags|=emWindow::WF_UNDECORATED; if (CbPopup->IsChecked()) wFlags|=emWindow::WF_POPUP; if (CbFull->IsChecked()) wFlags|=emWindow::WF_FULLSCREEN; dlg=new emTkDialog(*ctx,vFlags,wFlags); dlg->AddNegativeButton("Close"); dlg->EnableAutoDeletion(); dlg->SetRootTitle("Test Dialog"); new TkTest(dlg->GetContentTiling(),"test"); } return false; }
void emTreeDumpRecPanel::AutoExpand() { emRef<emFpPluginList> pl; int i,n; if (!Rec) return; n=Rec->Files.GetCount(); if (n) { pl=emFpPluginList::Acquire(GetRootContext()); for (i=0; i<n; i++) { pl->CreateFilePanel( this, emString::Format("%d",i), emGetAbsolutePath(Rec->Files.Get(i),Dir) ); } } for (i=0; i<Rec->Children.GetCount(); i++) { new emTreeDumpRecPanel( this, emString::Format("%d",n+i), &Rec->Children[i], Dir ); } }
emMainPanel::emMainPanel( ParentArg parent, const emString & name, double controlTallness ) : emPanel(parent, name), SliderTimer(GetScheduler()) { MainConfig=emMainConfig::Acquire(GetRootContext()); ControlEdgesColor=emTkLook().GetBgColor(); ControlEdgesImage=emGetInsResImage(GetRootContext(),"emMain","ControlEdges.tga"); ControlViewPanel=new emSubViewPanel(this,"control view"); ContentViewPanel=new emSubViewPanel(this,"content view"); Slider=new SliderPanel(*this,"slider"); GetControlView().SetViewFlags( emView::VF_POPUP_ZOOM | emView::VF_ROOT_SAME_TALLNESS | emView::VF_NO_ACTIVE_HIGHLIGHT ); GetControlView().SetBackgroundColor(emTkLook().GetBgColor()); GetContentView().SetViewFlags( emView::VF_ROOT_SAME_TALLNESS ); ControlTallness=controlTallness; UnifiedSliderPos=MainConfig->ControlViewSize; FullscreenOn=false; OldMouseX=0.0; OldMouseY=0.0; ContentViewPanel->ActivateLater(); AddWakeUpSignal(GetControlView().GetEOISignal()); AddWakeUpSignal(SliderTimer.GetSignal()); if (GetWindow()) AddWakeUpSignal(GetWindow()->GetWindowFlagsSignal()); UpdateCoordinates(); UpdateFullscreen(); UpdateSliderHiding(false); }
void emFileManModel::UpdateCommands() { emString rootDir; rootDir=emGetConfigDirOverloadable(GetRootContext(),"emFileMan","Commands"); if (CmdRoot->Dir!=rootDir || !CheckCRCs(CmdRoot)) { emDLog("emFileManModel: Reloading commands."); LoadCommands(rootDir); Signal(CommandsSignal); } }
emMainPanel::SliderPanel::SliderPanel(emMainPanel & parent, const emString & name) : emPanel(parent,name), MainPanel(parent) { MouseOver=false; Pressed=false; Hidden=false; PressMY=0.0; PressSliderY=0.0; SetFocusable(false); SliderImage=emGetInsResImage(GetRootContext(),"emMain","Slider.tga"); }
emDirEntryPanel::emDirEntryPanel( ParentArg parent, const emString & name, const emDirEntry & dirEntry ) : emPanel(parent,name), DirEntry(dirEntry) { FileMan=emFileManModel::Acquire(GetRootContext()); Config=emFileManViewConfig::Acquire(GetView()); BgColor=0; AddWakeUpSignal(FileMan->GetSelectionSignal()); AddWakeUpSignal(Config->GetChangeSignal()); UpdateBgColor(); }
emAlarmClockModel::emAlarmClockModel(emView & view, const emString & name) : emModel(view,name), BeepTimer(GetScheduler()), VisitTimer(GetScheduler()) { View=&view; TimeZonesModel=emTimeZonesModel::Acquire(GetRootContext()); AlarmSecOfDay=0; PreventAlarmSecs=0; AlarmDurationSecs=0; BeepIntervalMillisecs=0; AlarmEnabled=false; AlarmTrigger=false; Alarming=false; AddWakeUpSignal(BeepTimer.GetSignal()); AddWakeUpSignal(VisitTimer.GetSignal()); AddWakeUpSignal(TimeZonesModel->GetTimeSignal()); }
emFpPluginList::emFpPluginList(emContext & context, const emString & name) : emModel(context,name) { emString dirPath,pluginPath; emArray<emString> dirList; emFpPlugin * plugin; int i; SetMinCommonLifetime(UINT_MAX); Plugins.SetTuningLevel(4); dirPath=emGetConfigDirOverloadable(GetRootContext(),"emCore","FpPlugins"); try { dirList=emTryLoadDir(dirPath); } catch (emString errorMessage) { emFatalError("emFpPluginList: %s",errorMessage.Get()); } dirList.Sort(emStdComparer<emString>::Compare); for (i=0; i<dirList.GetCount(); i++) { pluginPath=emGetChildPath(dirPath,dirList[i]); if (strcmp(emGetExtensionInPath(pluginPath),".emFpPlugin")==0) { plugin=new emFpPlugin; try { plugin->TryLoad(pluginPath); } catch (emString errorMessage) { delete plugin; emFatalError("emFpPluginList: %s",errorMessage.Get()); } Plugins.Add(plugin); } } Plugins.Sort(CmpReversePluginPriorities,this); Plugins.Compact(); }
//! called during the update of the entity void Button::Update() { if(!GetRootContext()->IsTopContext() || !m_bVisible) { return; } if(InputManager::Instance()->IsTouchJustPressed()) { if(IsTouched()) { SetPressed(true); } } else if(InputManager::Instance()->IsTouchPressed()) { if(m_bPressed && !IsTouched()) { SetPressed(false); } } else if(InputManager::Instance()->IsTouchJustReleased()) { if(m_bPressed) { if(m_bCheckBox) { SetChecked(!m_bChecked); } SendUIEvent(); SetPressed(false); // somewhat of a hack, ensures no more elements can catch a touch released in the current frame InputManager::Instance()->Update(); } } }
emFileManThemeNames::emFileManThemeNames(emContext & context, const emString & name) : emModel(context,name) { emArray<emString> names; int i, eLen, nLen; ThemeInfo * ti; emRef<emFileManTheme> t; try { names=emTryLoadDir(emFileManTheme::GetThemesDirPath()); } catch (emString) { names.Empty(); } eLen=strlen(emFileManTheme::ThemeFileEnding); for (i=0; i<names.GetCount(); ) { nLen=strlen(names[i])-eLen; if (nLen>0 && strcmp(names[i].Get()+nLen,emFileManTheme::ThemeFileEnding)==0) { names.GetWritable(i).Remove(nLen,eLen); i++; } else { names.Remove(i); } } names.Sort(emStdComparer<emString>::Compare); ThemeInfos.SetCount(names.GetCount()); for (i=0; i<ThemeInfos.GetCount(); i++) { ti=&ThemeInfos.GetWritable(i); ti->Name=names[i]; t=emFileManTheme::Acquire(GetRootContext(),ti->Name); ti->DisplayName=t->DisplayName; t=NULL; } SetMinCommonLifetime(INT_MAX); }
emFileManTheme::emFileManTheme(emContext & context, const emString & name) : emConfigModel(context,name), emStructRec(), DisplayName(this,"DisplayName"), BackgroundColor(this,"BackgroundColor"), SourceSelectionColor(this,"SourceSelectionColor"), TargetSelectionColor(this,"TargetSelectionColor"), NormalNameColor(this,"NormalNameColor"), ExeNameColor(this,"ExeNameColor"), DirNameColor(this,"DirNameColor"), FifoNameColor(this,"FifoNameColor"), BlkNameColor(this,"BlkNameColor"), ChrNameColor(this,"ChrNameColor"), SockNameColor(this,"SockNameColor"), OtherNameColor(this,"OtherNameColor"), PathColor(this,"PathColor"), SymLinkColor(this,"SymLinkColor"), LabelColor(this,"LabelColor"), InfoColor(this,"InfoColor"), FileContentColor(this,"FileContentColor"), DirContentColor(this,"DirContentColor"), Height(this,"Height"), BackgroundX(this,"BackgroundX"), BackgroundY(this,"BackgroundY"), BackgroundW(this,"BackgroundW"), BackgroundH(this,"BackgroundH"), BackgroundRX(this,"BackgroundRX"), BackgroundRY(this,"BackgroundRY"), OuterBorderX(this,"OuterBorderX"), OuterBorderY(this,"OuterBorderY"), OuterBorderW(this,"OuterBorderW"), OuterBorderH(this,"OuterBorderH"), OuterBorderL(this,"OuterBorderL"), OuterBorderT(this,"OuterBorderT"), OuterBorderR(this,"OuterBorderR"), OuterBorderB(this,"OuterBorderB"), OuterBorderImg(this,"OuterBorderImg",GetRootContext()), OuterBorderImgL(this,"OuterBorderImgL"), OuterBorderImgT(this,"OuterBorderImgT"), OuterBorderImgR(this,"OuterBorderImgR"), OuterBorderImgB(this,"OuterBorderImgB"), NameX(this,"NameX"), NameY(this,"NameY"), NameW(this,"NameW"), NameH(this,"NameH"), NameAlignment(this,"NameAlignment"), PathX(this,"PathX"), PathY(this,"PathY"), PathW(this,"PathW"), PathH(this,"PathH"), PathAlignment(this,"PathAlignment"), InfoX(this,"InfoX"), InfoY(this,"InfoY"), InfoW(this,"InfoW"), InfoH(this,"InfoH"), InfoAlignment(this,"InfoAlignment"), FileInnerBorderX(this,"FileInnerBorderX"), FileInnerBorderY(this,"FileInnerBorderY"), FileInnerBorderW(this,"FileInnerBorderW"), FileInnerBorderH(this,"FileInnerBorderH"), FileInnerBorderL(this,"FileInnerBorderL"), FileInnerBorderT(this,"FileInnerBorderT"), FileInnerBorderR(this,"FileInnerBorderR"), FileInnerBorderB(this,"FileInnerBorderB"), FileInnerBorderImg(this,"FileInnerBorderImg",GetRootContext()), FileInnerBorderImgL(this,"FileInnerBorderImgL"), FileInnerBorderImgT(this,"FileInnerBorderImgT"), FileInnerBorderImgR(this,"FileInnerBorderImgR"), FileInnerBorderImgB(this,"FileInnerBorderImgB"), FileContentX(this,"FileContentX"), FileContentY(this,"FileContentY"), FileContentW(this,"FileContentW"), FileContentH(this,"FileContentH"), DirInnerBorderX(this,"DirInnerBorderX"), DirInnerBorderY(this,"DirInnerBorderY"), DirInnerBorderW(this,"DirInnerBorderW"), DirInnerBorderH(this,"DirInnerBorderH"), DirInnerBorderL(this,"DirInnerBorderL"), DirInnerBorderT(this,"DirInnerBorderT"), DirInnerBorderR(this,"DirInnerBorderR"), DirInnerBorderB(this,"DirInnerBorderB"), DirInnerBorderImg(this,"DirInnerBorderImg",GetRootContext()), DirInnerBorderImgL(this,"DirInnerBorderImgL"), DirInnerBorderImgT(this,"DirInnerBorderImgT"), DirInnerBorderImgR(this,"DirInnerBorderImgR"), DirInnerBorderImgB(this,"DirInnerBorderImgB"), DirContentX(this,"DirContentX"), DirContentY(this,"DirContentY"), DirContentW(this,"DirContentW"), DirContentH(this,"DirContentH"), AltX(this,"AltX"), AltY(this,"AltY"), AltW(this,"AltW"), AltH(this,"AltH"), AltLabelX(this,"AltLabelX"), AltLabelY(this,"AltLabelY"), AltLabelW(this,"AltLabelW"), AltLabelH(this,"AltLabelH"), AltLabelAlignment(this,"AltLabelAlignment"), AltPathX(this,"AltPathX"), AltPathY(this,"AltPathY"), AltPathW(this,"AltPathW"), AltPathH(this,"AltPathH"), AltPathAlignment(this,"AltPathAlignment"), AltAltX(this,"AltAltX"), AltAltY(this,"AltAltY"), AltAltW(this,"AltAltW"), AltAltH(this,"AltAltH"), AltInnerBorderX(this,"AltInnerBorderX"), AltInnerBorderY(this,"AltInnerBorderY"), AltInnerBorderW(this,"AltInnerBorderW"), AltInnerBorderH(this,"AltInnerBorderH"), AltInnerBorderL(this,"AltInnerBorderL"), AltInnerBorderT(this,"AltInnerBorderT"), AltInnerBorderR(this,"AltInnerBorderR"), AltInnerBorderB(this,"AltInnerBorderB"), AltInnerBorderImg(this,"AltInnerBorderImg",GetRootContext()), AltInnerBorderImgL(this,"AltInnerBorderImgL"), AltInnerBorderImgT(this,"AltInnerBorderImgT"), AltInnerBorderImgR(this,"AltInnerBorderImgR"), AltInnerBorderImgB(this,"AltInnerBorderImgB"), AltContentX(this,"AltContentX"), AltContentY(this,"AltContentY"), AltContentW(this,"AltContentW"), AltContentH(this,"AltContentH"), MinContentVW(this,"MinContentVW"), MinAltVW(this,"MinAltVW") { PostConstruct( *this, emGetChildPath(GetThemesDirPath(), name + ThemeFileEnding) ); LoadOrInstall(); }
void emDirEntryPanel::UpdateContentPanel(bool forceRecreation, bool forceRelayout) { const char * soughtName; emRef<emFpPluginList> fppl; emPanel * p; const emFileManTheme * theme; double cx,cy,cw,ch; emColor cc; theme = &Config->GetTheme(); p=GetChild(ContentName); if (forceRecreation && p) { delete p; p=NULL; } if (DirEntry.IsDirectory()) { cx=theme->DirContentX; cy=theme->DirContentY; cw=theme->DirContentW; ch=theme->DirContentH; cc=theme->DirContentColor; } else { cx=theme->FileContentX; cy=theme->FileContentY; cw=theme->FileContentW; ch=theme->FileContentH; cc=theme->FileContentColor; } soughtName=GetSoughtName(); if ( ( soughtName && strcmp(soughtName,ContentName)==0 ) || ( IsViewed() && GetViewedWidth()*cw>=theme->MinContentVW && PanelToViewX(cx)<GetClipX2() && PanelToViewX(cx+cw)>GetClipX1() && PanelToViewY(cy)<GetClipY2() && PanelToViewY(cy+ch)>GetClipY1() ) ) { if (!p) { fppl=emFpPluginList::Acquire(GetRootContext()); p=fppl->CreateFilePanel( this, ContentName, DirEntry.GetPath(), DirEntry.GetStatErrNo(), DirEntry.GetStat()->st_mode ); p->BeFirst(); forceRelayout=true; } } else if (p && !p->IsInVisitedPath()) { delete p; p=NULL; } if (p && forceRelayout) p->Layout(cx,cy,cw,ch,cc); }
void emFileManModel::LoadCommand(CommandNode * parent, const emString & cmdPath) { char * buf, * p, * name; const char * miss; CommandNode * cmd; FILE * file; emColor col; bool beginFound, endFound, typeFound, orderFound, interpreterFound, dirFound; bool defaultForFound, iconFound, bgColorFound, fgColorFound; bool buttonBgColorFound, buttonFgColorFound, hotkeyFound; int bufsize,i,hashCode,insertIndex,line; if (Cmds.GetCount()>=10000) { emFatalError("Too many file manager commands, or a cycle in the command tree."); } hashCode=emCalcHashCode(cmdPath); insertIndex=SearchCommand(hashCode,cmdPath); if (insertIndex>=0) { parent->Children.Add(Cmds[insertIndex].Node); return; } insertIndex=~insertIndex; cmd=new CommandNode; cmd->CmdPath=cmdPath; cmd->Look=parent->Look; buf=NULL; file=NULL; bufsize=65536; buf=new char[bufsize]; file=fopen(cmdPath,"r"); if (!file) goto L_ErrFile; beginFound=false; endFound=false; typeFound=false; orderFound=false; interpreterFound=false; dirFound=false; defaultForFound=false; iconFound=false; bgColorFound=false; fgColorFound=false; buttonBgColorFound=false; buttonFgColorFound=false; hotkeyFound=false; line=0; while (fgets(buf,bufsize,file)) { // Count lines. line++; // Trim. p=buf; while (*p && (unsigned char)*p<=32) p++; for (i=strlen(p); i>0 && (unsigned char)p[i-1]<=32; i--); p[i]=0; // Eat #[<whitespace>] if (beginFound && *p!='#' && *p!=0) goto L_ErrSyntax; if (*p!='#') continue; p++; while (*p && (unsigned char)*p<=32) p++; // Comment? if (*p=='#') continue; // Begin? if (!beginFound) { if (strcasecmp(p,"[[BEGIN PROPERTIES]]")==0) beginFound=true; continue; } // End? if (strcasecmp(p,"[[END PROPERTIES]]")==0) { endFound=true; break; } // Eat <name>[<whitespace>]= for (i=0; p[i]!=0 && p[i]!='='; i++); if (p[i]==0) goto L_ErrSyntax; name=p; p+=i+1; while (i>0 && (unsigned char)name[i-1]<=32) i--; name[i]=0; // Branch by name. if (strcasecmp(name,"Type")==0) { if (typeFound) goto L_ErrDoubleProperty; typeFound=true; while (*p && (unsigned char)*p<=32) p++; if (strcasecmp(p,"Command")==0) cmd->Type=CT_COMMAND; else if (strcasecmp(p,"Group")==0) cmd->Type=CT_GROUP; else if (strcasecmp(p,"Separator")==0) cmd->Type=CT_SEPARATOR; else goto L_ErrSyntax; } else if (strcasecmp(name,"Order")==0) { if (orderFound) goto L_ErrDoubleProperty; orderFound=true; while (*p && (unsigned char)*p<=32) p++; cmd->Order=atof(p); } else if (strcasecmp(name,"Interpreter")==0) { if (interpreterFound) goto L_ErrDoubleProperty; interpreterFound=true; while (*p && (unsigned char)*p<=32) p++; cmd->Interpreter=p; } else if (strcasecmp(name,"Directory")==0 || strcasecmp(name,"Dir")==0) { if (dirFound) goto L_ErrDoubleProperty; dirFound=true; while (*p && (unsigned char)*p<=32) p++; cmd->Dir=emGetAbsolutePath(emGetChildPath(emGetParentPath(cmdPath),p)); } else if (strcasecmp(name,"DefaultFor")==0) { if (defaultForFound) goto L_ErrDoubleProperty; defaultForFound=true; while (*p && (unsigned char)*p<=32) p++; cmd->DefaultFor=p; } else if (strcasecmp(name,"Caption")==0) { while (*p && (unsigned char)*p<=32) p++; if (!cmd->Caption.IsEmpty()) cmd->Caption+="\n"; cmd->Caption+=p; } else if (strcasecmp(name,"Description")==0 || strcasecmp(name,"Descr")==0) { if (!cmd->Description.IsEmpty()) cmd->Description+="\n"; cmd->Description+=p; } else if (strcasecmp(name,"Icon")==0) { if (iconFound) goto L_ErrDoubleProperty; iconFound=true; while (*p && (unsigned char)*p<=32) p++; try { cmd->Icon=emTryGetInsResImage(GetRootContext(),"icons",p); } catch (emString) { try { cmd->Icon=emTryGetInsResImage(GetRootContext(),"icons","em-error-unknown-icon.tga"); } catch (emString) { } } } else if (strcasecmp(name,"BgColor")==0) { if (bgColorFound) goto L_ErrDoubleProperty; bgColorFound=true; try { col.TryParse(p); cmd->Look.SetBgColor(col); } catch (emString) { emWarning("In file \"%s\": unknown color: %s",cmdPath.Get(),p); } } else if (strcasecmp(name,"FgColor")==0) { if (fgColorFound) goto L_ErrDoubleProperty; fgColorFound=true; try { col.TryParse(p); cmd->Look.SetFgColor(col); } catch (emString) { emWarning("In file \"%s\": unknown color: %s",cmdPath.Get(),p); } } else if (strcasecmp(name,"ButtonBgColor")==0) { if (buttonBgColorFound) goto L_ErrDoubleProperty; buttonBgColorFound=true; try { col.TryParse(p); cmd->Look.SetButtonBgColor(col); } catch (emString) { emWarning("In file \"%s\": unknown color: %s",cmdPath.Get(),p); } } else if (strcasecmp(name,"ButtonFgColor")==0) { if (buttonFgColorFound) goto L_ErrDoubleProperty; buttonFgColorFound=true; try { col.TryParse(p); cmd->Look.SetButtonFgColor(col); } catch (emString) { emWarning("In file \"%s\": unknown color: %s",cmdPath.Get(),p); } } else if (strcasecmp(name,"Hotkey")==0) { if (hotkeyFound) goto L_ErrDoubleProperty; hotkeyFound=true; while (*p && (unsigned char)*p<=32) p++; try { cmd->Hotkey.TryParse(p); } catch (emString) { emWarning("In file \"%s\": unknown hotkey: %s",cmdPath.Get(),p); } } else if (strcasecmp(name,"BorderScaling")==0) { while (*p && (unsigned char)*p<=32) p++; cmd->BorderScaling=atof(p); } else if (strcasecmp(name,"PrefChildTallness")==0) { while (*p && (unsigned char)*p<=32) p++; cmd->PrefChildTallness=atof(p); } else { goto L_ErrSyntax; } } if (ferror(file)) goto L_ErrFile; fclose(file); file=NULL; delete [] buf; buf=NULL; if (cmd->Hotkey.IsValid()) { if (!cmd->Description.IsEmpty()) cmd->Description+="\n\n"; cmd->Description+="Hotkey: "; cmd->Description+=cmd->Hotkey.GetString(); } if (!beginFound) { goto L_Err; } if (!endFound) { emWarning( "Syntax error in file \"%s\": properties not terminated.", cmdPath.Get() ); goto L_Err; } if (!typeFound) { miss="Type"; goto L_ErrMissingProperty; } if (!dirFound && cmd->Type==CT_GROUP) { miss="Directory"; goto L_ErrMissingProperty; } Cmds.InsertNew(insertIndex); Cmds.GetWritable(insertIndex).HashCode=hashCode; Cmds.GetWritable(insertIndex).Node=cmd; parent->Children.Add(cmd); if (cmd->Type==CT_GROUP) { LoadChildCommands(cmd); } return; L_ErrSyntax: emWarning( "Syntax error in file \"%s\" line %d.", cmdPath.Get(), line ); goto L_Err; L_ErrDoubleProperty: emWarning( "Error in file \"%s\" line %d: double property", cmdPath.Get(), line ); goto L_Err; L_ErrMissingProperty: emWarning( "Error in file \"%s\": missing property \"%s\".", cmdPath.Get(), miss ); goto L_Err; L_ErrFile: emWarning( "Failed to read file \"%s\": %s", cmdPath.Get(), emGetErrorText(errno).Get() ); goto L_Err; L_Err: if (file) fclose(file); if (buf) delete [] buf; if (cmd) delete cmd; }
emAvFileControlPanel::emAvFileControlPanel( ParentArg parent, const emString & name, emAvFileModel * fileModel ) : emTkGroup(parent,name,"emAv - Audio & Video Player") { emTkTiling * left, * right, * vol, * inf; emTkLook look; Mdl=fileModel; SetPrefChildTallness(0.2); SetPrefChildTallness(0.4,1); left=new emTkTiling(this,"left"); left->SetPrefChildTallness(0.05); left->SetPrefChildTallness(0.065,-1); left->SetPrefChildTallness(0.08,-2); inf=new emTkTiling(left,"inf"); inf->SetPrefChildTallness(0.4); inf->SetPrefChildTallness(0.05,1); TfInfo=new emTkTextField(inf,"info","File Info"); TfInfo->SetMultiLineMode(); TfWarning=new emTkTextField(inf,"warning","Player Warnings"); TfWarning->SetMultiLineMode(); look=TfWarning->GetLook(); look.SetOutputFgColor(0xFF0000FF); TfWarning->SetLook(look); SfPlayPos=new emTkScalarField( left,"pos", "Position", "Hotkeys:\n" " D = Decrement\n" " I = Increment\n" " 1 = Start\n" " 2 = 11%\n" " 3 = 22%\n" " ...\n" " 9 = 89%" ); SfPlayPos->SetBorderScaling(0.8); SfPlayPos->SetScaleMarkIntervals( 60*60*1000,15*60*1000,5*60*1000,60*1000, 15*1000,5*1000,1000,500,100,0 ); SfPlayPos->SetTextOfValueFunc(TextOfPlayPos,this); SfPlayPos->SetTextBoxTallness(0.3); SfPlayPos->SetEditable(true); RgPlayState=new emTkRadioButton::Group(left,"play_state"); RgPlayState->SetBorderType(OBT_NONE,IBT_NONE); RgPlayState->SetFocusable(false); RgPlayState->SetPrefChildTallness(0.3); RgPlayState->SetPrefChildTallness(1.0,2,false); RgPlayState->SetPrefChildTallness(1.0,4,false); RbStop=new emTkRadioButton( RgPlayState,"stop", emString(), "Stop playing.\n" "\n" "Hotkey: 0", emGetInsResImage(GetRootContext(),"emAv","Stop.tga") ); RbPause=new emTkRadioButton( RgPlayState, "pause", emString(), "Pause playing.\n" "\n" "Hotkey: P or Space", emGetInsResImage(GetRootContext(),"emAv","Pause.tga") ); RbSlow=new emTkRadioButton( RgPlayState, "slow", emString(), "Play slow.\n" "\n" "Hotkey: S", emGetInsResImage(GetRootContext(),"emAv","PlaySlow.tga") ); RbPlay=new emTkRadioButton( RgPlayState, "play", emString(), "Play with normal speed.\n" "\n" "Hotkey: N or Space", emGetInsResImage(GetRootContext(),"emAv","Play.tga") ); RbFast=new emTkRadioButton( RgPlayState, "fast", emString(), "Play fast.\n" "\n" "Hotkey: F", emGetInsResImage(GetRootContext(),"emAv","PlayFast.tga") ); right=new emTkTiling(this,"right"); right->SetPrefChildTallness(0.1); vol=new emTkTiling(right,"audio_volume"); vol->SetPrefChildTallness(0.5); vol->SetPrefChildTallness(0.12,1); CbAudioMute=new emTkCheckButton( vol,"mute", "Mute", "Hotkey: U" ); SfAudioVolume=new emTkScalarField( vol,"audio_volume", "Audio Volume", "Hotkeys:\n" " + = Increase.\n" " - = Decrease." ); SfAudioVolume->SetScaleMarkIntervals(25,5,1,0); SfAudioVolume->SetTextOfValueFunc(TextOfAudioVolume,this); SfAudioVolume->SetTextBoxTallness(0.43); SfAudioVolume->SetEditable(true); SfAudioVolume->SetMaxValue(100); SfAudioVisu=new emTkScalarField( right,"audio_visu", "Audio Visualization", "Hotkeys:\n" " Ctrl+Z = Next visualization.\n" " Ctrl+Shift+Z = Previous visualization." ); SfAudioVisu->SetTextOfValueFunc(TextOfAudioVisu,this); SfAudioVisu->SetTextBoxTallness(0.3); SfAudioVisu->SetEditable(true); SfAudioChannel=new emTkScalarField( right,"audio_channel", "Audio Channel", "Hotkeys:\n" " Ctrl+A = Next channel.\n" " Ctrl+Shift+A = Previous channel." ); SfAudioChannel->SetTextOfValueFunc(TextOfAudioChannel,this); SfAudioChannel->SetTextBoxTallness(0.3); SfAudioChannel->SetEditable(true); SfSpuChannel=new emTkScalarField( right,"spu_channel", "Subtitles", "Hotkeys:\n" " Ctrl+S = Next channel.\n" " Ctrl+Shift+S = Previous channel." ); SfSpuChannel->SetTextOfValueFunc(TextOfSpuChannel,this); SfSpuChannel->SetTextBoxTallness(0.3); SfSpuChannel->SetEditable(true); AddWakeUpSignal(Mdl->GetInfoSignal()); AddWakeUpSignal(Mdl->GetPlayStateSignal()); AddWakeUpSignal(Mdl->GetPlayPosSignal()); AddWakeUpSignal(Mdl->GetAdjustmentSignal()); AddWakeUpSignal(SfPlayPos->GetValueSignal()); AddWakeUpSignal(RgPlayState->GetCheckSignal()); AddWakeUpSignal(CbAudioMute->GetCheckSignal()); AddWakeUpSignal(SfAudioVolume->GetValueSignal()); AddWakeUpSignal(SfAudioVisu->GetValueSignal()); AddWakeUpSignal(SfAudioChannel->GetValueSignal()); AddWakeUpSignal(SfSpuChannel->GetValueSignal()); UpdateControls(); }