void cMenuSetupMailNotification::SetHelpKeys() { bool showTestButton = strlen(data->MailAddress) > 0 && strlen(data->MailServer) > 0 && data->mailViaScript; const char* ItemText = Get(Current())->Text(); if (!HasSubMenu()) { if (strstr(ItemText, tr("Email address")) == ItemText) { if (!InEditMode(ItemText, tr("Email address"), data->MailAddress)) SetHelp(NULL, NULL, tr("Button$Help"), showTestButton?tr("Button$Test"):NULL); } else if (strstr(ItemText, tr("SMTP server")) == ItemText) { if (!InEditMode(ItemText, tr("SMTP server"), data->MailServer)) SetHelp(NULL, NULL, tr("Button$Help"), showTestButton?tr("Button$Test"):NULL); } else if (strstr(ItemText, tr("Use SMTP authentication")) == ItemText) SetHelp(NULL, NULL, tr("Button$Help"), showTestButton?tr("Button$Test"):NULL); else if (strstr(ItemText, IndentMenuItem(tr("Auth user"))) == ItemText) { if (!InEditMode(ItemText, IndentMenuItem(tr("Auth user")), data->MailAuthUser)) SetHelp(NULL, NULL, tr("Button$Help"), showTestButton?tr("Button$Test"):NULL); } else if (strstr(ItemText, IndentMenuItem(tr("Auth password"))) == ItemText) { if (!InEditMode(ItemText, IndentMenuItem(tr("Auth password")), tmpMailAuthPass)) SetHelp(NULL, NULL, tr("Button$Help"), showTestButton?tr("Button$Test"):NULL); } else SetHelp(NULL, NULL, tr("Button$Help"), NULL); } }
eOSState cMenuSetupMailNotification::ProcessKey(eKeys Key) { int iTemp_MailUseAuth = data->MailUseAuth; int iTemp_sendMailOnSearchtimers = data->sendMailOnSearchtimers; int iTemp_mailViaScript = data->mailViaScript; const char* ItemText = Get(Current())->Text(); bool bAuthPassWasInEditMode = false; if (ItemText && strlen(ItemText) > 0 && strstr(ItemText, IndentMenuItem(tr("Auth password"))) == ItemText) bAuthPassWasInEditMode = InEditMode(ItemText, IndentMenuItem(tr("Auth password")), tmpMailAuthPass); eOSState state = cMenuSetupSubMenu::ProcessKey(Key); ItemText = Get(Current())->Text(); bool bAuthPassIsInEditMode = false; if (ItemText && strlen(ItemText) > 0 && strstr(ItemText, IndentMenuItem(tr("Auth password"))) == ItemText) bAuthPassIsInEditMode = InEditMode(ItemText, IndentMenuItem(tr("Auth password")), tmpMailAuthPass); if (bAuthPassWasInEditMode && !bAuthPassIsInEditMode) { strcpy(data->MailAuthPass, tmpMailAuthPass); string strHidden(strlen(data->MailAuthPass), '*'); strcpy(tmpMailAuthPass, strHidden.c_str()); Set(); Display(); } if (!bAuthPassWasInEditMode && bAuthPassIsInEditMode) { strcpy(tmpMailAuthPass, ""); Set(); Display(); state = cMenuSetupSubMenu::ProcessKey(Key); } if (iTemp_MailUseAuth != data->MailUseAuth || iTemp_mailViaScript != data->mailViaScript || iTemp_sendMailOnSearchtimers != data->sendMailOnSearchtimers) { Set(); Display(); } SetHelpKeys(); if (state == osUnknown) { switch (Key) { case kOk: return osBack; case kBlue: if (data->mailViaScript) return TestMailAccount(); else return osContinue; default: break; } } return state; }
//----------------------------------------------------------------------------- // Purpose: Message pump //----------------------------------------------------------------------------- bool CEngineAPI::MainLoop() { bool bIdle = true; long lIdleCount = 0; // Main message pump while ( true ) { // Pump messages unless someone wants to quit if ( eng->GetQuitting() != IEngine::QUIT_NOTQUITTING ) { if ( eng->GetQuitting() != IEngine::QUIT_TODESKTOP ) return true; return false; } // Pump the message loop if ( !InEditMode() ) { PumpMessages(); } else { PumpMessagesEditMode( bIdle, lIdleCount ); } // Run engine frame + hammer frame if ( !InEditMode() || m_hEditorHWnd ) { VCRSyncToken( "Frame" ); // Deactivate edit mode shaders ActivateEditModeShaders( false ); eng->Frame(); // Reactivate edit mode shaders (in Edit mode only...) ActivateEditModeShaders( true ); } if ( InEditMode() ) { g_pHammer->RunFrame(); } } return false; }
//----------------------------------------------------------------------------- // Activate/deactivates edit mode shaders //----------------------------------------------------------------------------- void CEngineAPI::ActivateEditModeShaders( bool bActive ) { if ( InEditMode() && ( g_pMaterialSystemConfig->bEditMode != bActive ) ) { MaterialSystem_Config_t config = *g_pMaterialSystemConfig; config.bEditMode = bActive; OverrideMaterialSystemConfig( config ); } }
void LIB_TEXT::Rotate() { if( InEditMode() ) { m_rotate = true; } else { SetTextAngle( GetTextAngle() == TEXT_ANGLE_VERT ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT ); } }
void LIB_TEXT::Rotate() { if( InEditMode() ) { m_rotate = true; } else { m_Orient = ( m_Orient == TEXT_ORIENT_VERT ) ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT; } }
//----------------------------------------------------------------------------- // Sets the engine to run in a particular editor window //----------------------------------------------------------------------------- void CEngineAPI::SetEngineWindow( void *hWnd ) { if ( !InEditMode() ) return; // Detach input from the previous editor window game->InputDetachFromGameWindow(); m_hEditorHWnd = hWnd; videomode->SetGameWindow( m_hEditorHWnd ); }
void LIB_TEXT::SetText( const wxString& aText ) { if( aText == m_Text ) return; if( InEditMode() ) { m_savedText = aText; m_updateText = true; } else { m_Text = aText; } }
void cMenuSetupTimers::SetHelpKeys() { const char* ItemText = Get(Current())->Text(); if (!HasSubMenu()) { if (strstr(ItemText, tr("Default recording dir")) == ItemText) { if (!InEditMode(ItemText, tr("Default recording dir"), data->defrecdir)) SetHelp(NULL, NULL, tr("Button$Help"), tr("Button$Select")); } //if (strstr(ItemText, tr("Default timer check method")) == ItemText) // SetHelp(NULL, NULL, tr("Button$Help"), tr("Button$Setup")); else SetHelp(NULL, NULL, tr("Button$Help"), NULL); } }
//----------------------------------------------------------------------------- // Purpose: // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CEngine::Load( bool dedicated, const char *rootdir ) { bool success = false; // Activate engine // NOTE: We must bypass the 'next state' block here for initialization to work properly. m_nDLLState = m_nNextDLLState = InEditMode() ? DLL_PAUSED : DLL_ACTIVE; if ( Sys_InitGame( g_AppSystemFactory, rootdir, game->GetMainWindowAddress(), dedicated ) ) { success = true; UpdateMaterialSystemConfig(); } return success; }
void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform ) { if( InEditMode() ) { // Temporarily disable filling while the item is being edited. FILL_T fillMode = m_Fill; EDA_COLOR_T color = GetDefaultColor(); m_Fill = NO_FILL; #ifndef USE_WX_OVERLAY // Erase the old items using the previous attributes. if( m_eraseLastDrawItem ) { GRSetDrawMode( aDC, g_XorMode ); drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); } #endif // Calculate the new attributes at the current cursor position. calcEdit( aOffset ); // Draw the items using the new attributes. drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); m_Fill = fillMode; } else { drawGraphic( aPanel, aDC, aOffset, aColor, aDrawMode, aData, aTransform ); } }
eOSState cMenuBlacklistEdit::ProcessKey(eKeys Key) { bool bHadSubMenu = HasSubMenu(); int iTemp_mode = data.mode; int iTemp_useTime = data.useTime; int iTemp_useChannel = data.useChannel; int iTemp_useDuration = data.useDuration; int iTemp_useDayOfWeek = data.useDayOfWeek; int iTemp_useExtEPGInfo = data.useExtEPGInfo; eOSState state = cOsdMenu::ProcessKey(Key); if (iTemp_mode != data.mode || iTemp_useTime != data.useTime || iTemp_useChannel != data.useChannel || iTemp_useDuration != data.useDuration || iTemp_useDayOfWeek != data.useDayOfWeek || iTemp_useExtEPGInfo != data.useExtEPGInfo) { Set(); Display(); } const char* ItemText = Get(Current())->Text(); if (!HasSubMenu()) { if (strlen(ItemText)>0 && strstr(ItemText, tr(" from channel")) == ItemText && ((Key >= k0 && Key <= k9) || Key == kLeft || Key == kRight)) { channelMax = channelMin; Set(); Display(); } } int iOnUserDefDayItem = 0; int iOnUseChannelGroups = 0; int iOnChannelGroup = 0; int iOnTerm = 0; int iOnExtCatItemBrowsable = 0; int iCatIndex = -1; char* catname = NULL; if (!HasSubMenu() && strlen(ItemText)>0) { // check, if on an item of ext. EPG info int iOnExtCatItem = 0; cSearchExtCat *SearchExtCat = SearchExtCats.First(); int index = 0; while (SearchExtCat) { if (strstr(ItemText, IndentMenuItem(SearchExtCat->menuname)) == ItemText) { iOnExtCatItem = 1; if (SearchExtCat->nvalues > 0) iOnExtCatItemBrowsable = 1; iCatIndex = index; catname = SearchExtCat->menuname; break; } index++; SearchExtCat = SearchExtCats.Next(SearchExtCat); } if (strstr(ItemText, tr("Search term")) == ItemText) { if (!InEditMode(ItemText, tr("Search term"), data.search)) // show template for a new search { SetHelp(NULL, NULL, NULL, tr("Button$Templates")); iOnTerm = 1; } } if (strstr(ItemText, IndentMenuItem(tr("Day of week"))) == ItemText) { if (data.DayOfWeek == 7) { SetHelp(trVDR("Button$Edit")); iOnUserDefDayItem = 1; } else SetHelp(NULL); } else if (strstr(ItemText, tr("Use channel")) == ItemText && data.useChannel == 2) { SetHelp(NULL, NULL, NULL, tr("Button$Setup")); iOnUseChannelGroups = 1; } else if (strstr(ItemText, IndentMenuItem(tr("Channel group"))) == ItemText) { SetHelp(NULL, NULL, NULL, tr("Button$Setup")); iOnChannelGroup = 1; } else if (iOnExtCatItem) { if (!InEditMode(ItemText, IndentMenuItem(catname), data.catvalues[iCatIndex]) || SearchExtCats.Get(iCatIndex)->searchmode >= 10) SetHelp(NULL, NULL, NULL, iOnExtCatItemBrowsable?tr("Button$Select"):NULL); } else if (strstr(ItemText, tr("Search term")) != ItemText) SetHelp(NULL, NULL, NULL, NULL); } if (state == osUnknown) { if (HasSubMenu()) return osContinue; switch (Key) { case kOk: if (data.useChannel==1) { cChannel *ch = Channels.GetByNumber(channelMin); if (ch) data.channelMin = ch; else { ERROR(tr("*** Invalid Channel ***")); break; } ch = Channels.GetByNumber(channelMax); if (ch) data.channelMax = ch; else { ERROR(tr("*** Invalid Channel ***")); break; } if (channelMin > channelMax) { ERROR(tr("Please check channel criteria!")); return osContinue; } } if (data.useChannel==2) data.channelGroup = strdup(menuitemsChGr[channelGroupNr]); if (blacklist) { *blacklist = data; if (data.DayOfWeek == 7) blacklist->DayOfWeek = UserDefDayOfWeek; // transfer numeric cat values back to search cSearchExtCat *SearchExtCat = SearchExtCats.First(); int index = 0; while (SearchExtCat) { if (SearchExtCat->searchmode >= 10) { if (blacklist->catvalues[index]) free(blacklist->catvalues[index]); msprintf(&blacklist->catvalues[index], "%d", catvaluesNumeric[index]); } SearchExtCat = SearchExtCats.Next(SearchExtCat); index++; } if (addIfConfirmed) { cMutexLock BlacklistLock(&Blacklists); blacklist->ID = Blacklists.GetNewID(); Blacklists.Add(blacklist); } Blacklists.Save(); addIfConfirmed = false; } return osBack; case kRed: if (iOnUserDefDayItem) state = AddSubMenu(new cMenuEditDaysOfWeek(&UserDefDayOfWeek)); break; case kBlue: if (iOnUseChannelGroups || iOnChannelGroup) { if (channelGroupName) free(channelGroupName); channelGroupName = strdup(menuitemsChGr[channelGroupNr]); state = AddSubMenu(new cMenuChannelGroups(&channelGroupName)); } if (iOnTerm) state = AddSubMenu(new cMenuEPGSearchTemplate(NULL, &data, addIfConfirmed)); if (iOnExtCatItemBrowsable) state = AddSubMenu(new cMenuCatValuesSelect(data.catvalues[iCatIndex], iCatIndex, SearchExtCats.Get(iCatIndex)->searchmode)); break; case kGreen: case kYellow: state = osContinue; default: break; } } if ((iOnUseChannelGroups || iOnChannelGroup || iOnTerm || iOnExtCatItemBrowsable) && bHadSubMenu && !HasSubMenu()) // return form submenu { if (iOnTerm) { if (data.DayOfWeek < 0) { UserDefDayOfWeek = data.DayOfWeek; data.DayOfWeek = 7; } if (data.useChannel == 2) { channelGroupNr = ChannelGroups.GetIndex(data.channelGroup); channelGroupName = strdup(data.channelGroup); } } if (iOnExtCatItemBrowsable && SearchExtCats.Count() > 0) { cSearchExtCat *SearchExtCat = SearchExtCats.First(); int index = 0; while (SearchExtCat) { if (SearchExtCat->searchmode >= 10) catvaluesNumeric[index] = atoi(data.catvalues[index]); SearchExtCat = SearchExtCats.Next(SearchExtCat); index++; } } Set(); Display(); } return state; }
//----------------------------------------------------------------------------- // One-time setup, based on the initially selected mod // FIXME: This should move into the launcher! //----------------------------------------------------------------------------- bool CEngineAPI::OnStartup( void *pInstance, const char *pStartupModName ) { // This fixes a bug on certain machines where the input will // stop coming in for about 1 second when someone hits a key. // (true means to disable priority boost) if ( IsPC() ) { SetThreadPriorityBoost( GetCurrentThread(), true ); } // FIXME: Turn videomode + game into IAppSystems? // Try to create the window COM_TimestampedLog( "game->Init" ); // This has to happen before CreateGameWindow to set up the instance // for use by the code that creates the window if ( !game->Init( pInstance ) ) { goto onStartupError; } // Try to create the window COM_TimestampedLog( "videomode->Init" ); // This needs to be after Shader_Init and registry->Init // This way mods can have different default video settings if ( !videomode->Init( ) ) { goto onStartupShutdownGame; } // We need to access the registry to get various settings (specifically, // InitMaterialSystemConfig requires it). if ( !InitRegistry( pStartupModName ) ) { goto onStartupShutdownVideoMode; } materials->ModInit(); // Setup the material system config record, CreateGameWindow depends on it // (when we're running stand-alone) InitMaterialSystemConfig( InEditMode() ); #if defined( _X360 ) XBX_NotifyCreateListener( XNOTIFY_SYSTEM|XNOTIFY_LIVE|XNOTIFY_XMP ); #endif ShutdownRegistry(); return true; // Various error conditions onStartupShutdownVideoMode: videomode->Shutdown(); onStartupShutdownGame: game->Shutdown(); onStartupError: return false; }