예제 #1
0
//---------------------------------------------------------------------------------------
void HyperlinkCtrl::on_draw(Drawer* pDrawer, RenderOptions& UNUSED(opt))
{
    select_font();
    Color color = (m_fEnabled ? m_currentColor : Color(192, 192, 192));
    pDrawer->set_text_color(color);
    URect pos = determine_text_position_and_size();
    pDrawer->draw_text(pos.x, pos.y, m_label);

    //text decoration
    if (m_style->text_decoration() == ImoStyle::k_decoration_underline)
    {
        float factor = (m_language == "zh_CN" ? 0.30f : 0.12f);
        LUnits y = pos.y + pos.height * factor;
        pDrawer->begin_path();
        pDrawer->fill(color);
        pDrawer->stroke(color);
        pDrawer->stroke_width( pos.height * 0.075f );
        pDrawer->move_to(pos.x, y);
        pDrawer->hline_to( pos.right() );
        pDrawer->end_path();
    }
}
예제 #2
0
//---------------------------------------------------------------------------------------
void ScoreCaretPositioner::caret_at_end_of_staff(Caret* pCaret)
{
    //cursor is at end of a staff or end of score. Score is not empty.
    //No current staffobj but a previous one must exist.
    //Place cursor 0.8 lines (8 tenths) at the right of last staffobj

    //get info for prev object
    SpElementCursorState spState = m_pScoreCursor->get_state();
    m_pScoreCursor->move_prev();
    ImoId id = m_pScoreCursor->id();
    int staff = m_pScoreCursor->staff();
    m_pScoreCursor->restore_state(spState);

    URect bounds = get_bounds_for_imo(id, staff);

    bounds.x += tenths_to_logical(8);
    set_caret_y_pos_and_height(&bounds, id, staff);

    pCaret->set_type(Caret::k_line);
    pCaret->set_position( UPoint(bounds.right(), bounds.top()) );
    pCaret->set_size( USize(bounds.get_width(), bounds.get_height()) );
    set_caret_timecode(pCaret);
}