void ui::UIScrollBar::OnDraggingEnd(HWND hWnd, WPARAM wParam, LPARAM lParam, UI2Points clientDragRect, UIDelta delta,
                                    ULONGLONG timestampInMilliSeconds, OUT bool *eaten) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  UNREFERENCED_PARAMETER(hWnd);
  UNREFERENCED_PARAMETER(wParam);
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(delta);
  UNREFERENCED_PARAMETER(timestampInMilliSeconds);
  UNREFERENCED_PARAMETER(eaten);
  if (m_dragging && m_bar->HitTest(clientDragRect.end.x, clientDragRect.end.y)) {
    if (m_direction == SCROLLBAR_DIRECTION_HORIZONTAL) {
      FLOAT sx = (clientDragRect.end.x - m_dragPosInBar.x) - GetSlideAreaOffset();
      FLOAT x = (m_maxValue - m_minValue) / (GetSlideAreaLength() - GetBarLength()) * sx;
      SetBarPosition(x);
#ifdef DEBUG_UISCROLLBAR
      LOG(SEVERITY_LEVEL_DEBUG) << L"sx = " << sx << L", x = " << x;
#endif
    } else {
      FLOAT sy = (clientDragRect.end.y - m_dragPosInBar.y) - GetSlideAreaOffset();
      FLOAT y = (m_maxValue - m_minValue) / (GetSlideAreaLength() - GetBarLength()) * sy;
      SetBarPosition(y);
#ifdef DEBUG_UISCROLLBAR
      LOG(SEVERITY_LEVEL_DEBUG) << L"sy = " << sy << L", y = " << y;
#endif
    }
  }
  m_dragging = false;
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #2
0
HRESULT ui::UIListBox::LayoutComponents() {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
void ui::UIScrollBar::OnLeftMouseDown(HWND hWnd, WPARAM wParam, LPARAM lParam, UIPoint clientPoint,
                                      ULONGLONG timestampInMilliSeconds, OUT bool *eaten) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  UNREFERENCED_PARAMETER(hWnd);
  UNREFERENCED_PARAMETER(wParam);
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(timestampInMilliSeconds);
  UNREFERENCED_PARAMETER(eaten);
  if (m_arrow1->HitTest(clientPoint.x, clientPoint.y)) {
    MoveBarPosition(-m_pageSize / 2.0f);
  } else if (m_arrow2->HitTest(clientPoint.x, clientPoint.y)) {
    MoveBarPosition(m_pageSize / 2.0f);
  } else if (m_slideArea->HitTest(clientPoint.x, clientPoint.y)) {
    if (m_direction == SCROLLBAR_DIRECTION_HORIZONTAL) {
      if (clientPoint.x < m_bar->GetX()) {
        MoveBarPosition(-m_pageSize);
      } else if (m_bar->GetX() + m_bar->GetWidth() < clientPoint.x) {
        MoveBarPosition(m_pageSize);
      }
    } else {
      if (clientPoint.y < m_bar->GetY()) {
        MoveBarPosition(-m_pageSize);
      } else if (m_bar->GetY() + m_bar->GetHeight() < clientPoint.y) {
        MoveBarPosition(m_pageSize);
      }
    }
  }
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #4
0
ui::UIListBox::UIListBox(SCROLL_DIRECTION scrollDirection, UISize preferredBitmapSize)
    : m_scrollDirection(scrollDirection)
    , m_preferredBitmapSize(preferredBitmapSize)
    , m_preferredTextAreaSize(UISize(0.0f, 0.0f))
    , m_marginBetweenBitmapAndText(4.0f)
    , m_marginBetweenItems(4.0f)
    , m_itemWidth(0.0f)
    , m_itemHeight(0.0f)
    , m_scrollBarMarginFromSide(8.0f)
    , m_scrollBarThick(20.0f)
    , m_rectFigure(std::make_unique<graphics::figure::RectangleFigure>())
    , m_colorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOX_COLORSETDEF))
    , m_scrollBar(std::make_shared<ui::UIScrollBar>())
    , m_displayPositionOffset(0.0f) {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  AddElement(m_scrollBar);
  AddBeforeAddElementCallback([&](std::shared_ptr<UIBase> element) -> bool {
    element->SetParentContainer(shared_from_this());
    return true;
  });
  SetFocusable(false);
#ifdef DEBUG_UILISTBOX
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
long
LWIRecordListQuery::GetRecordEntry(sGetRecordEntry* pGetRecordEntry)
{
    long macError = eDSNoErr;

    LOG_ENTER("fType = %d, fResult = %d, fInNodeRef = %d, fInOutDataBuff = @%p  { len = %d, size = %d }, fInRecEntryIndex = %d, fOutAttrListRef = @%p, fOutRecEntryPtr = @%p",
              pGetRecordEntry->fType,
              pGetRecordEntry->fResult,
              pGetRecordEntry->fInNodeRef,
              pGetRecordEntry->fInOutDataBuff,
              pGetRecordEntry->fInOutDataBuff->fBufferLength,
              pGetRecordEntry->fInOutDataBuff->fBufferSize,
              pGetRecordEntry->fInRecEntryIndex,
              pGetRecordEntry->fOutAttrListRef,
              pGetRecordEntry->fOutRecEntryPtr);

    macError = eNotYetImplemented;
    GOTO_CLEANUP_ON_MACERROR(macError);

cleanup:

    LOG_LEAVE("fInOutDataBuff => { length = %d, size = %d } --> %d",
              pGetRecordEntry->fInOutDataBuff->fBufferLength,
              pGetRecordEntry->fInOutDataBuff->fBufferSize,
              macError);

    return macError;
}
Beispiel #6
0
// メインテキストの初期化(テキストフォーマット、テキストレイアウト、テキストメトリックス)
HRESULT ui::UIListBoxItem::__InitializeMainText(graphics::D3DInteropHelper *pD3DInteropHelper) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  // text format
  m_mainTextFormat = nullptr;
  CHK_FATAL_HRESULT(pD3DInteropHelper->GetDWriteFactory()->CreateTextFormat(
      m_mainTextFontAttribute.fontFamilyName.c_str(), nullptr, m_mainTextFontAttribute.GetFontWeight(),
      m_mainTextFontAttribute.GetFontStyle(), m_mainTextFontAttribute.GetFontStretch(),
      m_mainTextFontAttribute.fontSize, L"", &m_mainTextFormat));

  // text layout
  m_mainTextLayout = nullptr;
  CHK_FATAL_HRESULT(graphics::DirectWriteUtil::CreateTextLayoutWithTrimming(
      pD3DInteropHelper->GetDWriteFactory(), m_mainTextFormat, m_mainText.c_str(), m_preferredTextAreaSize.width,
      m_mainTextNumberOfLines, &m_mainTextLayout));
  // metrics
  CHK_FATAL_HRESULT(m_mainTextLayout->GetMetrics(&m_mainTextMetrics));

#ifdef DEBUG_UILISTBOXITEM
  graphics::DirectWriteUtil::DumpMetrics(SEVERITY_LEVEL_DEBUG, L"m_mainTextLayout", m_mainTextLayout);
#endif
  m_mainTextLayoutRect.width = m_textLayoutRect.width;
  m_mainTextLayoutRect.height = m_mainTextMetrics.height;

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
HRESULT ui::UIScrollBar::Render(graphics::D3DInteropHelper *pD3DInteropHelper, ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG) << L"propertyChanged = " << m_propertyChanged;
#endif
  if (m_propertyChanged || IsPropertyChanged()) {
    CHK_FATAL_HRESULT(Initialize(pD3DInteropHelper));
    CHK_FATAL_HRESULT(CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
    m_propertyChanged = false;
    SetPropertyChanged(false);
  }
  if (m_barPositionChanged) {
    UpdateBarPosition();
    m_barPositionChanged = false;
  }

  m_body->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_arrow1->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_arrow2->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_slideArea->Render(pD3DInteropHelper, pRenderTarget, 1.0f);
  m_bar->Render(pD3DInteropHelper, pRenderTarget, 1.0f);

#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
void ui::UIScrollBar::OnMouseOver(HWND hWnd, WPARAM wParam, LPARAM lParam, UIPoint clientPoint, UIDelta delta,
                                  ULONGLONG timestampInMilliSeconds, OUT bool *eaten) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG) << L"clientPoint=" << clientPoint;
#endif
  UNREFERENCED_PARAMETER(hWnd);
  UNREFERENCED_PARAMETER(wParam);
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(clientPoint);
  UNREFERENCED_PARAMETER(delta);
  UNREFERENCED_PARAMETER(timestampInMilliSeconds);
  UNREFERENCED_PARAMETER(eaten);
  //     if(m_arrow1->HitTest(clientPoint.x, clientPoint.y)) {
  //         LOG(SEVERITY_LEVEL_DEBUG) << L"enter into arrow1";
  //         m_arrow1->SetColor(graphics::COLOR_PATTERN_CONVEX, graphics::HSVColor(32.0f, 0.0f, 1.0f, 1.0f));
  //         m_propertyChanged = true;
  //     }
  //     else {
  //         m_arrow1->SetColor(graphics::COLOR_PATTERN_CONVEX, graphics::HSVColor(32.0f, 0.0f, 0.5f, 1.0f));
  //         m_propertyChanged = true;
  //     }
  Invalidate();
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #9
0
HRESULT ui::UIListBox::Render(graphics::D3DInteropHelper *pD3DInteropHelper, ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  m_rectFigure->Render(pD3DInteropHelper, pRenderTarget, 1.0f);

  FLOAT frameThick = static_cast<FLOAT>(m_colorSet->GetNumberOfColors());
  D2D1_RECT_F clipRect = D2D1::RectF(frameThick, frameThick, GetWidth() - frameThick, GetHeight() - frameThick);
  pRenderTarget->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);

  if (m_scrollDirection == SCROLL_DIRECTION_HORIZONTAL) {
    pD3DInteropHelper->PushMatrix(pRenderTarget, D2D1::Matrix3x2F::Translation(-m_displayPositionOffset, 0.0f));

    FLOAT x = 0.0f;
    FLOAT y = m_marginBetweenItems;

    for (size_t i = 0; i < GetNumberOfElements(); ++i) {
      auto element = GetElement(i);
      auto listBoxItem = std::dynamic_pointer_cast<UIListBoxItem>(element);
      if (listBoxItem.get() != nullptr) {
        x += m_marginBetweenItems;
        pD3DInteropHelper->PushMatrix(pRenderTarget, D2D1::Matrix3x2F::Translation(x, y));
        listBoxItem->Render(pD3DInteropHelper, pRenderTarget);
        x += listBoxItem->GetWidth();
        pD3DInteropHelper->PopMatrix(pRenderTarget);
      }
    }
    pD3DInteropHelper->PopMatrix(pRenderTarget);
  } else {
    pD3DInteropHelper->PushMatrix(pRenderTarget, D2D1::Matrix3x2F::Translation(0.0f, -m_displayPositionOffset));

    FLOAT x = m_marginBetweenItems;
    FLOAT y = 0.0f;

    for (size_t i = 0; i < GetNumberOfElements(); ++i) {
      auto element = GetElement(i);
      auto listBoxItem = std::dynamic_pointer_cast<UIListBoxItem>(element);
      if (listBoxItem.get() != nullptr) {
        y += m_marginBetweenItems;
        pD3DInteropHelper->PushMatrix(pRenderTarget, D2D1::Matrix3x2F::Translation(x, y));
        listBoxItem->Render(pD3DInteropHelper, pRenderTarget);
        y += listBoxItem->GetHeight();
        pD3DInteropHelper->PopMatrix(pRenderTarget);
      }
    }
    pD3DInteropHelper->PopMatrix(pRenderTarget);
  }

  pRenderTarget->PopAxisAlignedClip();

  pD3DInteropHelper->PushMatrix(pRenderTarget, D2D1::Matrix3x2F::Translation(m_scrollBar->GetX(), m_scrollBar->GetY()));
  CHK_WARN_HRESULT(m_scrollBar->Render(pD3DInteropHelper, pRenderTarget));
  pD3DInteropHelper->PopMatrix(pRenderTarget);

#ifdef DEBUG_UILISTBOX
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Beispiel #10
0
ui::UIListBox::~UIListBox(void) {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  m_scrollBar.reset();

#ifdef DEBUG_UILISTBOX
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #11
0
void ui::UIListBoxItem::DiscardDeviceDependentResources() {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  m_textBrushSet->DiscardDeviceDependentResource();
  m_bodyBrushSet->DiscardDeviceDependentResource();

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
void graphics::brush::RadialGradientBrush::_CalculateParameters(const D2D1_RECT_F &rect, OUT D2D1_POINT_2F &center,
        OUT D2D1_POINT_2F &offset, OUT FLOAT &radiusX,
        OUT FLOAT &radiusY) {
    LOG_ENTER(SEVERITY_LEVEL_DEBUG) << L"rect=" << rect.left << L"," << rect.top << L"," << rect.right << L","
                                    << rect.bottom;
    radiusX = (rect.right - rect.left) / 2.0f;
    radiusY = (rect.bottom - rect.top) / 2.0f;
    center = D2D1::Point2F(rect.left + radiusX, rect.top + radiusY);
    offset = D2D1::Point2F(radiusX * m_gradientOriginOffsetRate.width, radiusY * m_gradientOriginOffsetRate.height);
    LOG_LEAVE(SEVERITY_LEVEL_DEBUG) << L"center = " << center.x << L"," << center.y << L", offset = " << offset.x << L","
                                    << offset.y << L", radius = " << radiusX << L"," << radiusY;
}
Beispiel #13
0
ModelRenderer::ModelRenderer(QQuickItem *parent)
    : QQuickItem(parent)
    , m_window( nullptr )
    , m_useProgram2( false )
    , m_shaderProgram( nullptr )
    , m_shaderProgram2( nullptr )
    , m_rotateX(0.0)
    , m_rotateY(0.0)
    , m_rotateZ(0.0)
    , m_eyeDistance(4.0)
    , m_eyeAngleX(0.0)
    , m_eyeAngleY(0.0)
    , m_lightDistance(8.0)
    , m_lightAngleX(0.0)
    , m_lightAngleY(0.0)
    , m_ambientBrightness(0.5)
    , m_diffuseBrightness(0.75)
    , m_specularBrightness(1.0)
    , m_ambientReflection(0.5)
    , m_diffuseReflection(0.5)
    , m_specularReflection(0.5)
    , m_shininess(100.0)
    , m_spotExponent(1.0)
    , m_cutoffAngle(180.0)
{
    LOG_ENTER();

    QVector4D lineColor( 0.0, 0.0, 0.0, 1.0 );
//    QVector4D lineColor( 1.0, 1.0, 1.0, 1.0 );
    for( int i = 0; i < NUM_VERTICE * NUM_FACES; i++ ){
        m_lineColorArray[i] = lineColor;
    }

    for( int i = 0; i < NUM_FACES; i ++ ){
        QVector3D normal = createPolygonNormal(
                                m_positionArray[NUM_VERTICE * i].toVector3D(),
                                m_positionArray[NUM_VERTICE * i + 1].toVector3D(),
                                m_positionArray[NUM_VERTICE * i + 2].toVector3D() );
        for( int j = 0; j < NUM_VERTICE; j++ ){
            m_normalArray[NUM_VERTICE * i + j] = normal;
        }
    }

    updateEyePosition();
    updateLightPosition();

    connect( this, SIGNAL(windowChanged(QQuickWindow*)),
             this, SLOT(windowChanged(QQuickWindow *)),
             Qt::DirectConnection );

    LOG_LEAVE();
}
Beispiel #14
0
HRESULT ui::UIListBox::CreateDeviceDependentResources(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                      ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  CHK_FATAL_HRESULT(UIContainer::CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
  CHK_FATAL_HRESULT(m_rectFigure->CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
  CHK_FATAL_HRESULT(m_scrollBar->CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));
#ifdef DEBUG_UILISTBOX
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
void ui::UIScrollBar::DiscardDeviceDependentResources() {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  m_body->DiscardDeviceDependentResources();
  m_arrow1->DiscardDeviceDependentResources();
  m_arrow2->DiscardDeviceDependentResources();
  m_slideArea->DiscardDeviceDependentResources();
  m_bar->DiscardDeviceDependentResources();
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #16
0
long PlugInShell_Configure(void)
{
    long macError = eDSNoErr;

    //
    // Note that, in Mac OS X 10.4.9, at least, this is never called.
    //

    LOG_ENTER("");
    LOG_LEAVE("--> %d", macError);

    return macError;
}
Beispiel #17
0
long PlugInShell_Shutdown(void)
{
    long macError = eDSNoErr;

    //
    // Note that, in Mac OS X 10.4.9, at least, this is never called.
    //

    LOG_ENTER("");

    if (GlobalState.IsInitialized)
    {
        macError = Deactivate();
        if (macError)
        {
            LOG("Deactive error '%s' (%d)", MacErrorToString(macError), macError);
        }
    }

    UninitializeContextList();
    LWICRC::Cleanup();
    LWIRecordQuery::Cleanup();
    LWIDirNodeQuery::Cleanup();
    LWIRecTypeLookup::Cleanup();
    LWIAttrLookup::Cleanup();

    if (GlobalState.IsPeriodicTaskMutexInitialized)
    {
        pthread_mutex_destroy(&GlobalState.PeriodicTaskMutex);
        GlobalState.IsPeriodicTaskMutexInitialized = false;
    }

    if (GlobalState.IsAdminAccessListLockInitialized)
    {
        pthread_rwlock_destroy(&GlobalState.AdminAccessListLock);
        GlobalState.IsAdminAccessListLockInitialized = false;
    }

    if (GlobalState.IsLockInitialized)
    {
        pthread_rwlock_destroy(&GlobalState.Lock);
        GlobalState.IsLockInitialized = false;
    }

    GlobalState.PluginState = kUninitialized | kInactive;
    GlobalState.IsInitialized = false;

    LOG_LEAVE("--> %d", macError);

    return macError;
}
Beispiel #18
0
HRESULT ui::UIListBoxItem::CreateDeviceDependentResources(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                          ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  CHK_FATAL_HRESULT(m_textBrushSet->CreateDeviceDependentResource(pRenderTarget, D2D1::RectF(), 1.0f));
  CHK_FATAL_HRESULT(m_bodyRect->CreateDeviceDependentResources(pD3DInteropHelper, pRenderTarget));

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Beispiel #19
0
// -------------------------------------------------------------------------
// * PlugInShell_Validate ()
//
//  inVersionStr:  Version string of current running Directory Services server.
//  inSignature :  Token handed to the plug-in by the server.  This is needed
//                 by the plug-ins to register/unregister nodes.
//
//                 This routine is called once during plug-in loading.
// -------------------------------------------------------------------------
long
PlugInShell_Validate (
        const char *inVersionStr,
        unsigned long inSignature
    )
{
    long macError = eDSNoErr;

    LOG_ENTER("Version = %s, Signature = %d", SAFE_LOG_STR(inVersionStr), inSignature);
    // Note that is is called before Initialize, so we do not need to synchronize.
    GlobalState.Signature = inSignature;
    LOG_LEAVE("--> %d", macError);

    return macError;
}
void graphics::DirectWriteUtil::GetLineMetrics(IN IDWriteTextLayout *pTextLayout,
                                               OUT std::vector<DWRITE_LINE_METRICS> &lineMetrics) {
#ifdef DEBUG_DIRECTWRITEUTIL_
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  DWRITE_TEXT_METRICS textMetrics;
  CHK_FATAL_HRESULT(pTextLayout->GetMetrics(&textMetrics));
  lineMetrics.resize(textMetrics.lineCount);
  CHK_FATAL_HRESULT(pTextLayout->GetLineMetrics(lineMetrics.data(), textMetrics.lineCount, &textMetrics.lineCount));

#ifdef DEBUG_DIRECTWRITEUTIL_
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
HRESULT ui::UIScrollBar::UpdateBarPosition() {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  if (m_direction == SCROLLBAR_DIRECTION_HORIZONTAL) {
    m_bar->SetX(GetBarOffset());
    m_bar->SetY(GetSlideAreaMargin());
  } else {
    m_bar->SetX(GetSlideAreaMargin());
    m_bar->SetY(GetBarOffset());
  }
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Beispiel #22
0
HRESULT ui::UIListBoxItem::__RecreateAllTextLayout(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                   ID2D1RenderTarget *pRenderTarget) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  CHK_WARN_HRESULT(__RecreateMainTextLayout(pD3DInteropHelper, pRenderTarget, m_mainText, m_mainTextLayout,
                                            m_mainTextMetrics, m_mainTextLayoutRect, m_mainTextNumberOfLines));
  CHK_WARN_HRESULT(__RecreateSubTextLayout(pD3DInteropHelper, pRenderTarget, m_subText1, m_subText1Layout,
                                           m_subText1Metrics, m_subText1LayoutRect));
  CHK_WARN_HRESULT(__RecreateSubTextLayout(pD3DInteropHelper, pRenderTarget, m_subText2, m_subText2Layout,
                                           m_subText2Metrics, m_subText2LayoutRect));
#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Beispiel #23
0
HRESULT gameOfLife3D::MainWnd::OnCreate( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    UNREFERENCED_PARAMETER(hwnd);
    UNREFERENCED_PARAMETER(message);
    UNREFERENCED_PARAMETER(wParam);
    UNREFERENCED_PARAMETER(lParam);
#ifdef DEBUG_MAINWND
    LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

    HRESULT hr = m_canvasPanel->Initialize(shared_from_this());

#ifdef DEBUG_MAINWND
    LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
    return hr;
}
Beispiel #24
0
HRESULT ui::UIListBoxItem::__RecreateSubTextLayout(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                   ID2D1RenderTarget *pRenderTarget, const std::wstring &text,
                                                   CComPtr<IDWriteTextLayout> &textLayout,
                                                   DWRITE_TEXT_METRICS &textMetrics, UIRectangle &textRect) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  UNREFERENCED_PARAMETER(pRenderTarget);
  CComPtr<IDWriteTextLayout> oldTextLayout = textLayout;
  textLayout = nullptr;
  CHK_FATAL_HRESULT(pD3DInteropHelper->GetDWriteFactory()->CreateTextLayout(
      text.c_str(), static_cast<UINT32>(text.length()), oldTextLayout, textRect.width, textRect.height, &textLayout));
  CHK_FATAL_HRESULT(textLayout->GetMetrics(&textMetrics));
#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
void graphics::DirectWriteUtil::GetClusterMetrics(IN IDWriteTextLayout *pTextLayout,
                                                  OUT std::vector<DWRITE_CLUSTER_METRICS> &clusterMetrics) {
#ifdef DEBUG_DIRECTWRITEUTIL_
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  UINT32 actualClusterCount = 0;
  HRESULT hr = pTextLayout->GetClusterMetrics(nullptr, 0, &actualClusterCount);
  if (hr != E_NOT_SUFFICIENT_BUFFER) {
    CHK_FATAL_HRESULT(hr);
  }
  clusterMetrics.resize(actualClusterCount);
  CHK_FATAL_HRESULT(pTextLayout->GetClusterMetrics(clusterMetrics.data(), actualClusterCount, &actualClusterCount));

#ifdef DEBUG_DIRECTWRITEUTIL_
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #26
0
HRESULT ui::UIListBoxItem::__RecreateMainTextLayout(graphics::D3DInteropHelper *pD3DInteropHelper,
                                                    ID2D1RenderTarget *pRenderTarget, const std::wstring &text,
                                                    CComPtr<IDWriteTextLayout> &textLayout,
                                                    DWRITE_TEXT_METRICS &textMetrics, UIRectangle &textRect,
                                                    size_t numberOfLines) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  UNREFERENCED_PARAMETER(pRenderTarget);
  CComPtr<IDWriteTextLayout> oldTextLayout = textLayout;
  textLayout = nullptr;
  CHK_FATAL_HRESULT(graphics::DirectWriteUtil::CreateTextLayoutWithTrimming(
      pD3DInteropHelper->GetDWriteFactory(), oldTextLayout, text.c_str(), textRect.width, numberOfLines, &textLayout));
  CHK_FATAL_HRESULT(textLayout->GetMetrics(&textMetrics));
#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
Beispiel #27
0
// コンストラクタ
ui::UIListBoxItem::UIListBoxItem(void)
    : m_layoutDirection(LAYOUT_DIRECTION_VERTICAL)
    , m_preferredTextAreaSize(0.0f, 0.0f)
    , m_preferredBitmapSize(64.0f, 64.0f)
    , m_marginBetweenBitmapAndText(4.0f)
    , m_textColorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOXITEM_DEFAULT_TEXT_COLORSET))
    , m_textBrushSet(std::make_unique<graphics::brush::BrushSet>())
    , m_bodyColorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOXITEM_DEFAULT_BODY_COLORSET))
    , m_bodyBrushSet(std::make_unique<graphics::brush::BrushSet>())
    , m_bodyRect(std::make_unique<graphics::figure::RectangleFigure>())
    , m_mainText()
    , m_mainTextFontAttribute(12.0f)
    , m_mainTextFormat()
    , m_mainTextLayout()
    , m_mainTextMetrics()
    , m_mainTextLayoutRect()
    , m_subText1()
    , m_subText1FontAttribute(10.0f)
    , m_subText1Format()
    , m_subText1Layout()
    , m_subText1Metrics()
    , m_subText2()
    , m_subText2FontAttribute(10.0f)
    , m_subText2Format()
    , m_subText2Layout()
    , m_subText2Metrics()
    , m_bitmap(std::make_shared<graphics::Bitmap>())
    , m_bitmapLayoutRect(0.0f, 0.0f, 64.0f, 64.0f)
    , m_textLayoutRect(0.0f, 0.0f, 128.0f, 0.0f)
    , m_textChanged(false)
    , m_resourceChanged(false)
    , m_mainTextNumberOfLines(2)
    , m_scrollBar(std::unique_ptr<ui::UIScrollBar>()) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  SetFocusable(true);

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #28
0
// 初期化
HRESULT ui::UIListBoxItem::Initialize(graphics::D3DInteropHelper *pD3DInteropHelper) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  // ブラシセットの初期化
  m_textBrushSet->SetColorSet(m_textColorSet);
  // メインテキストの初期化
  CHK_WARN_HRESULT(__InitializeMainText(pD3DInteropHelper));
  // サブテキスト1の初期化
  CHK_WARN_HRESULT(__InitializeSubText(pD3DInteropHelper, m_subText1, m_subText1FontAttribute, m_subText1Format,
                                       m_subText1Layout, m_subText1Metrics, m_subText1LayoutRect));
  // サブテキスト2の初期化
  CHK_WARN_HRESULT(__InitializeSubText(pD3DInteropHelper, m_subText2, m_subText2FontAttribute, m_subText2Format,
                                       m_subText2Layout, m_subText2Metrics, m_subText2LayoutRect));
#ifdef DEBUG_UILISTBOXITEM
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_mainTextLayout->GetMaxWidth() = " << m_mainTextLayout->GetMaxWidth();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_mainTextLayout->GetMaxHeight() = " << m_mainTextLayout->GetMaxHeight();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText1Layout->GetMaxWidth() = " << m_subText1Layout->GetMaxWidth();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText1Layout->GetMaxHeight() = " << m_subText1Layout->GetMaxHeight();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText2Layout->GetMaxWidth() = " << m_subText2Layout->GetMaxWidth();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText2Layout->GetMaxHeight() = " << m_subText2Layout->GetMaxHeight();
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_mainTextMetrics = " << m_mainTextMetrics;
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText1Metrics = " << m_subText1Metrics;
  LOG(SEVERITY_LEVEL_DEBUG) << L"m_subText2Metrics = " << m_subText2Metrics;
#endif

  __CalculateLayoutRect();

  // ボディ
  m_bodyBrushSet->SetColorSet(m_bodyColorSet);
  m_bodyRect->SetX(0.0f);
  m_bodyRect->SetY(0.0f);
  m_bodyRect->SetWidth(GetWidth());
  m_bodyRect->SetHeight(GetHeight());
  auto frameDecorator = std::make_shared<graphics::decorator::FrameDecorator>();
  m_bodyRect->Initialize(pD3DInteropHelper);

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
  return S_OK;
}
void ui::UIScrollBar::SetBarPosition(FLOAT pos) {
#ifdef DEBUG_UISCROLLBAR
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  if (pos < m_minValue) {
    pos = m_minValue;
  }
  if (pos + m_pageSize > m_maxValue) {
    pos = m_maxValue - m_pageSize;
  }
  if (m_currentValue != pos) {
    m_currentValue = pos;
    m_barPositionChanged = true;
    Invalidate();
    FirePositionChangedEvent();
  }
#ifdef DEBUG_UISCROLLBAR
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
Beispiel #30
0
HRESULT graphics::brush::BrushSet::CreateDeviceDependentResource(
    ID2D1RenderTarget *pRenderTarget,
    const D2D1_RECT_F &rect,
    FLOAT opacity )
{
#ifdef DEBUG_BRUSHSET
    LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
    HRESULT hr = S_OK;
    for (size_t i = 0; i < m_brushes.size(); ++i) {
        CHK_FATAL_HRESULT(m_brushes[i]->CreateDeviceDependentResource(pRenderTarget, rect, opacity));
#ifdef DEBUG_BRUSHSET
        LOG(SEVERITY_LEVEL_DEBUG) << L"raw brush[" << i << L"] = " << std::hex << m_brushes[i]->GetBrush() << std::dec;
#endif
    }
    m_deviceDependentResourceCreated = SUCCEEDED(hr);
#ifdef DEBUG_BRUSHSET
    LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
    return hr;
}