FRAMEWIN_Handle FRAMEWIN_CreateAsChild( int x0, int y0, int xsize, int ysize, WM_HWIN hParent, const char* pText, WM_CALLBACK* cb, int Flags) { FRAMEWIN_Handle hObj; /* Create the window */ GUI_LOCK(); hObj = WM_CreateWindowAsChild(x0, y0, xsize/*+2*HBorder*/, ysize/*+TBorder+BBorder*/, hParent, Flags, _FRAMEWIN_Callback, sizeof(FRAMEWIN_Obj) - sizeof(WM_Obj)); if (hObj) { FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj); /* init widget specific variables */ WIDGET__Init(&pObj->Widget, WIDGET_STATE_FOCUSSABLE | WIDGET_STATE_ENABLED); /* init member variables */ pObj->pFont = _pDefaultFont; memcpy(pObj->BarColor, _aBarColor, sizeof(pObj->BarColor)); pObj->TextColor = 0xffffff; pObj->TextAlign = GUI_TA_LEFT; pObj->ClientColor = _DefaultClientColor; pObj->pText = pText; pObj->XOff = 1; pObj->YOff = 1; pObj->cb = cb; CalcPositions(hObj); pObj->hClient = WM_CreateWindowAsChild(0, 0, 0, 0, hObj, WM_CF_SHOW, FRAMEWIN__cbClient, 0); } GUI_UNLOCK(); return hObj; }
void SjVisImpl::Init(wxWindow* thisWindow, bool thisWindowIsFrame) { wxASSERT( m_thisWindow == NULL ); m_thisWindow = thisWindow; m_thisWindowIsFrame = thisWindowIsFrame; CalcPositions(); }
/********************************************************************* * * Exported routines: Various methods * ********************************************************************** */ void FRAMEWIN_SetFont(FRAMEWIN_Handle hObj, const GUI_FONT* pFont) { GUI_LOCK(); if (hObj) { FRAMEWIN_Obj* pObj = FRAMEWIN_H2P(hObj); pObj->pFont = pFont; CalcPositions(hObj); FRAMEWIN_Invalidate(hObj); } GUI_UNLOCK(); }
bool Init() { Vector3f Pos(7.0f, 3.0f, 0.0f); Vector3f Target(0.0f, -0.2f, 1.0f); Vector3f Up(0.0, 1.0f, 0.0f); m_pGameCamera = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT, Pos, Target, Up); m_pEffect = new LightingTechnique(); if (!m_pEffect->Init()) { printf("Error initializing the lighting technique\n"); return false; } m_pEffect->Enable(); m_pEffect->SetColorTextureUnit(COLOR_TEXTURE_UNIT_INDEX); m_pEffect->SetDirectionalLight(m_directionalLight); m_pEffect->SetMatSpecularIntensity(0.0f); m_pEffect->SetMatSpecularPower(0); m_pEffect->SetColor(0, Vector4f(1.0f, 0.5f, 0.5f, 0.0f)); m_pEffect->SetColor(1, Vector4f(0.5f, 1.0f, 1.0f, 0.0f)); m_pEffect->SetColor(2, Vector4f(1.0f, 0.5f, 1.0f, 0.0f)); m_pEffect->SetColor(3, Vector4f(1.0f, 1.0f, 1.0f, 0.0f)); m_pMesh = new Mesh(); if (!m_pMesh->LoadMesh("../../../spider.obj")) { return false; } #ifndef WIN32 if (!m_fontRenderer.InitFontRenderer()) { return false; } #endif m_time = glutGet(GLUT_ELAPSED_TIME); CalcPositions(); return true; }
void SjCoverBrowser::Realize(bool reloadColumnMixer, bool keepColIndex) { // save old index long oldCoverXCount = m_coversXCount; long oldCoverIndex = m_applRowIndex*m_coversXCount; // recalculate the needed stuff if( reloadColumnMixer ) { m_scrollY = 0; m_applCoverCount = g_mainFrame->m_columnMixer.GetMaskedColCount(); } SjSkinValue value; value.value = 0; value.vmax = 0; value.thumbSize = 0; g_mainFrame->SetSkinTargetValue(IDT_WORKSPACE_H_SCROLL, value); CalcRowStuff(); // try to set a new, fine row index if( oldCoverXCount != m_coversXCount ) { m_applRowIndex = oldCoverIndex / m_coversXCount; } if( m_applRowIndex >= (m_applRowCount-m_coversYCount) ) m_applRowIndex = (m_applRowCount-m_coversYCount); if( m_applRowIndex<0 || !keepColIndex ) m_applRowIndex = 0; // recalculate the rest CalcPositions(); SetVScrollInfo(); m_lastTooltipCover = NULL; }
void SjVisImpl::SetRenderer(SjVisRendererModule* rendererModule, bool justContinue) { wxASSERT( wxThread::IsMain() ); if( rendererModule ) { // set a new renderer RemoveRenderer(); CalcPositions(); // load the renderer if( rendererModule->Load() ) { m_renderer = rendererModule; rendererModule->Start(this, justContinue); } } else { // remove an exiting renderer RemoveRenderer(); wxASSERT( m_renderer == NULL ); } }
bool SjCoverBrowser::OnVScroll(int nScrollCode, int nPos, bool redraw) { wxASSERT( nScrollCode == IDT_WORKSPACE_V_SCROLL || nScrollCode == IDT_WORKSPACE_LINE_UP || nScrollCode == IDT_WORKSPACE_LINE_DOWN || nScrollCode == IDT_WORKSPACE_PAGE_UP || nScrollCode == IDT_WORKSPACE_PAGE_DOWN || nScrollCode == IDT_WORKSPACE_HOME || nScrollCode == IDT_WORKSPACE_END ); long newIndex = m_applRowIndex, oldIndex, abs; bool canUseScroll; if( nScrollCode == IDT_WORKSPACE_HOME ) { newIndex = 0; } else if( nScrollCode == IDT_WORKSPACE_END ) { newIndex = m_applRowCount; // sth. substracted below } else if( nScrollCode == IDT_WORKSPACE_LINE_UP ) { newIndex--; } else if( nScrollCode == IDT_WORKSPACE_LINE_DOWN ) { newIndex++; } else if( nScrollCode == IDT_WORKSPACE_PAGE_UP ) { newIndex -= m_coversYCount; } else if( nScrollCode == IDT_WORKSPACE_PAGE_DOWN ) { newIndex += m_coversYCount; } else if( nScrollCode == IDT_WORKSPACE_V_SCROLL ) { newIndex = nPos; } if( newIndex > m_applRowCount-m_coversYCount ) { newIndex = m_applRowCount-m_coversYCount; // may get below zero, this is checked below } if( newIndex < 0 ) { newIndex = 0; } if( (newIndex != m_applRowIndex) || (newIndex == 0 && m_scrollY != 0) ) { oldIndex = m_applRowIndex; canUseScroll = TRUE; if( newIndex == 0 ) { m_scrollY = 0; canUseScroll = FALSE; } m_applRowIndex = newIndex; CalcPositions(); SetVScrollInfo(); abs = oldIndex - newIndex; if( abs < 0 ) { abs*=-1; } if( abs > m_coversYCount ) { canUseScroll = FALSE; } if( canUseScroll ) { if( g_mainFrame->m_imgThread->HasWaitingImages() ) { canUseScroll = FALSE; } } if( redraw ) { if( canUseScroll ) { wxRect scrollRect = SCROLL_RECT; m_window->ScrollWindow(0, (oldIndex - newIndex)*(m_coverNTitleHeight + SPACE_TOP), &scrollRect); m_window->Update(); } else { m_window->Refresh(); } return true; } } return false; }
bool SjCoverBrowser::OnSkinTargetEvent(int targetId, SjSkinValue& value, long accelFlags) { bool shiftSelection = g_mainFrame->IsOpAvailable(SJ_OP_MULTI_ENQUEUE)? ((accelFlags&wxACCEL_SHIFT)!=0) : false; m_preservedVisible.Clear(); //bool shiftSelection = g_mainFrame->IsAllAvailable()? ((accelFlags&wxACCEL_SHIFT)!=0) : false; if( targetId >= IDT_WORKSPACE_GOTO_A && targetId <= IDT_WORKSPACE_GOTO_0_9 ) { g_visModule->StopVisIfOverWorkspace(); g_mainFrame->EndSimpleSearch(); if( !GotoCover(g_mainFrame->m_columnMixer.GetMaskedColIndexByAz(targetId)) ) CalcPositions(); // needed to reset a-z m_window->SetFocus(); return true; } else switch( targetId ) { case IDT_WORKSPACE_GOTO_RANDOM: g_visModule->StopVisIfOverWorkspace(); g_mainFrame->EndSimpleSearch(); GotoCover(SjTools::Rand(g_mainFrame->m_columnMixer.GetMaskedColCount()), true); m_window->SetFocus(); return true; case IDT_WORKSPACE_KEY_LEFT: if( !g_mainFrame->IsWorkspaceMovedAway() ) DoChangeSelection(SJ_SEL_LEFT, shiftSelection); return true; case IDT_WORKSPACE_KEY_RIGHT: if( !g_mainFrame->IsWorkspaceMovedAway() ) DoChangeSelection(SJ_SEL_RIGHT, shiftSelection); return true; case IDT_WORKSPACE_KEY_UP: if( !g_mainFrame->IsWorkspaceMovedAway() ) DoChangeSelection(SJ_SEL_UP, shiftSelection); return true; case IDT_WORKSPACE_KEY_DOWN: if( !g_mainFrame->IsWorkspaceMovedAway() ) DoChangeSelection(SJ_SEL_DOWN, shiftSelection); return true; case IDT_WORKSPACE_V_SCROLL: case IDT_WORKSPACE_LINE_UP: case IDT_WORKSPACE_LINE_DOWN: case IDT_WORKSPACE_PAGE_UP: case IDT_WORKSPACE_PAGE_DOWN: case IDT_WORKSPACE_HOME: // the search should stay "as is" case IDT_WORKSPACE_END: OnVScroll(targetId, value.value, TRUE /*redraw*/); return true; case IDT_WORKSPACE_PAGE_LEFT: // this is only accessible for explicit page left/right buttons as used in the "Old-style Jukebox" OnVScroll(IDT_WORKSPACE_PAGE_UP, 0, TRUE /*redraw*/); return true; case IDT_WORKSPACE_PAGE_RIGHT: // this is only accessible for explicit page left/right buttons as used in the "Old-style Jukebox" OnVScroll(IDT_WORKSPACE_PAGE_DOWN, 0, TRUE /*redraw*/); return true; case IDT_WORKSPACE_ENTER: if( FindFirstSelectedCover() ) ToggleView(); return true; } return false; }
void SjCoverBrowser::OnMouseMotion(wxMouseEvent& event) { if( !m_window->HasCapture() ) return; long hDifference, vDifference; long oldRowIndex, oldScrollY; long xPos = event.GetX(); /* client coordinates */ long yPos = event.GetY(); /* client coordinates */ // start dragscroll or object dragging? if( m_window->m_mouseAction == SJ_ACTION_NONE ) { hDifference = xPos - m_dragStartX; vDifference = yPos - m_dragStartY; if( hDifference > DRAGSCROLL_DELTA || hDifference < -DRAGSCROLL_DELTA || vDifference > DRAGSCROLL_DELTA || vDifference < -DRAGSCROLL_DELTA ) { #ifdef USE_COVER_DND SjCol* cover; if( g_accelModule->m_selDragNDrop && (cover=FindCover(m_dragStartX, m_dragStartY))!=NULL && cover->IsAnyRowSelected() ) { // do object dragging m_window->m_dragUrls.Clear(); g_mainFrame->m_columnMixer.GetSelectedUrls(m_window->m_dragUrls); if( g_accelModule->m_flags&SJ_ACCEL_USEDNDIMAGES ) { g_mainFrame->m_dragImage = m_window->GetCoverDragNDropBitmap(cover, g_mainFrame->m_dragRect); if( g_mainFrame->m_dragImage ) { g_mainFrame->m_dragHotspot.x = xPos - cover->m_textlLeft; g_mainFrame->m_dragHotspot.y = yPos - cover->m_top + m_scrollY; } } if( g_mainFrame->DragNDrop(SJ_DND_ENTER, m_window, event.GetPosition(), NULL, &m_window->m_dragUrls) ) { m_window->m_mouseAction = SJ_ACTION_DRAGNDROP; } } else #endif if( g_accelModule->m_flags&SJ_ACCEL_CONTENT_DRAG && m_applRowCount ) { // start dragscroll m_window->m_mouseAction = SJ_ACTION_DRAGSCROLL; m_dragscrollCurrY = yPos; } } } // in drag'n'drop? #ifdef USE_COVER_DND if( m_window->m_mouseAction == SJ_ACTION_DRAGNDROP ) { if( !g_mainFrame->DragNDrop(SJ_DND_MOVE, m_window, event.GetPosition(), NULL, &m_window->m_dragUrls) ) { m_window->m_mouseAction = SJ_ACTION_NONE; } } #endif // in dragscroll? if( m_window->m_mouseAction == SJ_ACTION_DRAGSCROLL ) { oldScrollY = m_scrollY; oldRowIndex = m_applRowIndex; // horizontal scrolling vDifference = yPos - m_dragscrollCurrY; m_dragscrollCurrY = yPos; if( vDifference ) { if( vDifference > m_coverNTitleHeight ) { vDifference = m_coverNTitleHeight; } else if( vDifference < 0 - m_coverNTitleHeight ) { vDifference = 0 - m_coverNTitleHeight; } m_scrollY -= vDifference; if( m_scrollY < 0 ) { // decrease application column position if possible if( m_applRowIndex > 0 ) { m_scrollY += m_coverNTitleHeight + SPACE_TOP; m_applRowIndex--; CalcPositions(); SetVScrollInfo(); } else { m_scrollY = 0; } } else if( m_scrollY >= m_coverNTitleHeight + SPACE_TOP ) { // increase application column position if possible if( m_applRowIndex < m_applRowCount-m_coversYCount ) { m_scrollY -= m_coverNTitleHeight + SPACE_TOP; m_applRowIndex++; CalcPositions(); SetVScrollInfo(); } else { m_scrollY = m_coverNTitleHeight + SPACE_TOP; } } else if( (m_allocatedCoverCount/m_coversXCount)*(m_coverNTitleHeight+SPACE_TOP)-m_scrollY < m_window->m_clientH ) { // a new column will fit on the right if( m_applRowIndex+m_coversYCount < m_applRowCount ) { CalcPositions(); } } } // update window if( vDifference ) { if( g_mainFrame->m_imgThread->HasWaitingImages() ) { // if there are waiting images, invalidate the whole rectangle as // some areas are no yet okay m_window->Refresh(); } else { vDifference = (oldRowIndex*(m_coverNTitleHeight+SPACE_TOP) + oldScrollY) - (m_applRowIndex*(m_coverNTitleHeight+SPACE_TOP) + m_scrollY); wxRect scrollRect = SCROLL_RECT; m_window->ScrollWindow(0, vDifference, &scrollRect); m_window->Update(); } } } }
void SjCoverBrowser::OnSize(wxSizeEvent& event) { CalcPositions(); SetVScrollInfo(); }