void PixelShaderManager::DoState(PointerWrap& p) { p.Do(s_bFogRangeAdjustChanged); p.Do(s_bViewPortChanged); p.Do(constants); if (p.GetMode() == PointerWrap::MODE_READ) { // Fixup the current state from global GPU state // NOTE: This requires that all GPU memory has been loaded already. Dirty(); } }
void GeometryShaderManager::DoState(PointerWrap &p) { p.Do(s_projection_changed); p.Do(s_viewport_changed); p.Do(constants); if (p.GetMode() == PointerWrap::MODE_READ) { // Fixup the current state from global GPU state // NOTE: This requires that all GPU memory has been loaded already. Dirty(); } }
void VertexShaderManager::Init() { Dirty(); memset(&xfmem, 0, sizeof(xfmem)); memset(&constants, 0 , sizeof(constants)); ResetView(); // TODO: should these go inside ResetView()? Matrix44::LoadIdentity(s_viewportCorrection); memset(g_fProjectionMatrix, 0, sizeof(g_fProjectionMatrix)); for (int i = 0; i < 4; ++i) g_fProjectionMatrix[i*5] = 1.0f; }
void vtRoute::AddPoint(const DPoint2 &epos, const char *structname) { vtUtilNode *node = new vtUtilNode; node->m_Point = epos; node->m_sStructName = structname; m_Nodes.Append(node); Dirty(); // Load structure for the indicated node. // sPath identifies the path to the Route data vtUtilStruct *struc = vtGetTS()->LoadUtilStructure(node->m_sStructName); if (struc) node->m_struct = struc; }
bool TextView::OnInsertText(char *Text, int Len) { bool Status = false; OnDeleteSelection(FALSE); int OldLines = Doc.GetLines(); Status = Doc.Insert(&User, Text, Len); if (Status) { if (OldLines != Doc.GetLines()) { Dirty(TVF_DIRTY_TO_EOP); } else { Dirty(TVF_DIRTY_TO_EOL); } AfterInsertText(Text, Len); } return Status; }
void VertexShaderManager::DoState(PointerWrap &p) { p.Do(g_fProjectionMatrix); p.Do(s_viewportCorrection); p.Do(s_viewRotationMatrix); p.Do(s_viewInvRotationMatrix); p.Do(s_fViewTranslationVector); p.Do(s_fViewRotation); p.Do(constants); p.Do(dirty); if (p.GetMode() == PointerWrap::MODE_READ) { Dirty(); } }
void kGUIMenuObj::Track(void) { bool over; kGUICorners c; GetCorners(&c); /* is the mouse over the title area? */ over=kGUI::MouseOver(&c); if(over==false && !m_depth) { kGUI::DelUpdateTask(this,CALLBACKNAME(Track)); m_track=false; m_colhover=-1; Dirty(); } }
void C4FoWBeam::MergeDirty() { // As a rule, dirty beams following each other should // always be merged, so splits can be reverted once // the landscape changes. C4FoWBeam *pWith = pNext; assert(isDirty()); assert(!!pWith); assert(pWith->isDirty()); // Figure out how far the new dirty beams reaches. Note that // we might lose information about the landscape here. Dirty(Min(getLeftEndY(), pWith->getLeftEndY())); // Set right iRightX = pWith->iRightX; iRightY = pWith->iRightY; // Relink & delete pNext = pWith->getNext(); delete pWith; }
GUI::EEventStatus::Enum GEconomicHealthWindow::OnCustomEvent(UINT32 in_iEventID, const GEventData & in_EventData, GUI::GBaseObject* in_pCaller) { if(in_iEventID == c_OnUpdatableValueChange) { Dirty(true); } else if(in_iEventID == c_iOnEditBoxEditBegin) { m_bBeingEdited = true; } else if(in_iEventID == c_iOnEditBoxEditEnd) { m_bBeingEdited = false; } else { return GBaseObject::OnCustomEvent(in_iEventID, in_EventData, in_pCaller); } return EEventStatus::Handled; }
BOOL CNamedIndexesBlock::AddUnsafe(OIndex oi, CChars* szName) { CArrayBlock avFakeBlock; CNamedIndexedBlock sBlock; int iIndex; if (!mpvCachePos) { return FALSE; } memset_fast(&sBlock, 0, miBlockWidth); sBlock.Set(szName->Text(), oi); avFakeBlock.Fake(miBlockWidth, mpvCachePos, (int)miUsedBlocks, (int)miBlockChunkSize); //It's safe to insert into a faked array because we know there is at least one free element in the chunk //That is: miBlockChunkSize - miUsedBlocks >= 1 iIndex = avFakeBlock.InsertIntoSorted(&CompareNamedIndexedBlock, &sBlock, FALSE); if (miUsedBlocks == 0) { mszFirst.Set(szName); mszLast.Set(szName); } else { if (iIndex == 0) { mszFirst.Set(szName); } else if (iIndex == miUsedBlocks) { mszLast.Set(szName); } } miUsedBlocks++; Dirty(); return TRUE; }
void kGUIMenuObj::CloseMenu(void) { kGUIMenuColObj *col; #if 0 kGUIMenuColObj *menu; kGUIMenuEntryObj *me; #endif /* close the current open menu */ if(m_depth) { col=m_activeentry.GetEntry(m_depth-1); col->Close(); --m_depth; Dirty(); if(m_depth) { col=m_activeentry.GetEntry(m_depth-1); col->ReActivate(); } } #if 0 /* check for open-submenu */ if(m_depth>0) { menu=m_activeentry.GetEntry(m_depth-1); me=menu->GetCurrentEntry(); if(me->GetSubMenu()) { kGUICorners c; /* activate sub-menu */ me->GetCorners(&c); OpenMenu(me->GetSubMenu(),c.rx-6,c.ty+2); } } #endif }
/* only dirty a specific tab at the top, not the whole thing */ void kGUITabObj::DirtyTab(int tab) { kGUICorners c; kGUICorners tc; int tw; int l,r,h,exp; int gap=(m_close==true)?18+8:8; /* -1 == no current overtab, so ignore */ if(tab<0 || m_hidetabs) return; /* calc size of tab area */ kGUI::GetSkin()->GetTabSize(&exp,&l,&r,&h); GetCorners(&c); tw=GetTabWidth(tab)+gap+l+r; tc.lx=c.lx+m_tabx.GetEntry(tab); tc.rx=tc.lx+tw; tc.ty=c.ty+m_taby.GetEntry(tab); tc.by=tc.ty+h; Dirty(&tc); }
void TextView::OnEndSelection() { Flags &= ~TVF_SELECTION; Dirty(TVF_DIRTY_ALL); }
int TextView::ProcessKey(GKey &K) { Flags &= ~(TVF_GOTO_START | TVF_GOTO_END | TVF_EAT_MOVE); if (!K.IsChar) { if (K.Shift()) { Flags |= TVF_SHIFT; } else { Flags &= ~(TVF_SHIFT); } if (K.Down()) { switch (K.c) { case VK_ESCAPE: { OnEscape(K); break; } case VK_RETURN: { OnEnter(K); break; } case VK_BACK: { if (K.Alt()) { if (K.Ctrl()) { Doc.Redo(User); } else { Doc.Undo(User); } Dirty(TVF_DIRTY_ALL); } else { if (Flags & TVF_SELECTION) { OnDeleteSelection(FALSE); UpdateHiddenCheck(); } else if (User.Y() > 0 || User.X() > 0) { Flags &= ~(TVF_SHIFT); OnMoveCursor(-1, 0); OnDeleteText(&User, 1, FALSE); } } break; } case VK_RIGHT: case VK_LEFT: { bool bLeft = K.c == VK_LEFT; int Inc = (bLeft) ? -1 : 1; if (bLeft) { Flags |= TVF_GOTO_START; } else { Flags |= TVF_GOTO_END; } Flags |= TVF_EAT_MOVE; if (K.Ctrl()) { char *c = User; if (bLeft) { OnMoveCursor(Inc, 0); c = User; while ( strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } if (strchr(Delimiters, *c)) { while ( strchr(Delimiters, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } else { // IsText(*c) while ( !strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } if (bLeft) { if (User.Y() > 0 || User.X() > 0) { OnMoveCursor(-Inc, 0); } } else { while ( strchr(WhiteSpace, *c) AND OnMoveCursor(Inc, 0)) { c = User; } } } else { OnMoveCursor(Inc, 0); } break; } case VK_UP: { Flags |= TVF_GOTO_START; OnMoveCursor(0, -1); break; } case VK_DOWN: { Flags |= TVF_GOTO_END; OnMoveCursor(0, 1); break; } case VK_PRIOR: { int Move = 1-DisplayLines; OnSetHidden(HiddenLines+Move); OnMoveCursor(0, Move); break; } case VK_NEXT: { int Move = DisplayLines-1; OnSetHidden(HiddenLines+Move); OnMoveCursor(0, Move); break; } case VK_HOME: { if (K.Ctrl()) { OnSetCursor(0, 0); } else { OnMoveCursor(-User.X(), 0); } break; } case VK_END: { if (K.Ctrl()) { OnSetCursor(1024, Doc.GetLines()); } else { OnMoveCursor(User.LineLength()-User.X(), 0); } break; } case VK_DELETE: { if ( K.Shift() AND (Flags & TVF_SELECTION)) { Cut(); } else { if (Flags & TVF_SELECTION) { OnDeleteSelection(FALSE); UpdateHiddenCheck(); } else if ( User.Y() < Doc.GetLines() || User.X() < User.LineLength()) { OnDeleteText(&User, 1, FALSE); } } break; } case VK_INSERT: { if (Flags & TVF_SELECTION) { if (K.Ctrl()) { Copy(); } } if (K.Shift()) { Paste(); } break; } } } } else { // IsChar #define EXTENDED (1<<24) // if ( !(K.Data & EXTENDED)) { bool InsertChar = K.c >= ' '; // AND K.c < 128 if (K.c == 9) { if ((Flags & TVF_SELECTION) AND Start.Y() != End.Y()) { if (Flags & TVF_SHIFT) { InsertChar = !OnMultiLineTab(false); } else { InsertChar = !OnMultiLineTab(true); } } else { InsertChar = true; } } if (InsertChar) { char Char[2] = " "; Char[0] = K.c; if (OnInsertText(Char)) { OnMoveCursor(1, 0, true); } } } } return TRUE; }
void PixelShaderManager::Init() { memset(&constants, 0, sizeof(constants)); Dirty(); }
void GeometryShaderManager::Init() { memset(&constants, 0, sizeof(constants)); Dirty(); }
void GEconomicHealthWindow::Update(bool in_bForceUpdate) { if( ( Dirty() || m_bBeingEdited ) && !in_bForceUpdate) return; REAL64 l_fGdpValue ; UINT64 l_iPop ; REAL64 l_fPopUnemployed ; REAL64 l_fPopPoverty ; REAL64 l_fInflationLevel ; REAL64 l_fInterestLevel ; REAL64 l_fIncomeTax ; //If it is our country that is selected, fetch the data from the country data if(g_ClientDCL.SelectedCountryID() == g_ClientDAL.ControlledCountryID()) { l_fGdpValue = g_ClientDAL.m_PlayerCountryData.GDPValue(); l_iPop = g_ClientDAL.m_PlayerCountryData.Population(); l_fPopUnemployed = g_ClientDAL.m_PlayerCountryData.Pop1565Unemployed(); l_fPopPoverty = g_ClientDAL.m_PlayerCountryData.PopInPoverty(); l_fInflationLevel = g_ClientDAL.m_PlayerCountryData.InflationLevel(); l_fInterestLevel = g_ClientDAL.m_PlayerCountryData.InterestLevel(); l_fIncomeTax = g_ClientDAL.m_PlayerCountryData.PersonalIncomeTax(); } else { l_fGdpValue = m_pData->m_fGdp; l_iPop = m_pData->m_iPopulation; l_fPopUnemployed = m_pData->m_fUnemploymentRate; l_fPopPoverty = m_pData->m_fPovertyRate; l_fInflationLevel = m_pData->m_fInflation; l_fInterestLevel = m_pData->m_fInterestLevel; l_fIncomeTax = m_pData->m_fIncomeTax; } GString l_sGdpValue = GString::FormatNumber(l_fGdpValue,L" ",L"",L"$ ",L"",3,0); GString l_sPop = GString::FormatNumber(l_fGdpValue / l_iPop,L" ",L"",L"$ ",L"",3,0); GString l_sPopUnemployed = GString::FormatNumber(l_fPopUnemployed * 100,L"",L".",L"",L" %",0,1); GString l_sPopPoverty = GString::FormatNumber(l_fPopPoverty * 100,L"",L".",L"",L" %",0,1); GString l_sInflationLevel = GString::FormatNumber(l_fInflationLevel * 100,L"",L".",L"",L" %",0,1); INT32 l_iLeftMostPos = 58; INT32 l_iRightMostPos = 201 - m_pObjDelimiter->Width(); if(l_fInflationLevel <= -0.12f) m_pObjDelimiter->Left(l_iLeftMostPos); else if(l_fInflationLevel >= 0.18f) m_pObjDelimiter->Left(l_iRightMostPos); else { REAL64 l_fTemp = l_fInflationLevel + 0.12f; l_fTemp = l_fTemp / 0.3f; m_pObjDelimiter->Left( (INT32)( ( (REAL64)(l_iRightMostPos - l_iLeftMostPos) * l_fTemp ) + (REAL64)l_iLeftMostPos ) ); } m_pObjGdpTotal->Text(l_sGdpValue); m_pObjGdpPerCapita->Text(l_sPop); m_pObjUnemploymentTxt->Text(l_sPopUnemployed); m_pObjUnemploymentMtr->Value(l_fPopUnemployed,0); m_pObjPovertyTxt->Text(l_sPopPoverty); m_pObjPovertyMtr->Value(l_fPopPoverty,0); m_pObjInflationValue->Text(l_sInflationLevel); m_pObjInterestLevelVal->Value(l_fInterestLevel * 100); m_pObjPersonalIncomeTaxVal->Value(l_fIncomeTax * 100); Dirty(false); }
bool TextView::OnMoveCursor(int Dx, int Dy, bool NoSelect) { bool Status = FALSE; bool StartSelect = (Flags & TVF_SHIFT) AND !(Flags & TVF_SELECTION); bool EndSelect = !(Flags & TVF_SHIFT) AND (Flags & TVF_SELECTION); GCursor Old = User; if (EndSelect) { GCursor S, E; if (Start < End) { S = Start; E = End; } else { S = End; E = Start; } if (Flags & TVF_GOTO_START) { User = S; } if (Flags & TVF_GOTO_END) { User = E; } if (Flags & TVF_EAT_MOVE) { goto AfterMove; } } if (Dy) { int OldX = User.X(); User.MoveY(Dy); User.SetX(OldX); } else { User.MoveX(Dx); } if (Old != User || EndSelect) { AfterMove: if (!NoSelect) { if (StartSelect) { OnStartSelection(&Old); } if (EndSelect) { OnEndSelection(); } } Dirty(TVF_DIRTY_CURSOR); UpdateHiddenCheck(); if (Flags & TVF_SELECTION) { Dirty(TVF_DIRTY_SELECTION); End = User; } Status = TRUE; } return Status; }
bool kGUITabObj::UpdateInput(void) { kGUICorners c; kGUICorners tc; kGUICorners cb; int i,tw; int l,r,h,exp; bool over; int gap=(m_close==true)?18+8:8; if(m_hidetabs==false) { /* calc size of tab area */ kGUI::GetSkin()->GetTabSize(&exp,&l,&r,&h); GetCorners(&c); c.by=c.ty+exp+(h*m_numtabrows); /* is the mouse over the tab button area? */ over=kGUI::MouseOver(&c); if(over) { /* if i'm not active then activate me */ /* I need to be active so I can track the mouse when it moves */ /* off of the tab area so I can unhilight the last tab under the cursor */ if(m_track==false && m_locked==false) { m_track=true; kGUI::AddUpdateTask(this,CALLBACKNAME(Track)); } /* yes they have mouse over the tabs on the top */ /* which tab is the mouse over? (if any) */ for(i=0;i<m_numtabs;++i) { tw=GetTabWidth(i)+gap+l+r; tc.lx=c.lx+m_tabx.GetEntry(i); tc.rx=tc.lx+tw; tc.ty=c.ty+m_taby.GetEntry(i); tc.by=tc.ty+h; if(kGUI::MouseOver(&tc)) { if(m_locked==false) { /* yes mouse is over this tab */ if(i!=m_overtab) { DirtyTab(m_overtab); DirtyTab(i); m_overtab=i; } /* check for clicking on the close button */ if(i==m_curtab && m_close && kGUI::GetMouseReleaseLeft()==true) { /* position of close button */ cb.lx=tc.rx-r-16; cb.rx=cb.lx+14; cb.ty=tc.ty+2; cb.by=cb.ty+14; if(kGUI::MouseOver(&cb)) { kGUIEvent e; e.m_value[0].i=m_curtab; /* tab being closed */ /* then call tabclicked closed callback, it is up to the app to actually handle */ Dirty(); CallEvent(EVENT_CLOSE,&e); return(true); } } } /* are they rightclicking on the tab? */ if(kGUI::GetMouseClickRight()==true) { if(m_locked) { kGUIEvent e; e.m_value[0].i=i; CallEvent(EVENT_TRYMOVED,&e); } else if(m_overtab!=m_curtab) /* set this to the current tab first */ { kGUIEvent e; kGUI::ClearActiveStack(); e.m_value[0].i=m_curtab; /* save the old value */ m_curtab=m_overtab; /* then call tabclicked callback */ CallEvent(EVENT_MOVED,&e); } /* then call rightclick tab callback */ CallEvent(EVENT_RIGHTCLICK); } if(kGUI::GetMouseReleaseLeft()==true) { if(m_locked) { kGUIEvent e; e.m_value[0].i=i; CallEvent(EVENT_TRYMOVED,&e); } else if(m_overtab!=m_curtab) { kGUIEvent e; kGUI::ClearActiveStack(); e.m_value[0].i=m_curtab; /* save the old value */ m_curtab=m_overtab; Dirty(); /* call the tabclicked callback */ CallEvent(EVENT_MOVED,&e); } } return(true); } } } /* if we got here then the mouse is not hovering over any of the tabs */ /* so we need to reset the overtab variable back to "not over any" (-1) */ if(m_overtab!=-1) { DirtyTab(m_overtab); /* redraw */ m_overtab=-1; } } /* send input to children of currently selected tab */ if(m_numtabs) return(UpdateInputC(m_tabgroups.GetEntry(m_curtab))); return(false); }