home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DClap / DWindow.cpp < prev    next >
Encoding:
Text File  |  1996-07-05  |  15.9 KB  |  684 lines  |  [TEXT/R*ch]

  1. // DWindow.cp
  2. // d.g.gilbert
  3.  
  4. #include "Dvibrant.h"
  5. #include "DWindow.h"
  6. #include "DControl.h"
  7. #include "DFindDlog.h"
  8. #include "DList.h"
  9. #include "DApplication.h"
  10. #include "DTask.h"
  11. #include "DMethods.h"
  12.  
  13.  
  14. //
  15. //        Mswin/Borland C++ has some weird problem with the "Boolean"
  16. //        def of "Nlm_Boolean" when it is in public function parameter lists
  17. //
  18.  
  19.  
  20. // need hidden vibrant methods & object for window-system-specific 
  21.  
  22. #include <vibincld.h>
  23.  
  24. #ifdef WIN_MOTIF
  25. extern "C" Nlm_ShellTool Nlm_GetWindowShell PROTO((Nlm_WindoW w));
  26. #endif
  27.  
  28. extern "C" void Nlm_SetAppWindow( Nlm_WindoW w); /* vibwndws.c */
  29.  
  30.  
  31. enum ResizeWindSizes {
  32.     kWinDragHeight = 20,
  33.     kWinScrollWidth = 0,   // added to both vert & hor.
  34.     kWinMinWidth = 0,
  35.     kWinExtraHeight
  36. #ifdef WIN_MSWIN
  37.     = 20
  38. #else
  39.     = 0
  40. #endif
  41.     };
  42.  
  43.         /* from vibrant/vibwndws.c */
  44. extern "C" void Nlm_ResizeWindow(Nlm_GraphiC w, Nlm_Int2 dragHeight,
  45.                               Nlm_Int2 scrollWidth, Nlm_Int2 minWidth,
  46.                               Nlm_Int2 extraHeight);
  47.  
  48.  
  49. DWindowManager*    gWindowManager = NULL;
  50.  
  51.  
  52. class DWindowCarcass : public DView
  53. {
  54.     // this object holds the parts of DWindow that cannot be deleted by ~DWindow()
  55.     // because Nlm subview objects are likely in the calling chain.
  56.     // So create this object from a dying window, post to task chain for later
  57.     // trashing by gApplication handler.
  58. //
  59. //   23Dec94 -- this looks obsolete -- needs further test, but
  60. //   simple tests say ~DWindow() is working well w/o it
  61. // !!! NO, MOTIF bombs after ~DWindow() due to calls to windowDeactivate after
  62. //            deleteing window object !
  63. public:
  64.     DWindowCarcass( DView* theWindow) : 
  65.         DView( 0, NULL, 0, NULL, theWindow->fSubordinates)
  66.     {
  67. #ifndef WIN_MOTIF
  68.             // motif bombs in this.delete due to something 
  69.     fNlmObject= theWindow->fNlmObject; // bypass the DView(object) setting
  70. #endif
  71.         theWindow->fNlmObject= NULL;
  72.         theWindow->fSubordinates= NULL;
  73.     }
  74. };
  75.  
  76.  
  77.  
  78.  
  79. // class DWindow
  80.  
  81. extern "C" void windowCloseProc (Nlm_WindoW item)
  82. {
  83.     DWindow *obj= (DWindow*) Nlm_GetObject( (Nlm_GraphiC)item);
  84.     if (obj) obj->Close();
  85. }
  86.  
  87. extern "C" void windowResizeProc (Nlm_WindoW item)
  88. {
  89.     DWindow *obj= (DWindow*) Nlm_GetObject( (Nlm_GraphiC)item);
  90.     if (obj) obj->ResizeWin();
  91. }
  92.  
  93.  
  94. extern "C" void windowActivateProc (Nlm_WindoW item)
  95. {
  96.     DWindow *obj= (DWindow*) Nlm_GetObject( (Nlm_GraphiC)item);
  97.     if (obj) obj->Activate();
  98. }
  99.  
  100. extern "C" void windowDeactivateProc (Nlm_WindoW item)
  101. {
  102.     DWindow *obj= (DWindow*) Nlm_GetObject( (Nlm_GraphiC)item);
  103.     if (obj) obj->Deactivate();
  104. }
  105.  
  106.  
  107.  
  108. DWindow::DWindow(long id, DTaskMaster* itsSuperior, WindowStyles style,
  109.                     short width, short height, short left, short top, char* title, Nlm_Boolean freeOnClose) :
  110.             DView( id, NULL, kWindow, itsSuperior),
  111.             fWindow(NULL), fEditText(NULL), fFilename(NULL),
  112.             fModal(false), fOkay(false), fFreeOnClose(false),
  113.             fPrintHandler(NULL), fSaveHandler(NULL), fFindDlog(NULL)
  114. {
  115.     InitWindow(style, width, height, left, top, title, freeOnClose);
  116. }
  117.  
  118.  
  119. DWindow::DWindow(long id, DTaskMaster* itsSuperior) :
  120.             DView( id, NULL, kWindow, itsSuperior),
  121.             fWindow(NULL), fEditText(NULL), fFilename(NULL),
  122.             fModal(false), fOkay(false), fFreeOnClose(false),
  123.             fPrintHandler(NULL), fSaveHandler(NULL), fFindDlog(NULL)
  124. {
  125.     // caller MUST call: Initialize(style, width, height, left, top, title);
  126. }
  127.  
  128.  
  129. DWindow::~DWindow()
  130. {        
  131. #if 0
  132. // this gets us into trouble when child ~ has been called...
  133. // do in ::Close() instead - but QUIT() bypasses Close() !
  134.     if (fSaveHandler) {
  135.         char mytitle[50];
  136.         GetTitle(mytitle, sizeof(mytitle));
  137.         if (fSaveHandler->DirtySaveCancelled(mytitle)) 
  138.             ;// can't abort here if they cancel the save 
  139.      }
  140. #endif
  141.  
  142. #ifdef WIN_MOTIF
  143.   if (gApplication->fDone) {
  144. #endif
  145.         // this is working now !! we can throw out that WindowCarcass jazz !!
  146.     Nlm_SetActivate(fWindow, NULL); 
  147.     Nlm_SetDeactivate(fWindow, NULL); // need for motif
  148.  
  149. #ifdef WIN_MOTIF
  150.         // also need for motif, to avoid damn call this window's dead draw procs !! 
  151.         // (via nlm_remove->nlm_hidewindow->nlm_update->Xtcallbacks->subview draw methods )
  152.   Nlm_GphPrcsPtr classPtr = Nlm_GetClassPtr((Nlm_GraphiC)fNlmObject);
  153.      classPtr->hide= NULL;
  154.     }
  155.   else {
  156.        DWindowCarcass* deadbody= new DWindowCarcass(this);
  157.        gApplication->PostTask( 
  158.           gApplication->newTask( DApplication::kDeleteDeadWindow, 
  159.             DTask::kMenu,   (long)deadbody));
  160.     }
  161. #endif
  162.  
  163.     gWindowManager->DeleteWindow(this, false);
  164. }
  165.                     
  166.                     
  167. void DWindow::InitWindow(WindowStyles style, 
  168.                         short width, short height, short left, short top, char* title, Nlm_Boolean freeOnClose) 
  169. {
  170.     //this->Initialize(); // << this is done in call to DView::DView() 
  171.     fFreeOnClose= freeOnClose;
  172.     switch (style) {
  173.         case document:
  174.             fWindow= Nlm_DocumentWindow(left, top, width, height, title, windowCloseProc, windowResizeProc);
  175.             break;
  176.         case fixed:
  177.             fWindow= Nlm_FixedWindow(left, top, width, height, title, windowCloseProc);
  178.             break;
  179.         case frozen:
  180.             fWindow= Nlm_FrozenWindow(left, top, width, height, title, windowCloseProc);
  181.             break;
  182.         case round:
  183.             fWindow= Nlm_RoundWindow(left, top, width, height, title, windowCloseProc);
  184.             break;
  185.         case alert:
  186.             fWindow= Nlm_AlertWindow(left, top, width, height, windowCloseProc);
  187.             break;
  188.         case modal:
  189.             fWindow= Nlm_ModalWindow(left, top, width, height, windowCloseProc);
  190.             break;
  191.         case floating:
  192.             fWindow= Nlm_FloatingWindow(left, top, width, height, windowCloseProc);
  193.             break;
  194.         case shadow:
  195.             fWindow= Nlm_ShadowWindow(left, top, width, height, windowCloseProc);
  196.             break;
  197.         case plain:
  198.             fWindow= Nlm_PlainWindow(left, top, width, height, windowCloseProc);
  199.             break;
  200.         }
  201.         
  202.     this->SetNlmObject( fWindow);
  203.     Nlm_SetActivate(fWindow, windowActivateProc);
  204.     Nlm_SetDeactivate(fWindow, windowDeactivateProc);
  205.     gWindowManager->AddWindow(this);
  206. }                    
  207.  
  208.  
  209. void DWindow::SetFilename( char* name) 
  210. {
  211.     if (name) {
  212.         MemFree(fFilename);
  213.         fFilename= StrDup(name);
  214.         }
  215. }
  216.  
  217. char* DWindow::GetFilename( char* name, ulong maxsize)
  218. {
  219.     if (name==NULL) name= (char*) MemNew(maxsize);  
  220.     Nlm_StrNCpy( name, fFilename, maxsize);
  221.     return name;
  222. }
  223.  
  224.  
  225. void DWindow::AddOkayCancelButtons( long okayId, char* okayName, long cancelId, char* cancelName)
  226. {
  227.      Nlm_PoinT npt;
  228.      this->NextSubviewBelowLeft(); // this doesn't account for extra size of DDefaultButton !
  229.      this->GetNextPosition( &npt);
  230.      npt.y += 10;  // is +3 for Mac, +8 for MSWin, +10 for Motif
  231.      this->SetNextPosition( npt);
  232.     DButton* bb= new DButton( cancelId, this, cancelName);
  233.     bb->SetResize( DView::fixed, DView::moveinsuper); // testing, want this??
  234.     bb->suicide(1);
  235.     
  236.     this->NextSubviewToRight();
  237.      this->GetNextPosition( &npt);
  238.      npt.x += 10;  // is +3 for Mac, +8 for MSWin, +10 for Motif
  239.      this->SetNextPosition( npt);
  240.     DDefaultButton* db= new DDefaultButton( okayId, this, okayName);
  241.     db->SetResize( DView::fixed, DView::moveinsuper);
  242.     db->suicide(1);
  243. }
  244.  
  245.  
  246. Nlm_Boolean DWindow::IsMyAction(DTaskMaster* action) 
  247. {    
  248.     // ?? add fEditText cut/copy/paste handling here??
  249.     switch(action->Id()) {
  250.         case cOKAY:
  251.             this->OkayAction();
  252.             fOkay= true;
  253.             // fall thru to next case
  254.         case cCANC: 
  255.             fModal= false;
  256.             this->Close(); // !! Cant Free yet, caller may need object's data !! CloseAndFree();
  257.             return true;
  258.         default:
  259.             return DView::IsMyAction(action);    
  260.         }
  261. }
  262.  
  263. void DWindow::OkayAction() 
  264. }
  265.  
  266. Nlm_Boolean DWindow::PoseModally() 
  267.     fModal = true;
  268.     this->Open();
  269.     while (fModal)  
  270.         gApplication->ProcessTasks();  
  271.     return fOkay; // ?? ain't what we want - want fSubordinate's fId
  272. }
  273.  
  274.  
  275. void DWindow::CalcWindowSize()
  276. {
  277. #ifdef WIN_MSWIN
  278.   short WinExtraHeight = kWinExtraHeight;
  279.  
  280.   // note: SM_CYHSCROLL == Nlm_hScrollBarHeight
  281.   WinExtraHeight = 10 + GetSystemMetrics(SM_CYHSCROLL);
  282.  
  283.     Nlm_ResizeWindow( (Nlm_GraphiC)fWindow, kWinDragHeight, kWinScrollWidth,
  284.                          kWinMinWidth, WinExtraHeight);
  285.  
  286. #else
  287.     Nlm_ResizeWindow( (Nlm_GraphiC)fWindow, kWinDragHeight, kWinScrollWidth,
  288.                          kWinMinWidth, kWinExtraHeight);
  289. #endif
  290. }
  291.  
  292. void DWindow::ResizeWin() 
  293. {
  294.     Nlm_PoinT delta;
  295.     Nlm_RecT     current;
  296.     this->ViewRect(current);
  297.             // need to check that fViewrect was set to valid values
  298.     if (fViewrect.bottom>0 && fViewrect.right>0 && fViewrect.top>=0 && fViewrect.left>=0) {
  299.         delta.x = (current.right - current.left) - (fViewrect.right - fViewrect.left);
  300.         delta.y = (current.bottom - current.top) - (fViewrect.bottom - fViewrect.top);
  301.         if (delta.x || delta.y) {
  302.             this->Select(); // for motif ??
  303.             this->ResizeSubviews( this, delta);
  304.             }
  305.         }
  306.     fViewrect= current;
  307.     gWindowManager->SetCurrent(this);
  308. }
  309.  
  310.  
  311. void  DWindow::Select() 
  312. {
  313.     DView::Select();
  314.     //Nlm_UseWindow(fWindow); // 23feb -- does Motif need this also ??
  315.     gWindowManager->SetCurrent(this);
  316. }
  317.  
  318. void DWindow::Open()  
  319. #if 1
  320.     // test order of this, 15may94
  321.     this->Select(); 
  322.     this->Show(); 
  323. #else
  324.     this->Show(); 
  325.     this->Select(); 
  326. #endif
  327.     this->ViewRect(fViewrect); 
  328.     //gWindowManager->SetCurrent(this); // select does
  329. }
  330.  
  331. void DWindow::Hide() 
  332.     DView::Hide(); 
  333.     gWindowManager->UnsetCurrent(this);
  334. }
  335.  
  336. void DWindow::Close() 
  337.     fModal= false;
  338.     if (this != gWindowManager->GetAppWindow()) {
  339.         if (fSaveHandler) {
  340.             char mytitle[50];
  341.             GetTitle(mytitle, sizeof(mytitle));
  342.             if (fSaveHandler->DirtySaveCancelled(mytitle)) 
  343.                 return; 
  344.             }
  345.  
  346.         this->Hide(); 
  347.         if (fFreeOnClose) {
  348.             
  349.                     // We may have a LARGE BUG here... 
  350.                     // looks like DObject::suicide isn't calling destructors of DObject subclasses !!!!!!!!!
  351.                     
  352.             //this->suicide(); 
  353.             //delete this;  << THIS IS BAD programming
  354.             gWindowManager->DeleteWindow(this, true);
  355.             }
  356.         gWindowManager->UnsetCurrent(this);
  357.         }
  358. }
  359.  
  360. void DWindow::CloseAndFree() 
  361.     fModal= false;
  362.     if (this != gWindowManager->GetAppWindow()) {
  363.         gWindowManager->DeleteWindow(this, false); // do so close/hide won't mess w/ win list
  364.         fFreeOnClose= true;
  365.         this->Close(); 
  366.         }
  367. }
  368.  
  369. void DWindow::PrintDoc()  
  370. {
  371.     if (fPrintHandler) fPrintHandler->Print(); 
  372.     else Message(MSG_OK,"DWindow::Print not ready.");
  373. }
  374.  
  375. void DWindow::SaveDoc(DFile* f)  
  376.     if (fSaveHandler) fSaveHandler->Save(f);
  377.     else Message(MSG_OK,"DWindow::Save not ready.");
  378. }
  379.  
  380.  
  381. void DWindow::SendToBack()
  382. {
  383.     gWindowManager->SendToBack(this);
  384. }  
  385.  
  386. void DWindow::BringToFront()
  387. {
  388.     gWindowManager->BringToFront(this);
  389. }  
  390.  
  391. void  DWindow::Activate() 
  392. {
  393.     gWindowManager->SetCurrent(this);
  394. }
  395.  
  396. void  DWindow::Deactivate() 
  397. {
  398.     //gWindowManager->UnsetCurrent(this);
  399. }
  400.  
  401. void DWindow::Erase()         
  402. {
  403.     Nlm_EraseWindow(fWindow); 
  404. }
  405.  
  406. void DWindow::Use()             
  407.     Nlm_UseWindow(fWindow); 
  408.     gWindowManager->SetCurrent(this);
  409. }
  410.  
  411. Nlm_Boolean DWindow::IsUsing() 
  412.     return Nlm_UsingWindow(fWindow); 
  413. }
  414.  
  415. void DWindow::Realize()     
  416.     Nlm_RealizeWindow(fWindow); 
  417. }
  418.  
  419. #if MAC_ONLY_OPTION
  420. Nlm_Boolean DWindow::InFront() 
  421.     return Nlm_InFront(fWindow); 
  422. }
  423. #endif
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430. // DSaveHandler
  431.  
  432. class DSaveDocDialog : public DWindow 
  433. {
  434. public:    
  435.     DSaveDocDialog(char* title);
  436. };
  437.  
  438. DSaveDocDialog::DSaveDocDialog(char* title) :
  439.     DWindow( 0, NULL, DWindow::modal, -10, -10, -50, -20, "", kDontFreeOnClose) // DWindow::fixed
  440. {
  441.     char str[80];
  442.     if (title && *title) {
  443.         StrCpy( str, "Save document '");
  444.     StrNCat( str, title, 20);
  445.     if (StrLen(title)>20) StrCat( str, "...");
  446.     StrCat( str, "'?");
  447.         }
  448.   else
  449.       StrCpy( str, "Save this document?");
  450.     new DPrompt( 0, this, str, 0, 0, Nlm_systemFont);             
  451.     //DButton* but= new DButton( cMapBut, this, "Cancel");
  452.     this->AddOkayCancelButtons(cOKAY,"Yes",cCANC,"No");    
  453.     DWindow::Open();
  454. }
  455.  
  456.  
  457.  
  458. short DSaveHandler::DirtySaveCancelled(char *doctitle) 
  459.     short cancelled= 0;
  460.     if (fDirty) {
  461.         // save/dontsave/cancel;
  462.         DSaveDocDialog* dlog= new DSaveDocDialog(doctitle);
  463.         if (dlog->PoseModally()) { 
  464.             gApplication->DoMenuTask( DApplication::kSaveAs, NULL);
  465.             }
  466.     NotDirty();  // ?? regardless of user choice?
  467.         delete dlog; // <!! not if kFreeOnClose is DWindow option !!
  468.         }
  469.     return cancelled;         // return cancelSave
  470. }
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477. // class DWindowManager
  478.  
  479.  
  480. DWindowManager::DWindowManager()
  481. {
  482.     fWindows= new DList();
  483.     fAppWindow = NULL;
  484.     fLastActive= NULL;
  485. }
  486.  
  487. DWindowManager::~DWindowManager()
  488. {
  489.     long i, n= fWindows->GetSize();
  490.     for (i= n-1; i>0; i--) { 
  491.         DWindow* theWin= (DWindow*) fWindows->At(i); 
  492.         if (theWin) {
  493.             theWin->fFreeOnClose= false;
  494.             theWin->Close(); // to save dirty?
  495.             delete theWin; 
  496.             }
  497.         }
  498.     delete fWindows;
  499. }
  500.  
  501. void DWindowManager::AddWindow(DWindow* theWin)
  502. {
  503.     if (theWin != fAppWindow) {
  504.         fWindows->InsertLast(theWin);
  505.         fLastActive= theWin;
  506.         }
  507. }
  508.  
  509. void DWindowManager::DeleteWindow(DWindow* theWin, Nlm_Boolean postDeleteTask)
  510. {
  511.     if (theWin == fAppWindow) fAppWindow= NULL;
  512.     else if (theWin) {
  513.       fWindows->Delete(theWin); // do before Unset so it isn't stuck back in win list
  514.     UnsetCurrent(theWin);
  515.         // 4sep94: fix to eliminate use of "delete this" in DWindow::Close()
  516.         if (postDeleteTask) delete theWin;  // ~DWindow calls back here, with !postDeleteTask
  517.       }
  518. }
  519.  
  520. void DWindowManager::SetCurrent(DWindow* theWin)
  521. {
  522.     if (theWin && theWin != fAppWindow) {
  523.         if (theWin != (DWindow*)fWindows->Last()) {
  524.             fWindows->Delete(theWin);
  525.             fWindows->InsertLast(theWin);
  526.             }
  527.         fLastActive= theWin;
  528.         }
  529. }
  530.  
  531. void DWindowManager::UnsetCurrent(DWindow* theWin)
  532. {
  533.     if (theWin && theWin == fLastActive) {
  534.         if (theWin == (DWindow*)fWindows->Last()) {
  535.             fWindows->Delete(theWin);
  536.                 //??? where do we put it in list so it cycles to top as real window does
  537.             fWindows->InsertFirst(theWin); 
  538.             }
  539.         fLastActive= (DWindow*)fWindows->Last();
  540.         }
  541. }
  542.  
  543.  
  544. DWindow*    DWindowManager::CurrentWindow() 
  545. {
  546. #if 0
  547. //#ifdef WIN_MAC
  548.     return (DWindow*) Nlm_GetObject( (Nlm_GraphiC)Nlm_FrontWindow());
  549. #else
  550.             // try to get motif to recognize front/active window
  551.     return fLastActive;
  552. #endif
  553. }
  554.  
  555.  
  556.  
  557. void DWindowManager::SendToBack(DWindow* theWin)
  558. {
  559.     if (!theWin) theWin= (DWindow*) fWindows->Last();
  560.     if (theWin) {
  561.         this->UnsetCurrent(theWin);
  562.         
  563. #ifdef WIN_MAC
  564.         Nlm_WindowTool wptr= Nlm_ParentWindowPtr((Nlm_GraphiC)theWin->fWindow);
  565.         if (wptr) ::SendBehind( wptr, NULL);
  566. #endif
  567.  
  568. #ifdef WIN_MSWIN
  569.             // apparently no SendBehind for MSWindows !! 
  570.             // do it the hard way ... bring all others to front
  571.             // this probably looks like shit
  572.             // UnsetCurrent puts theWin == fWindows.First(), so start w/ iwin=1, after 0th
  573.         short nwin= fWindows->GetSize();
  574.         for (short iwin=1; iwin<nwin; iwin++) {
  575.             DWindow* aWin= (DWindow*)fWindows->At(iwin);
  576.         Nlm_WindowTool wptr = Nlm_ParentWindowPtr((Nlm_GraphiC)aWin->fWindow);
  577.            if (wptr) ::BringWindowToTop(wptr);
  578.             }
  579. #endif
  580.  
  581. #ifdef WIN_MOTIF
  582.     if (Nlm_WindowHasBeenShown(theWin->fWindow)) {
  583.       if (Nlm_currentXDisplay != NULL) {
  584.         //Nlm_ShellTool shl;
  585.                 Widget shl; // for IRIX
  586.  
  587.         shl = Nlm_GetWindowShell(theWin->fWindow);
  588.         //XMapRaised (Nlm_currentXDisplay, XtWindow (shl));
  589. #ifndef OS_UNIX_IRIX
  590. // can't get dang sgi to compile w/ XtWindow(Widget) !!
  591.                 XLowerWindow(Nlm_currentXDisplay, XtWindow (shl));
  592. #endif
  593.         }
  594.       }
  595. #endif
  596.  
  597.         theWin= (DWindow*) fWindows->Last();
  598.         theWin->Select();
  599.         }
  600. }
  601.  
  602.  
  603.  
  604. void DWindowManager::BringToFront(DWindow* theWin)
  605. {
  606.      // if null, lastwin
  607.     if (!theWin) {
  608.         theWin= (DWindow*) fWindows->First();
  609.         if (theWin == fAppWindow) theWin= (DWindow*) fWindows->At(1); // skip appwin
  610.         }
  611.     if (theWin) theWin->Select();
  612. }
  613.  
  614.  
  615. void DWindowManager::SetAppWindow(DWindow* theWin)
  616. {
  617.     fAppWindow= theWin;
  618.     if (theWin) Nlm_SetAppWindow( theWin->fWindow);
  619. }
  620.  
  621. DWindow* DWindowManager::GetAppWindow()
  622. {
  623.     return fAppWindow;
  624. }
  625.  
  626.  
  627. Nlm_Boolean    DWindowManager::InWindow(Nlm_PoinT mouse) 
  628.     return Nlm_InWindow(mouse); 
  629. }
  630.  
  631. DWindow*    DWindowManager::WhichWindow(Nlm_PoinT mouse) 
  632. {
  633.     return (DWindow*) Nlm_GetObject( (Nlm_GraphiC)Nlm_WhichWindow(mouse));
  634. }
  635.  
  636.  
  637.     
  638. #ifdef THESE_ARE_REDUNDANT
  639. DWindow*    DWindowManager::FrontWindow() 
  640. {
  641.     return (DWindow*) Nlm_GetObject( (Nlm_GraphiC)Nlm_FrontWindow());
  642. }
  643.  
  644. DWindow*    DWindowManager::ActiveWindow() 
  645. {
  646.     return (DWindow*) Nlm_GetObject( (Nlm_GraphiC)Nlm_ActiveWindow());
  647. }
  648. #endif
  649.  
  650.  
  651. DWindow*    DWindowManager::SavePort(DView* newport) 
  652. {
  653.     Nlm_Handle nlmobject= newport->GetNlmObject();
  654.     return (DWindow*) Nlm_GetObject( (Nlm_GraphiC)Nlm_SavePort(nlmobject));
  655. }
  656.  
  657. void    DWindowManager::RestorePort(DWindow* savedwindow) 
  658. {
  659.     Nlm_RestorePort((Nlm_WindoW) savedwindow->GetNlmObject());
  660. }
  661.  
  662. DDialogText*    DWindowManager::CurrentDialogText() 
  663. {
  664.     return (DDialogText*) Nlm_GetObject( (Nlm_GraphiC)Nlm_CurrentText());
  665. }
  666.  
  667. void    DWindowManager::UpdateDisplays()
  668. {
  669.   Nlm_Update();
  670. }
  671.