本文整理汇总了C++中GmoBox类的典型用法代码示例。如果您正苦于以下问题:C++ GmoBox类的具体用法?C++ GmoBox怎么用?C++ GmoBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GmoBox类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layout_caret
//---------------------------------------------------------------------------------------
void CaretPositioner::layout_caret(Caret* pCaret, DocCursor* pCursor,
GraphicModel* pGModel)
{
m_pCursor = pCursor;
if (m_pCursor->is_inside_terminal_node())
{
ImoObj* pTopLevel = m_pCursor->get_parent_object();
GmoBox* pBox = pGModel->get_box_for_imo(pCursor->get_parent_id());
if (!pBox)
{
LOMSE_LOG_ERROR("No box for cursor pointed object");
}
else
{
pCaret->set_top_level_box( pBox->get_bounds() );
InnerLevelCaretPositioner* p = new_positioner(pTopLevel, pGModel);
p->layout_caret(pCaret, m_pCursor);
}
}
else
{
TopLevelCaretPositioner p(pGModel);
p.layout_caret(pCaret, m_pCursor);
}
}
示例2: get_shape_for_imo
//---------------------------------------------------------------------------------------
void ScoreCaretPositioner::set_caret_y_pos_and_height(URect* pBounds, ImoId id,
int iStaff)
{
URect staffBounds;
if (id >= 0)
{
GmoShape* pShape = get_shape_for_imo(id, iStaff);
GmoBox* pBox = pShape->get_owner_box();
while (pBox && !pBox->is_box_system())
pBox = pBox->get_owner_box();
if (!pBox)
{
LOMSE_LOG_ERROR("[ScoreCaretPositioner::set_caret_y_pos_and_height] Invalid boxes structure");
throw runtime_error("[ScoreCaretPositioner::set_caret_y_pos_and_height] Invalid boxes structure");
}
m_pBoxSystem = static_cast<GmoBoxSystem*>(pBox);
int staff = m_spState->staff();
int instr = m_spState->instrument();
GmoShapeStaff* pStaff = m_pBoxSystem->get_staff_shape(instr, staff);
staffBounds = pStaff->get_bounds();
}
else
{
//score is empty
staffBounds = *pBounds;
}
//set position and size
pBounds->y = staffBounds.y - tenths_to_logical(10);
pBounds->height = staffBounds.height + tenths_to_logical(20);
}
示例3: LOMSE_LOG_DEBUG
//---------------------------------------------------------------------------------------
void Layouter::layout_item(ImoContentObj* pItem, GmoBox* pParentBox)
{
LOMSE_LOG_DEBUG(Logger::k_layout, str(boost::format(
"Laying out id %d %s") % pItem->get_id() % pItem->get_name() ));
m_pCurLayouter = create_layouter(pItem);
m_pCurLayouter->prepare_to_start_layout();
while (!m_pCurLayouter->is_item_layouted())
{
m_pCurLayouter->create_main_box(pParentBox, m_pageCursor,
m_availableWidth, m_availableHeight);
m_pCurLayouter->layout_in_box();
m_pCurLayouter->set_box_height();
if (!m_pCurLayouter->is_item_layouted())
{
pParentBox = start_new_page();
}
}
m_pCurLayouter->add_end_margins();
//update cursor and available space
GmoBox* pChildBox = m_pCurLayouter->get_item_main_box();
if (pChildBox) //AWARE: NullLayouter does not create a box
{
m_pageCursor.y = pChildBox->get_bottom();
m_availableHeight -= pChildBox->get_height();
}
if (!pItem->is_score())
delete m_pCurLayouter;
}
示例4: TEST_FIXTURE
TEST_FIXTURE(InteractorTestFixture, Interactor_SelectObjectAtScreenPoint)
{
//as coordinates conversion is involved, the View must be rendered
MyDoorway platform;
LibraryScope libraryScope(cout, &platform);
libraryScope.set_default_fonts_path(TESTLIB_FONTS_PATH);
SpDocument spDoc( new Document(libraryScope) );
spDoc->from_string("(lenmusdoc (vers 0.0) (content (score (vers 1.6) "
"(instrument (musicData (clef G)(key e)(n c4 q)(r q)(barline simple))))))" );
VerticalBookView* pView = Injector::inject_VerticalBookView(libraryScope, spDoc.get());
SpInteractor pIntor(Injector::inject_Interactor(libraryScope, WpDocument(spDoc), pView, NULL));
pView->set_interactor(pIntor.get());
RenderingBuffer rbuf;
pView->set_rendering_buffer(&rbuf);
pView->redraw_bitmap();
GraphicModel* pModel = pIntor->get_graphic_model();
GmoBoxDocPage* pPage = pModel->get_page(0); //DocPage
GmoBox* pBDPC = pPage->get_child_box(0); //DocPageContent
GmoBox* pBSP = pBDPC->get_child_box(0); //ScorePage
GmoBox* pBSys = pBSP->get_child_box(0); //System
GmoBox* pBSlice = pBSys->get_child_box(0); //Slice
GmoBox* pBSliceInstr = pBSlice->get_child_box(0); //SliceInsr
GmoShape* pClef = pBSliceInstr->get_shape(0); //Clef
LUnits x = (pClef->get_left() + pClef->get_right()) / 2.0f;
LUnits y = (pClef->get_top() + pClef->get_bottom()) / 2.0f;
double vx = x;
double vy = y;
pIntor->model_point_to_screen(&vx, &vy, 0);
pIntor->task_action_select_object_and_show_contextual_menu(Pixels(vx), Pixels(vy), 0);
CHECK( pIntor->is_in_selection(pClef) == true );
}
示例5: get_owner_box
//---------------------------------------------------------------------------------------
GmoBoxDocPage* GmoObj::get_page_box()
{
if (is_box_doc_page())
return static_cast<GmoBoxDocPage*>(this);
else
{
GmoBox* pParent = get_owner_box();
return pParent->get_page_box();
}
}
示例6: add_row
//---------------------------------------------------------------------------------------
LUnits TableSectionLayouter::add_row(GmoBox* pParentMainBox)
{
GmoBox* pRowBox = m_pRowLayouter->get_item_main_box();
pParentMainBox->add_child_box(pRowBox);
LUnits height = pRowBox->get_height();
m_pageCursor.y += height;
m_availableHeight -= height;
delete m_pRowLayouter;
m_pRowLayouter = nullptr;
return height;
}
示例7: TEST_FIXTURE
TEST_FIXTURE(DocLayouterTestFixture, DocLayouter_BoxSystemGetStaffShape)
{
Document doc(m_libraryScope);
doc.from_string("(lenmusdoc (vers 0.0) "
"(pageLayout (pageSize 24000 35700)(pageMargins 1000 1500 3000 2500 4000) landscape) "
"(content (score (vers 1.6) "
"(instrument (musicData (clef G)(key e)(n c4 q)(r q)(barline simple))))))" );
DocLayouter dl( doc.get_im_model(), m_libraryScope);
dl.layout_document();
GraphicModel* pGModel = dl.get_graphic_model();
GmoBoxDocPage* pPage = pGModel->get_page(0);
GmoBox* pBDPC = pPage->get_child_box(0); //DocPageContent
GmoBox* pBSP = pBDPC->get_child_box(0); //ScorePage
GmoBoxSystem* pBSys = dynamic_cast<GmoBoxSystem*>( pBSP->get_child_box(0) );
GmoShape* pShape = pBSys->get_staff_shape(0);
CHECK( pShape != NULL );
CHECK( pShape->is_shape_staff() == true );
GmoShapeStaff* pSS = dynamic_cast<GmoShapeStaff*>(pShape);
CHECK( pSS->get_num_staff() == 0 );
delete pGModel;
}
示例8: shift
//---------------------------------------------------------------------------------------
void TableCellSizer::reposition_cells()
{
//AWARE: row 0 is correctly positioned, so we start moving from row 1.
//In horizontal cells are correctly positioned, so shift is only in vertical.
int iH = m_iFirstRow * m_numColumns;
USize shift(0.0f, 0.0f);
for (int iRow=1; iRow < m_numRows; ++iRow)
{
shift.height += m_heights[iH];
int iCell = (m_iFirstRow + iRow) * m_numColumns;
for (int iCol=0; iCol < m_numColumns; ++iCol, ++iCell)
{
if (m_cellLayouters[iCell] != nullptr)
{
GmoBox* pCellBox = m_cellLayouters[iCell]->get_item_main_box();
pCellBox->shift_origin(shift);
}
}
iH += m_numColumns;
}
}
示例9: while
//---------------------------------------------------------------------------------------
void TableCellSizer::assing_height_to_cells()
{
for (int iRow=0; iRow < m_numRows; ++iRow)
{
int iCell = (m_iFirstRow + iRow) * m_numColumns;
for (int iCol=0; iCol < m_numColumns; ++iCol, ++iCell)
{
if (m_cellLayouters[iCell] != nullptr)
{
int iH = iCell;
LUnits height = m_heights[iH];
int rowspan = m_cellLayouters[iCell]->get_rowspan();
while (rowspan > 1)
{
iH += m_numColumns;
height += m_heights[iH];
--rowspan;
}
GmoBox* pCellBox = m_cellLayouters[iCell]->get_item_main_box();
pCellBox->set_height(height);
}
}
}
}
示例10: get_parent_box
//---------------------------------------------------------------------------------------
GraphicModel* GmoBox::get_graphic_model()
{
GmoBox* pParent = get_parent_box();
return (pParent == NULL ? NULL : pParent->get_graphic_model());
}
示例11: get_parent_box_page
//---------------------------------------------------------------------------------------
void GmoBox::add_shapes_to_tables()
{
GmoBoxDocPage* pPage = get_parent_box_page();
GmoBox* pBox = this; //gcc complains if next method is invoked directly
pBox->add_shapes_to_tables_in(pPage);
}