static void setVertical() { View *v; v = Desktop::getView("0ControlView"); if (v != 0) { v->moveTo(getDocPos(0)); } else { assert(false); } v = Desktop::getView("1ControlView"); if (v != 0) { v->moveTo(getDocPos(1)); } else { assert(false); } v = Desktop::getView("2ControlView"); if (v != 0) { v->moveTo(getDocPos(2)); } else { assert(false); } }
std::pair< PT_DocPosition, PT_DocPosition > IE_Imp_RDF::insertTextWithXMLID( const std::string& textconst, const std::string& xmlid ) { std::string text = " " + textconst + " "; PT_DocPosition startpos = getDocPos(); // FIXME /*bool bRes =*/ appendSpan( text ); PT_DocPosition endpos = getDocPos(); startpos++; endpos--; XAP_Frame* lff = XAP_App::getApp()->getLastFocussedFrame(); if(lff) { FV_View * pView = static_cast<FV_View*>( lff->getCurrentView() ); pView->selectRange( startpos, endpos ); pView->cmdInsertXMLID( xmlid ); } return std::make_pair( startpos, endpos ); }
BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask) { BOOL handled = FALSE; switch( key ) { case KEY_HOME: setDocPos( 0 ); handled = TRUE; break; case KEY_END: setDocPos( getDocPosMax() ); handled = TRUE; break; case KEY_DOWN: setDocPos( getDocPos() + mStepSize ); handled = TRUE; break; case KEY_UP: setDocPos( getDocPos() - mStepSize ); handled = TRUE; break; case KEY_PAGE_DOWN: pageDown(1); break; case KEY_PAGE_UP: pageUp(1); break; } return handled; }
/*! Insert a Block into the document Uses appropriate function for clipboard or file */ bool IE_Imp_Text::_insertBlock() { bool ret = false; m_bBlockDirectionPending = true; m_bFirstBlockData = true; if (isClipboard ()) // intentional - don't append style // information { ret = appendStrux(PTX_Block, NULL); } else { // text gets applied in the Normal style const gchar * propsArray[3]; propsArray[0] = "style"; propsArray[1] = "Normal"; propsArray[2] = 0; ret = appendStrux(PTX_Block, static_cast<const gchar **>(&propsArray[0])); } if(!isPasting()) { pf_Frag * pf = getDoc()->getPieceTable()->getFragments().getLast(); UT_return_val_if_fail( pf->getType() == pf_Frag::PFT_Strux, false); m_pBlock = (pf_Frag_Strux *) pf; UT_return_val_if_fail( m_pBlock->getStruxType() == PTX_Block, false); } else { PL_StruxDocHandle sdh = NULL; if(getDoc()->getStruxOfTypeFromPosition(getDocPos(), PTX_Block,&sdh)) { m_pBlock = static_cast<pf_Frag_Strux *>(const_cast<void *>(sdh)); } else { m_pBlock = NULL; } } return ret; }
void LLScrollbar::draw() { if (!getRect().isValid()) return; S32 local_mouse_x; S32 local_mouse_y; LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); } else { mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); } // Draw background and thumb. LLUIImage* rounded_rect_imagep = LLUI::sImageProvider->getUIImage("rounded_square.tga"); if (!rounded_rect_imagep) { gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0, mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(), mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(), mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE); gl_rect_2d(mThumbRect, mThumbColor, TRUE); } else { // Background rounded_rect_imagep->drawSolid(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0, mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(), mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(), mTrackColor); // Thumb LLRect outline_rect = mThumbRect; outline_rect.stretch(2); if (gFocusMgr.getKeyboardFocus() == this) { rounded_rect_imagep->draw(outline_rect, gFocusMgr.getFocusColor()); } rounded_rect_imagep->draw(mThumbRect, mThumbColor); if (mCurGlowStrength > 0.01f) { gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); rounded_rect_imagep->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); gGL.setSceneBlendType(LLRender::BT_ALPHA); } } BOOL was_scrolled_to_bottom = (getDocPos() == getDocPosMax()); if (mOnScrollEndCallback && was_scrolled_to_bottom) { mOnScrollEndCallback(mOnScrollEndData); } // Draw children LLView::draw(); } // end draw
/*! Insert a span of text into the document \param b Buffer containing UCS text to insert Uses appropriate function for clipboard or file */ bool IE_Imp_Text::_insertSpan(UT_GrowBuf &b) { UT_uint32 iLength = b.getLength(); const UT_UCS4Char * pData = (const UT_UCS4Char *)b.getPointer(0); // handle block direction if needed ... if(pData && m_bBlockDirectionPending) { const UT_UCS4Char * p = pData; // we look for the first strong character for(UT_uint32 i = 0; i < iLength; i++, p++) { UT_BidiCharType type = UT_bidiGetCharType(*p); if(UT_BIDI_IS_STRONG(type)) { m_bBlockDirectionPending = false; // set 'dom-dir' property of the block ... const gchar * propsArray[3]; propsArray[0] = "props"; propsArray[1] = NULL; propsArray[2] = NULL; UT_String props("dom-dir:"); if(UT_BIDI_IS_RTL(type)) props += "rtl;text-align:right"; else props += "ltr;text-align:left"; propsArray[1] = props.c_str(); // we need to modify the existing formatting ... if(m_pBlock == NULL) { PL_StruxDocHandle sdh = NULL; if(getDoc()->getStruxOfTypeFromPosition(getDocPos(), PTX_Block,&sdh)) { m_pBlock = static_cast<pf_Frag_Strux *>(const_cast<void *>(sdh)); } } appendStruxFmt(m_pBlock, static_cast<const gchar **>(&propsArray[0])); // if this is the first data in the block and the first // character is LRM or RLM followed by a strong character, // then we will remove it if(m_bFirstBlockData && i==0 && iLength > 1 && (*p == UCS_LRM || *p == UCS_RLM)) { UT_BidiCharType next_type = UT_bidiGetCharType(*(p+1)); if(UT_BIDI_IS_STRONG(next_type)) { pData++; iLength--; } } break; } } } bool bRes = appendSpan (pData, iLength); b.truncate(0); m_bFirstBlockData = false; return bRes; }