#include <statline.h>
Inheritance diagram for StatusLine:
Public Member Functions | |
StatusLine () | |
Constructor for StatusLine. | |
~StatusLine () | |
destructor for StatusLine | |
MsgResult | Message (Msg *Msg) |
handle system messages | |
BOOL | UpdateText (String_256 *ptext, BOOL PrefixSelDesc=TRUE) |
BOOL | UpdateTextForColourPicker (String_256 *ptext, BOOL PrefixSelDesc=TRUE) |
BOOL | UpdateMousePosAndSnap (DocCoord *pDocCoord, Spread *pSpread, DocView *pDocView, BOOL Snapped) |
Update mouse position pane, and snapped indicator If pDocCoord==NULL && pSpread==NULL && Snapped==FALSE, the mouse pos will be blanked. | |
BOOL | UpdateSolidDragIndicator (BOOL bSolidAllowed, BOOL bSolid) |
Update mouse position pane, and snapped indicator If pDocCoord==NULL && pSpread==NULL && Snapped==FALSE, the mouse pos will be blanked. | |
BOOL | SetRenderIndicator (RenderState Action) |
Change state of the render indicator. | |
void | FlagMousePosNeedsUpdating () |
BOOL | MousePosNeedsUpdating () |
void | FlagMousePosPaneNeedsUpdating () |
BOOL | RestrictStatusLineFunctionsToColourPicker (CWindowID colourPicker) |
When the user is dragging a colour picker control, we need to restrict access to status line functionality to only the colour picker. | |
BOOL | RestoreStatusLineFunctions (CWindowID colourPicker) |
BOOL | IsRestrictedAccessToColourPicker () |
BOOL | LockOutControlHelp () |
BOOL | UnlockControlHelp () |
BOOL | AllowControlHelp () |
void | SetNeedsUpdate (BOOL Immediate=FALSE) |
Indicate the status line needs an update. | |
BOOL | ShowProgress (BOOL Show=TRUE, StringBase *JobDescrip=NULL) |
Creates a window and associates it with this CProgressBar object. The window appears immediately over the status bar. Notes: This currently assumes that it'll only ever be opened at the bottom of the Main Frame window. | |
INT32 | GetPercent () const |
BOOL | SetPercent (INT32 Percent, BOOL RedrawBackground=FALSE, StringBase *JobDescrip=NULL) |
Sets the currently displayed percentage of the progress bar. The bar will be immediately redrawn to reflect the new value. Values outside the range 0..99 (inclusive) are clipped to 0 or 99. No redraw will be done if NewPercent equals the currently displayed value. | |
BOOL | IsProgressShown () const |
Static Public Member Functions | |
static void | SetPrefix (const StringBase &str) |
Overrides the default behaviour of showing the selection state as the prefix on the status line. SetDefaultPrefix restores the default behaviour of (usually) showing the selection state as the prefix. | |
static void | SetDefaultPrefix () |
Undoes a call to SetPrefix, restoring the default behaviour of showing the selection state as a prefix on the status line. | |
static INT32 | GetPrefixWidth () |
static StatusLine * | Get () |
Protected Member Functions | |
BOOL | OnIdleEvent () |
Idle event handler for status line Updates the text on the status bar if 'TextDelay' has elapsed since it was last changed. Also updates the mouse position pane. | |
BOOL | SetMousePosPaneWidth (Spread *pSpread) |
Set the mouse position pane width to be large enough to hold any coord in the spread in the current preference units Also gets, and caches, the number of decimal places required to resolve 1 pixel. | |
BOOL | RefreshHelpText () |
refresh the help text pane of the status line | |
BOOL | GetMousePosText (String_256 *pText, DocCoord MousePos, Spread *pSread, INT32 dp=-1) |
get mouse position as a string | |
BOOL | TruncateTextToWidth (String_256 *pText, INT32 width) |
if too long for the given width, truncate the given text at one of the specified delimiters | |
BOOL | SetStatusText (const String_256 &text) |
Sets the status line text. Records it. Puts it in the gadget and invalidates it if the gadget is shown. | |
void | OnTimer () |
CC_DECLARE_DYNCREATE (StatusLine) | |
Protected Attributes | |
Cursor * | pSnappedCursor |
INT32 | SnappedCursorID |
MonotonicTime | TextTimer |
MonotonicTime | RenderTimer |
BOOL | MousePosPaneNeedsResizing |
BOOL | MousePosNeedsUpdatingFlag |
INT32 | RenderAnimationState |
INT32 | MousePosDP |
INT32 | OldMemory |
INT32 | CurrentPercent |
String_256 * | JobDescription |
BOOL | ProgressShown |
String_256 | StatusText |
String_256 | m_MousePosText |
StatusTimer | m_Timer |
Static Private Attributes | |
static String_256 | m_strPrefix |
static BOOL | restrictStatusLineFunctionsToColourPicker = FALSE |
static BOOL | DoControlHelp = TRUE |
static StatusLine * | s_pStatusLine = NULL |
Classes | |
class | StatusTimer |
Definition at line 137 of file statline.h.
|
Constructor for StatusLine.
Definition at line 208 of file statline.cpp. 00208 : m_Timer(this) 00209 { 00210 // ensure initial updates 00211 OldMemory=0; 00212 MousePosDP=2; 00213 TextTimer.Sample(); 00214 RenderTimer.Sample(); 00215 RenderAnimationState=0; 00216 MousePosNeedsUpdatingFlag=TRUE; 00217 MousePosPaneNeedsResizing=TRUE; 00218 // TransparencyNeedsUpdating=TRUE; 00219 00220 // create a 'snapped' mouse pointer 00221 pSnappedCursor = new Cursor(_R(IDCSR_SNAPPED)); 00222 SnappedCursorID = 0; 00223 00224 JobDescription=NULL; 00225 CurrentPercent=-1; 00226 ProgressShown=FALSE; 00227 00228 GetApplication()->RegisterIdleProcessor(IDLEPRIORITY_LOW, this); 00229 }
|
|
destructor for StatusLine
Definition at line 240 of file statline.cpp. 00241 { 00242 if (pSnappedCursor != NULL) 00243 { 00244 delete pSnappedCursor; 00245 pSnappedCursor = NULL; 00246 } 00247 00248 if (JobDescription != NULL) 00249 { 00250 delete JobDescription; 00251 JobDescription = NULL; 00252 } 00253 00254 if (this == s_pStatusLine) 00255 { 00256 // Only zap it out if there is a live status line. Status line objects 00257 // are temporarily created when invoking bar closure 00258 s_pStatusLine = NULL; 00259 } 00260 00261 GetApplication()->RemoveIdleProcessor(IDLEPRIORITY_LOW, this); 00262 }
|
|
Definition at line 168 of file statline.h. 00168 { return (DoControlHelp); }
|
|
|
|
Definition at line 149 of file statline.h. 00149 { MousePosNeedsUpdatingFlag=TRUE; };
|
|
Definition at line 152 of file statline.h. 00152 {MousePosPaneNeedsResizing=TRUE;};
|
|
Definition at line 205 of file statline.h. 00205 {return s_pStatusLine;}
|
|
get mouse position as a string
Definition at line 918 of file statline.cpp. 00919 { 00920 ERROR2IF( pText==NULL,FALSE,"StatusLine::GetMousePosText() - pText==NULL"); 00921 ERROR2IF( pSpread==NULL,FALSE,"StatusLine::GetMousePosText() - pSpread==NULL"); 00922 00923 if (dp == -1) 00924 dp = MousePosDP; 00925 00926 String_256 yPos(""); 00927 if (pSpread->SpreadCoordToText(pText,&yPos,MousePos,FALSE,TRUE,dp)==FALSE) 00928 return FALSE; 00929 00930 *pText+=String_64(_R(IDS_K_STATLINE_POSITIONSEP)); 00931 *pText+=yPos; 00932 return TRUE; 00933 }
|
|
Definition at line 211 of file statline.h. 00211 {return CurrentPercent;}
|
|
Definition at line 646 of file statline.cpp. 00647 { 00648 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 00649 #ifndef EXCLUDE_FROM_XARALX 00650 CCStatusBar* pb = GetApplication()->GetpCCStatusBar(); 00651 return pb && !m_strPrefix.IsEmpty() ? 4 + pb->GetTextWidth(&m_strPrefix, TRUE) : 0; 00652 #else 00653 return 0; 00654 #endif 00655 }
|
|
Definition at line 214 of file statline.h. 00214 {return ProgressShown;}
|
|
Definition at line 164 of file statline.h. 00164 { return restrictStatusLineFunctionsToColourPicker; }
|
|
Definition at line 166 of file statline.h. 00166 { DoControlHelp = FALSE; return (TRUE); }
|
|
handle system messages
Reimplemented from StandardBar. Definition at line 1044 of file statline.cpp. 01045 { 01046 // FixFPControlRegister(); 01047 ERROR2IF( pMsg==NULL,FAIL,"StatusLine::Message() - pMsg==NULL"); 01048 01049 if (IS_OUR_DIALOG_MSG(pMsg)) 01050 { 01051 DialogMsg* Msg = (DialogMsg*)pMsg; 01052 01053 switch(Msg->DlgMsg) 01054 { 01055 case DIM_CREATE: 01056 { 01057 if (s_pStatusLine) 01058 { 01059 ERROR3("Two status lines - that isn't meant to happen"); 01060 delete s_pStatusLine; 01061 } 01062 s_pStatusLine = this; 01063 SetGadgetBitmap(_R(IDB_SL_SNAP), _R(IDB_SL_SNAPN)); // turn snap off by default 01064 nobreak; // FALL THROUGH! 01065 } 01066 case DIM_DLG_RESIZED: 01067 { 01068 if (!ProgressShown) 01069 { 01070 // For some reason we need to do a relayout with the gadgets shown 01071 HideGadget(_R(IDC_SL_PROGRESSGAUGE), FALSE); 01072 HideGadget(_R(IDC_SL_PROGRESSPERCENT), FALSE); 01073 Layout(); 01074 HideGadget(_R(IDC_SL_PROGRESSGAUGE), !ProgressShown); 01075 HideGadget(_R(IDC_SL_PROGRESSPERCENT), !ProgressShown); 01076 } 01077 break; 01078 } 01079 default: 01080 break; 01081 01082 } 01083 // Else fall through 01084 } 01085 01086 01087 01088 // if pref units changed, or zoom changed flag mouse pos pane needs resizing 01089 if (MESSAGE_IS_A(pMsg,OptionsChangingMsg) /* && ((OptionsChangingMsg*)pMsg)->State==OptionsChangingMsg::NEWUNITS */ 01090 || MESSAGE_IS_A(pMsg,DocChangingMsg) && ((DocChangingMsg*)pMsg)->State==DocChangingMsg::SELCHANGED 01091 || MESSAGE_IS_A(pMsg,DocViewMsg) && ((DocViewMsg*)pMsg)->State==DocViewMsg::SCALECHANGED) 01092 MousePosPaneNeedsResizing=TRUE; 01093 01094 // if doc changing flag transparency needs updating & mouse pos pane needs resizing 01095 if (MESSAGE_IS_A(pMsg,DocChangingMsg) && ((DocChangingMsg*)pMsg)->State==DocChangingMsg::SELCHANGED) 01096 { 01097 //TransparencyNeedsUpdating=TRUE; 01098 MousePosPaneNeedsResizing=TRUE; 01099 } 01100 01101 if (MESSAGE_IS_A(pMsg, DocViewMsg) && ((DocViewMsg*)pMsg)->State==DocViewMsg::SELCHANGED) 01102 { 01103 CCamFrame* pMainFrame = GetMainFrame(); 01104 if (pMainFrame) 01105 { 01106 DocView* pView = ((DocViewMsg*)pMsg)->pNewDocView; 01107 BOOL bState = TRUE; 01108 String_256 sPlateName; 01109 if (pView) 01110 { 01111 ColourPlateType PlateType = COLOURPLATE_NONE; 01112 ColourContext *cc = pView->GetColourContext(COLOURMODEL_RGBT); 01113 if (cc && cc->GetColourPlate()) 01114 { 01115 PlateType = cc->GetColourPlate()->GetType(); 01116 } 01117 01118 switch (PlateType) 01119 { 01120 case COLOURPLATE_CYAN: 01121 sPlateName.Load(_R(IDS_PLATENAME_CYAN)); 01122 break; 01123 01124 case COLOURPLATE_MAGENTA: 01125 sPlateName.Load(_R(IDS_PLATENAME_MAGENTA)); 01126 break; 01127 01128 case COLOURPLATE_YELLOW: 01129 sPlateName.Load(_R(IDS_PLATENAME_YELLOW)); 01130 break; 01131 01132 case COLOURPLATE_KEY: 01133 sPlateName.Load(_R(IDS_PLATENAME_KEY)); 01134 break; 01135 01136 case COLOURPLATE_COMPOSITE: 01137 sPlateName.Load(_R(IDS_PLATENAME_COMPOSITE)); 01138 break; 01139 01140 case COLOURPLATE_SPOT: 01141 { 01142 IndexedColour* pSpotColour = cc->GetColourPlate()->GetSpotColour(); 01143 if (pSpotColour) 01144 sPlateName = *(pSpotColour->GetName()); 01145 } 01146 break; 01147 01148 default: 01149 bState = FALSE; 01150 break; 01151 } 01152 } 01153 else 01154 { 01155 bState = FALSE; 01156 } 01157 PORTNOTE("printing", "Removed SetPrinterColourStatus"); 01158 #ifndef EXCLUDE_FROM_XARALX 01159 pMainFrame->SetPrinterColourStatus(bState, &sPlateName); 01160 #endif 01161 } 01162 01163 } 01164 01165 return StandardBar::Message(pMsg); 01166 }
|
|
Definition at line 150 of file statline.h. 00150 { return MousePosNeedsUpdatingFlag; };
|
|
Idle event handler for status line Updates the text on the status bar if 'TextDelay' has elapsed since it was last changed. Also updates the mouse position pane.
Reimplemented from Operation. Definition at line 281 of file statline.cpp. 00282 { 00283 if (PrintMonitor::IsPrintingNow()) 00284 return FALSE; 00285 00286 // Don't do any status line updates if the timer is running 00287 if (!m_Timer.IsRunning()) 00288 { 00289 00290 // If the current doc doesn't have a doc view (e.g. it's a clipboard doc), then there's no point 00291 // carrying on, because it's not a proper document, hence doen't require up-to-date status bar info. 00292 if (DocView::GetSelected() == NULL) 00293 return FALSE; 00294 00295 00296 #ifndef STANDALONE 00297 // if mouse position pane needs resizing, do it (ensuring it's enabled) 00298 if (MousePosPaneNeedsResizing) 00299 { 00300 MousePosPaneNeedsResizing=FALSE; 00301 Spread* pSpread=Document::GetSelectedSpread(); 00302 if (pSpread) 00303 { 00304 SetMousePosPaneWidth(pSpread); 00305 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 00306 #ifndef EXCLUDE_FROM_XARALX 00307 if (pCCStatusBar->PaneState(_R(IDS_SL_MOUSEPOS),Enable)==Fail) 00308 ReturnValue=FALSE; 00309 #endif 00310 } 00311 } 00312 #endif 00313 00314 RefreshHelpText(); 00315 00316 #ifdef _STATUSLINE_MEMORYPANE 00317 // establish if amount of memory changed BODGE 00318 MEMORYSTATUS MemState; 00319 MemState.dwLength=sizeof(MEMORYSTATUS); 00320 GlobalMemoryStatus(&MemState); 00321 INT32 Memory=MemState.dwAvailPhys; 00322 BOOL MemoryChanged=(OldMemory!=Memory); 00323 OldMemory=Memory; 00324 00325 if (MemoryChanged) 00326 { 00327 // If this ever appears in retail builds it will have to be rewritten properly (it 00328 // isn't internationally portable at the moment). 00329 String_256 StrBuf(TEXT("")); 00330 camSnprintf(StrBuf, 256, TEXT("%dK"), Memory / 1024); 00331 if (StrBuf.Length()>4) 00332 StrBuf.Insert(&String_8(TEXT(",")),StrBuf.Length()-4); 00333 BOOL ok = SetStringGadgetValue(_R(IDS_SL_MEMORY),StrBuf); 00334 if (ok) 00335 PaintGadgetNow(_R(IDS_SL_MEMORY)) 00336 else 00337 ReturnValue=FALSE; 00338 } 00339 #endif // _STATUSLINE_MEMORYPANE 00340 00341 // The timer had expired, so we need to indicate we need another update 00342 SetNeedsUpdate(); 00343 } 00344 00345 // Always say we don't need more idle events 00346 return FALSE; 00347 }
|
|
Definition at line 224 of file statline.h. 00225 { 00226 GetApplication()->NeedMoreIdles(); 00227 }
|
|
refresh the help text pane of the status line
Definition at line 385 of file statline.cpp. 00386 { 00387 // if drag op in progress, don't slow it down, just exit 00388 if (Operation::GetCurrentDragOp()) 00389 return TRUE; 00390 00391 BOOL ReturnValue=TRUE; 00392 BOOL PrefixSelDesc=STATUSLINE_SELDESC_DEFAULT; 00393 String_256 text(_T("")); 00394 BOOL TextValid=FALSE; 00395 00396 // for new custom colour picker tool .... 00397 // (do NOT update status text if this tool is active!) 00398 00399 if (IsRestrictedAccessToColourPicker () == TRUE) 00400 { 00401 return (TRUE); 00402 } 00403 00404 if (!TextValid) 00405 { 00406 TextValid=BaseBar::GetStatusLineText(&text); // try bar drag 00407 if (TextValid) 00408 PrefixSelDesc=STATUSLINE_SELDESC_BARDRAG; 00409 } 00410 00411 WinCoord WndPos(0,0); 00412 CWindowID WinID=DialogManager::GetWindowUnderPointer(&WndPos); 00413 DocView* pDocView=NULL; 00414 Spread* pSpread=NULL; 00415 DocCoord DocPos(0,0); 00416 00417 // if no valid text so far (and valid current doc else something deep down goes BANG) 00418 // get mouse pos (in DocCoords), handle of window it is over, DocView ptr, spread ptr 00419 if (!TextValid && Document::GetCurrent()!=NULL) 00420 { 00421 00422 if (WinID != NULL) 00423 pDocView=CCamView::GetDocViewFromWindowID(WinID); 00424 00425 if (pDocView != NULL) 00426 { 00427 OilCoord OilPos = WndPos.ToOil(pDocView, TRUE); 00428 pSpread = pDocView->OilToSpreadCoord(OilPos, &DocPos); 00429 } 00430 } 00431 00432 // if no text so far, try drag ops 00433 if (!TextValid) 00434 { 00435 Operation* pDragOp=Operation::GetCurrentDragOp(); 00436 if (pDragOp) 00437 { 00438 TextValid=pDragOp->GetStatusLineText(&text,pSpread,DocPos,ClickModifiers::GetClickModifiers()); 00439 ERROR3IF(!TextValid,"StatusLine::RefreshHelpText() - pDragOp->GetStatusLineText() failed"); 00440 PrefixSelDesc=STATUSLINE_SELDESC_DRAGOPS; 00441 // drag op in progress so we must have valid text (stops tool being interogated) 00442 if (!TextValid) 00443 { 00444 text=_T(""); 00445 TextValid=TRUE; 00446 } 00447 } 00448 } 00449 00450 // if no text so far, try other bits! 00451 if (!TextValid) 00452 { 00453 BOOL OverSelectedDoc=FALSE; 00454 if (pDocView) 00455 { 00456 if (pDocView==DocView::GetSelected()) 00457 { 00458 OverSelectedDoc=TRUE; 00459 Tool* pTool=Tool::GetCurrent(); 00460 ERROR3IF(pTool==NULL,"StatusLine::RefreshHelpText() - no selected tool"); 00461 if (pTool) 00462 { 00463 TextValid=pTool->GetStatusLineText(&text,pSpread,DocPos,ClickModifiers::GetClickModifiers()); 00464 if (TextValid) 00465 PrefixSelDesc=STATUSLINE_SELDESC_SELDOC; 00466 } 00467 else 00468 ReturnValue=FALSE; 00469 } 00470 else 00471 { 00472 TextValid=text.Load(_R(IDS_CLICKHERETOSELECTDOC)); // over unselected doc 00473 if (!TextValid) 00474 ReturnValue=FALSE; 00475 else 00476 PrefixSelDesc=STATUSLINE_SELDESC_OTHERDOC; 00477 } 00478 } 00479 00480 PORTNOTE("statline", "Removed use of ControlHelper") 00481 #if !defined(EXCLUDE_FROM_XARALX) 00482 if (!TextValid) 00483 { 00484 TextValid=ControlHelper::GetStatusLineText(&text,WinID); // try buttons/bars 00485 if (TextValid) 00486 PrefixSelDesc=STATUSLINE_SELDESC_BUTTONS; 00487 } 00488 #endif 00489 00490 if (!TextValid) 00491 { 00492 TextValid=DialogManager::GetStatusLineText(&text,NULL); 00493 if (TextValid) 00494 PrefixSelDesc=STATUSLINE_SELDESC_BUTTONS; 00495 } 00496 00497 #ifndef STANDALONE 00498 if (!TextValid) 00499 { 00500 TextValid=CColourBar::GetStatusLineText(&text); // try ColourBar 00501 if (TextValid) 00502 PrefixSelDesc=STATUSLINE_SELDESC_COLBAR; 00503 } 00504 00505 if (!TextValid) 00506 { 00507 TextValid=ColourPicker::GetStatusLineText(&text); // try Colour Editor 00508 if (TextValid) 00509 PrefixSelDesc=STATUSLINE_SELDESC_COLBAR; 00510 } 00511 00512 #endif //STANDALONE 00513 00514 PORTNOTE("StatusLine", "Removed use of PreviewDlg") 00515 #ifndef EXCLUDE_FROM_XARALX 00516 if (!TextValid) 00517 { 00518 TextValid=PreviewDialog::GetStatusLineText(&text); // try Preview Dialog 00519 if (TextValid) 00520 PrefixSelDesc=STATUSLINE_SELDESC_PREVIEWDLG; 00521 } 00522 #endif 00523 00524 // WEBSTER - markn 15/1/97 00525 // No rulers in webster 00526 PORTNOTE("StatusLine", "Removed use of Rulers") 00527 #ifndef EXCLUDE_FROM_XARALX 00528 #ifndef WEBSTER 00529 if (!TextValid) 00530 { 00531 DocView* pDocView = DocView::GetSelected(); 00532 RulerPair* pRulerPair = NULL; 00533 if (pDocView!=NULL) 00534 pRulerPair = pDocView->GetpRulerPair(); 00535 if (pRulerPair!=NULL) 00536 TextValid = pRulerPair->GetStatusLineText(&text,WndPos,WinID); // try Rulers 00537 if (TextValid) 00538 PrefixSelDesc=STATUSLINE_SELDESC_STATBAR; 00539 } 00540 #endif // WEBSTER 00541 #endif 00542 00543 PORTNOTE("StatusLine", "Removed use of Galleries") 00544 #ifndef EXCLUDE_FROM_XARALX 00545 #ifndef EXCLUDE_GALS 00546 if (!TextValid && WinID!=NULL) 00547 { 00548 // Lets try the Galleries .... 00549 // ** This uses Naughty Oily stuff. (Bodge for the Viewer). 00550 CWindowID ParentWnd = ::GetParent(WinID); 00551 if (ParentWnd != NULL) 00552 { 00553 DialogBarOp* pBar = DialogBarOp::FindDialogBarOp((UINT32)ParentWnd); 00554 if (pBar != NULL && pBar->IS_KIND_OF(SuperGallery)) 00555 { 00556 CRect TargetRect; 00557 ::GetWindowRect(WinID, &TargetRect); 00558 00559 // Get the screen DPI 00560 INT32 DPI = 96; 00561 HDC ScreenDC = CreateCompatibleDC(NULL); 00562 if (ScreenDC == NULL) 00563 ERROR2(FALSE, "Unable to create screen DC"); 00564 DPI = GetDeviceCaps(ScreenDC, LOGPIXELSY); 00565 DeleteDC(ScreenDC); 00566 00567 INT32 WindowHeight = TargetRect.Height(); 00568 00569 DocCoord KernelMousePos; 00570 KernelMousePos.x = ((WndPos.x) * 72000) / DPI; 00571 KernelMousePos.y = ((WindowHeight - WndPos.y) * 72000) / DPI; 00572 00573 TextValid = ((SuperGallery*)pBar)->GetStatusLineHelp(&KernelMousePos, &text); 00574 if (TextValid) 00575 PrefixSelDesc=STATUSLINE_SELDESC_STATBAR; 00576 } 00577 } 00578 } 00579 #endif 00580 #endif 00581 00582 #ifndef STANDALONE 00583 // blank mouse pos if not over selected doc 00584 if (!OverSelectedDoc) 00585 if (UpdateMousePosAndSnap(NULL,NULL,pDocView,FALSE)==FALSE) 00586 ReturnValue=FALSE; 00587 #endif 00588 } 00589 00590 // actually update the text 00591 if (!TextValid) 00592 text=_T(""); 00593 if (!UpdateText(&text,PrefixSelDesc)) 00594 ReturnValue=FALSE; 00595 00596 return ReturnValue; 00597 }
|
|
Definition at line 708 of file statline.cpp. 00709 { 00710 // firstly, lets check for obvious insanity 00711 00712 PORTNOTE("StatusLine", "Removed use of ColourPicker") 00713 #ifndef EXCLUDE_FROM_XARALX 00714 String_256 ClassNameStr; // The control type 00715 00716 // Find out the class type of the gadget 00717 GetClassName (colourPicker, (TCHAR*) ClassNameStr, 255); 00718 00719 if (ClassNameStr == String_8(TEXT("cc_colPicker"))) 00720 { 00721 //if (restrictStatusLineFunctionsToColourPicker == TRUE) 00722 //{ 00723 restrictStatusLineFunctionsToColourPicker = FALSE; 00724 return (TRUE); 00725 //} 00726 } 00727 00728 ENSURE(FALSE, "RestoreStatusLineFunctions called for invalid colour picker control"); 00729 #endif 00730 return (FALSE); 00731 }
|
|
When the user is dragging a colour picker control, we need to restrict access to status line functionality to only the colour picker.
Definition at line 670 of file statline.cpp. 00671 { 00672 // firstly, lets check for obvious insanity 00673 00674 PORTNOTE("StatusLine", "Removed use of ColourPicker") 00675 #ifndef EXCLUDE_FROM_XARALX 00676 String_256 ClassNameStr; // The control type 00677 00678 // Find out the class type of the gadget 00679 GetClassName (colourPicker, (TCHAR*) ClassNameStr, 255); 00680 00681 if (ClassNameStr == String_8(TEXT("cc_colPicker"))) 00682 { 00683 //if (restrictStatusLineFunctionsToColourPicker == FALSE) 00684 //{ 00685 restrictStatusLineFunctionsToColourPicker = TRUE; 00686 return (TRUE); 00687 //} 00688 } 00689 00690 ENSURE(FALSE, "RestrictStatusLineFunctionsToColourPicker called for invalid colour picker control"); 00691 #endif 00692 return (FALSE); 00693 }
|
|
Undoes a call to SetPrefix, restoring the default behaviour of showing the selection state as a prefix on the status line.
Definition at line 630 of file statline.cpp. 00631 { 00632 m_strPrefix.Empty(); 00633 }
|
|
Set the mouse position pane width to be large enough to hold any coord in the spread in the current preference units Also gets, and caches, the number of decimal places required to resolve 1 pixel.
Definition at line 954 of file statline.cpp. 00955 { 00956 ERROR2IF( pSpread==NULL,FALSE,"StatusLine::SetMousePosPaneWidth() - pSpread==NULL"); 00957 00958 // find/cache number of decimal places required to resolve a pixel with current units & scale 00959 INT32 dp=2; 00960 INT32 ReturnValue=TRUE; 00961 if (pSpread->GetDecimalPlacesForPixelResolution(DocView::GetSelected(), &dp)) 00962 MousePosDP=dp; 00963 else 00964 ReturnValue=FALSE; 00965 00966 // get dimensions of spread PasteRect converted (in DocCoords) 00967 DocRect PasteRect=pSpread->GetPasteboardRect(); 00968 DocCoord PasteSize(PasteRect.Width(),PasteRect.Height()); 00969 00970 // get min coord as text, then find it's width 00971 String_256 MousePosText(""); 00972 if (GetMousePosText(&MousePosText,DocCoord(0,0),pSpread,0)==FALSE) 00973 return FALSE; 00974 00975 String_256 DPSChar(_R(IDS_CONVERT_DP_CHAR)); 00976 00977 String_256 ZeroChar(_R(IDS_CONVERT_ZERO_CHAR)); 00978 00979 INT32 i; 00980 for (i=0;i<dp;i++) 00981 { 00982 MousePosText += ZeroChar; 00983 MousePosText += ZeroChar; 00984 00985 } 00986 00987 MousePosText += DPSChar; 00988 MousePosText += DPSChar; 00989 00990 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 00991 #ifndef EXCLUDE_FROM_XARALX 00992 INT32 MinCoordTextWidth=pCCStatusBar->GetTextWidth(&MousePosText); 00993 #else 00994 INT32 MinCoordTextWidth=100; 00995 #endif 00996 00997 if (MinCoordTextWidth==-1) 00998 return FALSE; 00999 01000 // get max coord as text, then find it's width 01001 if (GetMousePosText(&MousePosText,PasteSize,pSpread,0)==FALSE) 01002 return FALSE; 01003 01004 for (i=0;i<dp;i++) 01005 { 01006 MousePosText += ZeroChar; 01007 MousePosText += ZeroChar; 01008 } 01009 01010 MousePosText += DPSChar; 01011 MousePosText += DPSChar; 01012 01013 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 01014 #ifndef EXCLUDE_FROM_XARALX 01015 INT32 MaxCoordTextWidth=pCCStatusBar->GetTextWidth(&MousePosText) ; 01016 #else 01017 INT32 MaxCoordTextWidth=100; 01018 #endif 01019 01020 if (MaxCoordTextWidth==-1) 01021 return FALSE; 01022 01023 // set pane width 01024 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 01025 #ifndef EXCLUDE_FROM_XARALX 01026 INT32 TextWidth = max(MaxCoordTextWidth,MinCoordTextWidth); 01027 if (pCCStatusBar->SetPaneWidth(TextWidth,_R(IDS_SL_MOUSEPOS))==FALSE) 01028 return FALSE; 01029 #endif 01030 return ReturnValue; 01031 }
|
|
Indicate the status line needs an update.
Definition at line 360 of file statline.cpp. 00361 { 00362 if (Immediate) 00363 { 00364 // Simulate a timer event 00365 m_Timer.Stop(); 00366 OnTimer(); 00367 return; 00368 } 00369 00370 m_Timer.Start(1000, TRUE); 00371 }
|
|
Sets the currently displayed percentage of the progress bar. The bar will be immediately redrawn to reflect the new value. Values outside the range 0..99 (inclusive) are clipped to 0 or 99. No redraw will be done if NewPercent equals the currently displayed value.
JobDescrip - NULL, or a pointer to a new job description - pass NULL if this hasn't changed, as it makes a copy of the new string every time it is changed. If this is non-NULL, then the ClearBackground flag will be forced to TRUE to draw the new text.
Definition at line 1451 of file statline.cpp. 01456 { 01457 if (NewPercent < 0) NewPercent = 0; 01458 if (NewPercent > 99) NewPercent = 99; 01459 01460 // If there's no change, don't bother updating 01461 if (JobDescrip == NULL && NewPercent == CurrentPercent) 01462 return(TRUE); 01463 01464 CurrentPercent = NewPercent; 01465 01466 String_64 PercentString; 01467 PercentString.MakePercent(CurrentPercent); 01468 SetStringGadgetValue(_R(IDC_SL_PROGRESSPERCENT), PercentString); 01469 SetLongGadgetValue(_R(IDC_SL_PROGRESSGAUGE), CurrentPercent); 01470 01471 // If there is a new Job Description, change to use it 01472 if (JobDescrip != NULL) 01473 { 01474 delete JobDescription; 01475 JobDescription = new String_256(*JobDescrip); 01476 01477 if (JobDescription) 01478 { 01479 SetStringGadgetValue(_R(IDC_SL_STATUSTEXT), ProgressShown?*JobDescription:StatusText); 01480 } 01481 else 01482 { 01483 SetStringGadgetValue(_R(IDC_SL_STATUSTEXT), ProgressShown?String_256(_T("")):StatusText); 01484 } 01485 01486 InvalidateGadget(0, TRUE); // Repaint the whole bar 01487 PaintGadgetNow(0); 01488 } 01489 else 01490 { 01491 // Just repaint the gauge 01492 InvalidateGadget(_R(IDC_SL_PROGRESSGAUGE), ClearBackground); 01493 InvalidateGadget(_R(IDC_SL_PROGRESSPERCENT), ClearBackground); 01494 PaintGadgetNow(_R(IDC_SL_PROGRESSGAUGE)); 01495 PaintGadgetNow(_R(IDC_SL_PROGRESSPERCENT)); 01496 } 01497 01498 return(TRUE); 01499 }
|
|
Overrides the default behaviour of showing the selection state as the prefix on the status line. SetDefaultPrefix restores the default behaviour of (usually) showing the selection state as the prefix.
Definition at line 614 of file statline.cpp. 00615 { 00616 m_strPrefix = str; 00617 }
|
|
Change state of the render indicator.
Definition at line 1335 of file statline.cpp. 01336 { 01337 INT32 RenderAnimationStates=sizeof(RenderAnimation)/sizeof(UINT32); 01338 UINT32 BitmapID=0; 01339 switch (Action) 01340 { 01341 case NotRendering: 01342 BitmapID=_R(IDB_SL_RENDN); 01343 RenderAnimationState=0; 01344 break; 01345 case Paused: 01346 BitmapID=_R(IDB_SL_RENDP); 01347 break; 01348 case Rendering: 01349 BitmapID=_R(IDB_SL_RENDR); 01350 RenderAnimationState=0; 01351 break; 01352 case Animate: 01353 if (RenderTimer.Elapsed(RenderDelay)) 01354 { 01355 if (RenderAnimationState<0 || RenderAnimationState>=RenderAnimationStates) 01356 RenderAnimationState=0; 01357 BitmapID=RenderAnimation[RenderAnimationState++]; 01358 } 01359 break; 01360 default: ERROR2(FALSE,"StatusLine::SetRenderIndicator() - Action invalid"); 01361 } 01362 01363 if (!BitmapID) 01364 return TRUE; 01365 01366 RenderTimer.Sample(); 01367 01368 if (BitmapID == GetGadgetBitmap(_R(IDB_SL_RENDN))) 01369 return TRUE; 01370 SetGadgetBitmap(_R(IDB_SL_RENDN), BitmapID); 01371 //PaintGadgetNow(_R(IDB_SL_RENDN)); 01372 01373 return TRUE; 01374 }
|
|
Sets the status line text. Records it. Puts it in the gadget and invalidates it if the gadget is shown.
Definition at line 1516 of file statline.cpp. 01517 { 01518 SetNeedsUpdate(); // Don't allow another update on idles for 250ms 01519 01520 if (StatusText == text) 01521 return TRUE; 01522 01523 StatusText = text; 01524 if (!ProgressShown) 01525 { 01526 TRACEUSER("amb", _T("updating status text")); 01527 BOOL ok=SetStringGadgetValue(_R(IDC_SL_STATUSTEXT), text); 01528 // PaintGadgetNow(_R(IDC_SL_STATUSTEXT)); 01529 return ok; 01530 } 01531 return TRUE; 01532 }
|
|
Creates a window and associates it with this CProgressBar object. The window appears immediately over the status bar. Notes: This currently assumes that it'll only ever be opened at the bottom of the Main Frame window.
Definition at line 1393 of file statline.cpp. 01394 { 01395 BOOL ShowChanged=(Show != ProgressShown); 01396 01397 String_8 EmptyString(_T("")); 01398 01399 // Make "NULL" mean "empty string" 01400 if (!JobDescrip) 01401 JobDescrip=&EmptyString; 01402 01403 BOOL StringChanged=!JobDescription || (*JobDescription!=*JobDescrip); 01404 01405 // Return if nothing changed 01406 if (!ShowChanged && !StringChanged) 01407 return TRUE; 01408 01409 if (ShowChanged) 01410 { 01411 HideGadget(_R(IDC_SL_PROGRESSGAUGE), !Show); 01412 HideGadget(_R(IDC_SL_PROGRESSPERCENT), !Show); 01413 Layout(); 01414 ProgressShown=Show; 01415 01416 CurrentPercent=-1; // Force a redraw 01417 SetPercent(0, TRUE, JobDescrip); // Force redraw of window _including background_; always refresh string 01418 01419 return TRUE; 01420 } 01421 01422 return SetPercent(CurrentPercent, StringChanged, StringChanged?JobDescrip:NULL); 01423 }
|
|
if too long for the given width, truncate the given text at one of the specified delimiters
Definition at line 865 of file statline.cpp. 00866 { 00867 ERROR2IF( pText==NULL,FALSE,"StatusLine::TruncateTextToPane() - pText==NULL"); 00868 00869 // try truncating text at each successive point until it no longer fits the pane then 00870 // use the last one that fitted (if text null or no truncation points use whole text) 00871 INT32 LastTruncPoint=pText->Length(); 00872 String_256 text(""); 00873 00874 INT32 TruncPoint=pText->Sub(SelDescSuffix); 00875 if (TruncPoint==-1) 00876 TruncPoint=pText->Length(); 00877 else 00878 TruncPoint+=SelDescSuffix.Length(); 00879 pText->Left(&text,TruncPoint); 00880 00881 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 00882 #ifndef EXCLUDE_FROM_XARALX 00883 INT32 TextWidth=0; 00884 while ((TextWidth=pCCStatusBar->GetTextWidth(&text))<=width) 00885 { 00886 ERROR2IF(TextWidth==-1,FALSE,"StatusLine::TruncateTextToPane() - pCCStatusBar->GetTextWidth() failed"); 00887 LastTruncPoint=TruncPoint; 00888 if (LastTruncPoint==pText->Length()) 00889 break; 00890 TruncPoint=pText->Sub(TruncChar,LastTruncPoint+1); 00891 if (TruncPoint==-1) 00892 TruncPoint=pText->Length(); 00893 pText->Left(&text,TruncPoint); 00894 } 00895 #endif 00896 00897 pText->Left(pText,LastTruncPoint); 00898 00899 return TRUE; 00900 }
|
|
Definition at line 167 of file statline.h. 00167 { DoControlHelp = TRUE; return (TRUE); }
|
|
Update mouse position pane, and snapped indicator If pDocCoord==NULL && pSpread==NULL && Snapped==FALSE, the mouse pos will be blanked.
Definition at line 1183 of file statline.cpp. 01185 { 01186 #ifndef STANDALONE 01187 01188 if (MousePosPaneNeedsResizing) 01189 return TRUE; 01190 01191 BOOL Blank = (pDocCoord==NULL && pSpread==NULL && Snapped==FALSE); 01192 if (!Blank) 01193 { 01194 ERROR2IF( pSpread==NULL,FALSE,"StatusLine::UpdateMousePosAndSnap() - pSpread==NULL"); 01195 ERROR2IF( pDocCoord==NULL,FALSE,"StatusLine::UpdateMousePosAndSnap() - pDocCoord==NULL"); 01196 } 01197 01198 BOOL ReturnValue=TRUE; 01199 01200 // update mouse position pane if over selected doc, else blank it 01201 String_256 MousePosText(""); 01202 if (!Blank && GetMousePosText(&MousePosText,*pDocCoord,pSpread)==FALSE) 01203 ReturnValue=FALSE; 01204 01205 if (MousePosText != m_MousePosText) 01206 { 01207 m_MousePosText= MousePosText; 01208 01209 ReturnValue &=SetStringGadgetValue(_R(IDC_SL_MOUSEPOS), MousePosText); 01210 // PaintGadgetNow(_R(IDC_SL_MOUSEPOS)); - is there any need to paint this now? Flushes gtk buffer etc. Not a great idea. 01211 } 01212 01213 // WEBSTER - markn 15/1/97 01214 // No rulers in Webster 01215 #ifndef WEBSTER 01216 // and update ruler mouse followers 01217 DocView* pView = DocView::GetSelected(); 01218 if (pView!=NULL) 01219 { 01220 RulerPair* pRulerPair = pView->GetpRulerPair(); 01221 if (pRulerPair!=NULL) 01222 ReturnValue = pRulerPair->UpdateMouseFollowers(pDocCoord); 01223 } 01224 #endif // WEBSTER 01225 01226 // WEBSTER-ranbirr-13/11/96 01227 #ifndef WEBSTER 01228 // if snap indicator not reflecting the desired state, update it. 01229 if (Snapped && (GetGadgetBitmap(_R(IDB_SL_SNAP)) != _R(IDB_SL_SNAP))) 01230 { 01231 SetGadgetBitmap(_R(IDB_SL_SNAP), _R(IDB_SL_SNAP)); 01232 PaintGadgetNow(_R(IDB_SL_SNAP)); 01233 } 01234 if (!Snapped && (GetGadgetBitmap(_R(IDB_SL_SNAP)) != _R(IDB_SL_SNAPN))) 01235 { 01236 SetGadgetBitmap(_R(IDB_SL_SNAP), _R(IDB_SL_SNAPN)); 01237 PaintGadgetNow(_R(IDB_SL_SNAP)); 01238 } 01239 #endif 01240 01241 // if snap pointer not reflecting the desired state, update it. 01242 // (The snap pointer is only shown when snapped and during a 'SnappingDrag' drag) 01243 Operation* pDragOp = Operation::GetCurrentDragOp(); 01244 if (Snapped && pDragOp!=NULL && pDragOp->SnappingDrag()) 01245 { 01246 // Snapped and dragging so show pointer shape if not already shown 01247 if (SnappedCursorID==0) 01248 { 01249 SnappedCursorID = CursorStack::GPush(pSnappedCursor); 01250 } 01251 } 01252 else 01253 { 01254 // Not snapped or dragging so hide pointer shape if it was shown 01255 if (SnappedCursorID!=0) 01256 { 01257 CursorStack::GPop(SnappedCursorID); 01258 SnappedCursorID = 0; // flag cursor no longer on stack 01259 } 01260 } 01261 01262 // and mouse position no longer needs updating 01263 MousePosNeedsUpdatingFlag=FALSE; 01264 return ReturnValue; 01265 01266 #else 01267 return TRUE; 01268 #endif 01269 }
|
|
Update mouse position pane, and snapped indicator If pDocCoord==NULL && pSpread==NULL && Snapped==FALSE, the mouse pos will be blanked.
Definition at line 1283 of file statline.cpp. 01284 { 01285 // if (MousePosPaneNeedsResizing) 01286 // return TRUE; 01287 01288 BOOL ReturnValue=TRUE; 01289 01290 // if drag indicator not reflecting the desired state, update it. 01291 PORTNOTE("StatusLine", "Removed use of CCStatusBar") 01292 #ifndef EXCLUDE_FROM_XARALX 01293 FlagState DragState = pCCStatusBar->PaneState(_R(IDS_SL_SDRAG)); 01294 if (bSolid && DragState==Disable) 01295 { 01296 if (pCCStatusBar->PaneState(_R(IDS_SL_SDRAG), Enable)==Fail) 01297 ReturnValue=FALSE; 01298 01299 // force a redraw of the drag pane 01300 pCCStatusBar->UpdatePaneBitmap(_R(IDS_SL_SDRAG),0, TRUE); 01301 01302 } 01303 if (!bSolid && DragState!=Disable) 01304 { 01305 if (pCCStatusBar->PaneState(_R(IDS_SL_SDRAG), Disable)==Fail) 01306 ReturnValue=FALSE; 01307 01308 // force a redraw of the snap pane 01309 pCCStatusBar->UpdatePaneBitmap(_R(IDS_SL_SDRAG),0, TRUE); 01310 } 01311 #endif 01312 01313 return ReturnValue; 01314 }
|
|
Definition at line 755 of file statline.cpp. 00756 { 00757 // FixFPControlRegister(); 00758 00759 #ifdef STANDALONE 00760 PrefixSelDesc = FALSE; // Never show Selection Description in Viewer 00761 #endif 00762 00763 // create a string by concatenating sel desc and help text (as required) 00764 String_256 text(""); 00765 SelRange* pSelection = 0; 00766 00767 if (m_strPrefix.IsEmpty()) 00768 { 00769 if (PrefixSelDesc) 00770 { 00771 // Show the selection state. 00772 00773 // DMc 19/5/99 00774 // Alter the range control before we do the describe 00775 pSelection = GetApplication()->FindSelection(); 00776 00777 if (pSelection) text = pSelection->Describe(STATUS_BAR); 00778 } 00779 } 00780 else 00781 { 00782 // Show the caller-defined prefix. 00783 text = m_strPrefix; 00784 } 00785 00786 if (text.Length()>0) SafeAppendString(&text, SelDescSuffix, FALSE); 00787 if (pText) SafeAppendString(&text, *pText, FALSE); 00788 00789 // re-sample time and update status line 00790 TextTimer.Sample(); 00791 00792 if ((IsRestrictedAccessToColourPicker () == FALSE) && (DoControlHelp == TRUE)) 00793 { 00794 return SetStatusText(text); 00795 } 00796 else 00797 { 00798 return (TRUE); 00799 } 00800 00801 return FALSE; 00802 }
|
|
Definition at line 804 of file statline.cpp. 00805 { 00806 // FixFPControlRegister(); 00807 00808 #ifdef STANDALONE 00809 PrefixSelDesc = FALSE; // Never show Selection Description in Viewer 00810 #endif 00811 00812 ERROR2IF(restrictStatusLineFunctionsToColourPicker==FALSE,FALSE,"StatusLine::UpdateColourPickerText() - require TRUE to use this function!"); 00813 00814 // create a string by concatenating sel desc and help text (as required) 00815 String_256 text(""); 00816 SelRange* pSelection = 0; 00817 00818 RangeControl rg; 00819 00820 if (m_strPrefix.IsEmpty()) 00821 { 00822 if (PrefixSelDesc) 00823 { 00824 // Show the selection state. 00825 00826 // DMc 19/5/99 00827 // Alter the range control before we do the describe 00828 pSelection = GetApplication()->FindSelection(); 00829 00830 if (pSelection) text = pSelection->Describe(STATUS_BAR); 00831 } 00832 } 00833 else 00834 { 00835 // Show the caller-defined prefix. 00836 text = m_strPrefix; 00837 } 00838 00839 if (text.Length()>0) SafeAppendString(&text, SelDescSuffix, FALSE); 00840 if (pText) SafeAppendString(&text, *pText, FALSE); 00841 00842 // re-sample time and update status line 00843 TextTimer.Sample(); 00844 00845 return SetStatusText(text); 00846 }
|
|
Definition at line 217 of file statline.h. |
|
Definition at line 200 of file statline.h. |
|
Definition at line 218 of file statline.h. |
|
Definition at line 222 of file statline.h. |
|
Definition at line 197 of file statline.h. |
|
Definition at line 237 of file statline.h. |
|
Definition at line 191 of file statline.h. |
|
Definition at line 188 of file statline.h. |
|
Definition at line 187 of file statline.h. |
|
Definition at line 192 of file statline.h. |
|
Definition at line 219 of file statline.h. |
|
Definition at line 180 of file statline.h. |
|
Definition at line 190 of file statline.h. |
|
Definition at line 186 of file statline.h. |
|
Definition at line 199 of file statline.h. |
|
Definition at line 202 of file statline.h. |
|
Definition at line 181 of file statline.h. |
|
Definition at line 220 of file statline.h. |
|
Definition at line 185 of file statline.h. |