本文整理汇总了C++中DocView::GetVisibleSpread方法的典型用法代码示例。如果您正苦于以下问题:C++ DocView::GetVisibleSpread方法的具体用法?C++ DocView::GetVisibleSpread怎么用?C++ DocView::GetVisibleSpread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocView
的用法示例。
在下文中一共展示了DocView::GetVisibleSpread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitSection
BOOL ScaleTab::InitSection()
{
TRACEUSER( "Neville", _T("ScaleTab::InitSection\n"));
ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::InitSection called with no dialog pointer");
// BOOL ReadOk = FALSE; // Flag to say whether the preference value was read ok
// Make sure the information field displaying the name of the current document
// is correct.
String_256 DocumentName(_R(IDT_OPTS_SCALING_INFO));
DocumentName += *GetDocumentName();
pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_INFO), DocumentName);
// Section = Scale settings
DocView* pSelectedView = DocView::GetSelected();
// This may now be a valid state so must not error
//ERROR3IF(pSelectedView == NULL,"ScaleTab::InitSection Where's the current view eh?");
if (pSelectedView != NULL)
{
Spread* pSpread = pSelectedView->GetFirstSelectedSpread();
// If no selected spread then use the visible spread
if (pSpread == NULL)
pSpread = pSelectedView->GetVisibleSpread();
// If no selected spread then use the first spread
// Of course, this should not be here but above routines seem to return
// null a bit too often for my liking
if (pSpread == NULL)
{
TRACEUSER( "Neville", _T("ScaleTab::InitSection BODGE! using 1st spread\n"));
Document* pSelectedDoc = Document::GetSelected();
if (pSelectedDoc !=NULL )
pSpread = pSelectedDoc->FindFirstSpread();
}
// Go and get a pointer to the scaling values
if (pSpread != NULL)
{
pDimScale = pSpread->GetPtrDimScale();
if (pDimScale != NULL)
{
// And now show the initial state of the controls given this
// scaling
ShowScaleDetails();
}
}
}
else
{
// If no current view then ensure section is greyed
GreySection();
}
return TRUE;
}
示例2: CommitSection
BOOL ScaleTab::CommitSection()
{
TRACEUSER( "Neville", _T("commit Scale section\n"));
ERROR3IF(pPrefsDlg == NULL, "ScaleTab::CommitSection called with no dialog pointer");
BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier
if (!ok)
return TRUE; // Talk to View failed to return now
// Ok has been pressed so take the values from this section of the dialog box
// Takes the values in the dialog and sets the DimScale object accordingly.
BOOL Valid=TRUE; // Flag for validity of value
// BOOL State=FALSE; // Flag for state of button/switch
BOOL SetOk=TRUE; // Preference value set ok
// Section = Scale settings
// Now check that we have the selected view still, just in case it has switched
// without us being told about it or even we have no current document/view.
// This may be a valid state now, so do not complain about it.
DocView* pCurrentView = DocView::GetSelected();
if (pCurrentView != NULL)
{
// Only if there is a current view do we read the values.
String_256 DrawingStr;
String_256 RealStr;
//TCHAR* pDrawingStr = DrawingStr;
//TCHAR* pRealStr = RealStr;
BOOL Active;
// Get the values from the dialog box
Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0, &Valid);
DrawingStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), &Valid);
RealStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_REALSCALE), &Valid);
Spread* pSpread = pCurrentView->GetFirstSelectedSpread();
// If no selected spread then use the visible spread
if (pSpread == NULL)
pSpread = pCurrentView->GetVisibleSpread();
// Only do the chnage if we have a valid spread pointer and we have changed something.
if ( (pSpread != NULL) &&
(
(OldActiveState != Active) ||
(OldDrawingStr != DrawingStr) ||
(OldRealStr != RealStr)
)
)
{
pDimScale = pSpread->GetPtrDimScale();
if (pDimScale != NULL)
{
// Only if active is set do we need to try and set new strings
// and hence a new drawing scale
if (Active)
{
// Dim Scales can only be 32 characters long
String_32 DrawingStr32 = _T("");
String_32 RealStr32 = _T("");
// Check if read in strings are longer than this
if (DrawingStr.Length() > DrawingStr32.MaxLength())
{
InformError(_R(IDE_OPTS_INVALIDDRAWSCALE));
return FALSE;
}
if (RealStr.Length() > RealStr32.MaxLength())
{
InformError(_R(IDE_OPTS_INVALIDREALSCALE));
return FALSE;
}
RealStr32 = RealStr;
DrawingStr32 = DrawingStr;
// Try and set these strings as new drawing and real scales strings
SetOk = pDimScale->SetDrawingScaleStr(DrawingStr32);
if (!SetOk)
{
InformError(_R(IDE_OPTS_INVALIDDRAWSCALE));
return FALSE;
}
SetOk = SetOk && pDimScale->SetRealScaleStr(RealStr32);
if (!SetOk)
{
InformError(_R(IDE_OPTS_INVALIDREALSCALE));
return FALSE;
}
// Now try to convert these into a new scaling factor
if (SetOk)
SetOk = SetOk && pDimScale->SetScaleFactor();
// If we failed in any of the conversions then warn the user and fail
if (!SetOk)
{
InformError(_R(IDE_OPTS_INVALIDSCALING));
return FALSE;
}
}
//.........这里部分代码省略.........