Changeset 1869

Show
Ignore:
Timestamp:
Tue Dec 20 20:06:40 2005
Author:
fgerlits
Message:

fixed ticket #1476

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/livesupport/src/products/gLiveSupport/src/LiveModeWindow.h

    r1776 r1869  
    215 215         }  
    216 216  
      217         /**  
      218          *  Function to catch the event of the close button being pressed.  
      219          */  
      220         virtual void  
      221         onCloseButtonClicked(void)                              throw ();  
      222  
    217 223  
    218 224     public:  
  • trunk/livesupport/src/products/gLiveSupport/src/SearchWindow.h

    r1601 r1869  
    257 257  
    258 258  
      259     protected:  
      260  
      261         /**  
      262          *  Function to catch the event of the close button being pressed.  
      263          */  
      264         virtual void  
      265         onCloseButtonClicked(void)                              throw ();  
      266  
      267  
    259 268     public:  
    260 269  
  • trunk/livesupport/src/products/gLiveSupport/src/MasterPanelWindow.h

    r1823 r1869  
    294 294                 updateLiveModeWindow();  
    295 295             } else {  
      296                 gLiveSupport->putWindowPosition(liveModeWindow);  
    296 297                 liveModeWindow->hide();  
    297 298             }  
     
    309 310                 updateScratchpadWindow();  
    310 311             } else {  
      312                 gLiveSupport->putWindowPosition(scratchpadWindow);  
    311 313                 scratchpadWindow->hide();  
    312 314             }  
     
    325 327                 updateSimplePlaylistMgmtWindow();  
    326 328             } else {  
      329                 gLiveSupport->putWindowPosition(simplePlaylistMgmtWindow);  
    327 330                 simplePlaylistMgmtWindow->hide();  
    328 331             }  
     
    340 343                 updateSchedulerWindow();  
    341 344             } else {  
      345                 gLiveSupport->putWindowPosition(schedulerWindow);  
    342 346                 schedulerWindow->hide();  
    343 347             }  
    355 359                 updateSearchWindow();  
    356 360             } else {  
      361                 gLiveSupport->putWindowPosition(searchWindow);  
    357 362                 searchWindow->hide();  
    358 363             }  
  • trunk/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.h

    r1776 r1869  
    317 317         onAddToLiveMode(void)                                   throw ();  
    318 318  
      319         /**  
      320          *  Function to catch the event of the close button being pressed.  
      321          */  
      322         virtual void  
      323         onCloseButtonClicked(void)                              throw ();  
      324  
    319 325  
    320 326     public:  
  • trunk/livesupport/src/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx

    r1823 r1869  
    360 360     entriesModel->clear();  
    361 361     isPlaylistModified = false;  
      362     gLiveSupport->putWindowPosition(shared_from_this());  
    362 363     hide();  
    363 364 }  
  • trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.cxx

    r1823 r1869  
    112 112  
    113 113 /*------------------------------------------------------------------------------  
      114  *  The name of the user preference for storing window positions  
      115  *----------------------------------------------------------------------------*/  
      116 static const std::string windowPositionsKey = "windowPositions";  
      117  
      118 /*------------------------------------------------------------------------------  
    114 119  *  The name of the user preference for storing the token of the edited p.l.  
    115 120  *----------------------------------------------------------------------------*/  
     
    490 495  
    491 496     loadScratchpadContents();  
      497     loadWindowPositions();  
    492 498      
    493 499     return true;  
     
    511 517      
    512 518     stopCueAudio();  
      519     showAnonymousUI();  
      520      
      521     storeWindowPositions();  
      522     windowPositions.clear();  
      523      
    513 524     storeScratchpadContents();  
    514 525     scratchpadContents->clear();  
      526      
    515 527     authentication->logout(sessionId);  
    516 528     sessionId.reset();  
      529      
    517 530     return true;  
    518 531 }  
     
    575 588     }  
    576 589      
    577       // just store this as a space-delimited list of ids  
      590     // load the prefs, which is a space-delimited list  
    577 590     std::istringstream          prefsString(prefsUstring->raw());  
    578 591     Ptr<Playable>::Ref          playable;  
    1309 1322 }  
    1310 1323  
      1324  
      1325 /*------------------------------------------------------------------------------  
      1326  *  Save the position and size of the window.  
      1327  *----------------------------------------------------------------------------*/  
      1328 void  
      1329 LiveSupport :: GLiveSupport ::  
      1330 GLiveSupport :: putWindowPosition(Ptr<const Gtk::Window>::Ref    window)  
      1331                                                                     throw ()  
      1332 {  
      1333     WindowPositionType  pos;  
      1334     window->get_position(pos.x, pos.y);  
      1335     window->get_size(pos.width, pos.height);  
      1336  
      1337     windowPositions[window->get_name()] = pos;  
      1338 }  
      1339  
      1340  
      1341 /*------------------------------------------------------------------------------  
      1342  *  Apply saved position and size data to the window.  
      1343  *----------------------------------------------------------------------------*/  
      1344 void  
      1345 LiveSupport :: GLiveSupport ::  
      1346 GLiveSupport :: getWindowPosition(Ptr<Gtk::Window>::Ref         window)  
      1347                                                                     throw ()  
      1348 {  
      1349     WindowPositionsListType::const_iterator it = windowPositions.find(  
      1350                                                         window->get_name());  
      1351     if (it != windowPositions.end()) {  
      1352         WindowPositionType  pos = it->second;  
      1353         window->move(pos.x, pos.y);  
      1354         window->resize(pos.width, pos.height);  
      1355     }  
      1356 }  
      1357  
      1358  
      1359 /*------------------------------------------------------------------------------  
      1360  *  Store the saved window positions.  
      1361  *----------------------------------------------------------------------------*/  
      1362 void  
      1363 LiveSupport :: GLiveSupport ::  
      1364 GLiveSupport :: storeWindowPositions(void)                          throw ()  
      1365 {  
      1366     // just store this as a space-delimited list of window names and numbers  
      1367     std::ostringstream                      prefsString;  
      1368     WindowPositionsListType::iterator       it;  
      1369     WindowPositionsListType::iterator       end;  
      1370     WindowPositionType                      pos;  
      1371  
      1372     it  = windowPositions.begin();  
      1373     end = windowPositions.end();  
      1374     while (it != end) {  
      1375         prefsString << it->first << " ";  
      1376         pos  = it->second;  
      1377         prefsString << pos.x << " "  
      1378                     << pos.y << " "  
      1379                     << pos.width << " "  
      1380                     << pos.height << " ";  
      1381         ++it;  
      1382     }  
      1383  
      1384     Ptr<Glib::ustring>::Ref  prefsUstring(new Glib::ustring(prefsString.str()));  
      1385     try {  
      1386         authentication->savePreferencesItem(sessionId,  
      1387                                             windowPositionsKey,  
      1388                                             prefsUstring);  
      1389     } catch (XmlRpcException &e) {  
      1390         // TODO: signal error  
      1391         std::cerr << "error saving user preferences: " << e.what() << std::endl;  
      1392     }  
      1393 }  
      1394  
      1395  
      1396 /*------------------------------------------------------------------------------  
      1397  *  Load the window positions.  
      1398  *----------------------------------------------------------------------------*/  
      1399 void  
      1400 LiveSupport :: GLiveSupport ::  
      1401 GLiveSupport :: loadWindowPositions(void)                           throw ()  
      1402 {  
      1403     Ptr<Glib::ustring>::Ref     prefsUstring;  
      1404  
      1405     try {  
      1406         prefsUstring = authentication->loadPreferencesItem(sessionId,  
      1407                                                            windowPositionsKey);  
      1408     } catch (XmlRpcException &e) {  
      1409         // TODO: signal error  
      1410         std::cerr << "error loading user preferences: " << e.what()  
      1411                   << std::endl;  
      1412         return;  
      1413     } catch (std::invalid_argument &e) {  
      1414         // no window positions were stored for this user yet; no problem  
      1415         return;  
      1416     }  
      1417      
      1418     // load the prefs, which is a space-delimited list  
      1419     std::istringstream          prefsString(prefsUstring->raw());  
      1420  
      1421     while (!prefsString.eof()) {  
      1422         Glib::ustring           windowName;  
      1423         prefsString >> windowName;  
      1424         if (prefsString.fail()) {  
      1425             break;  
      1426         }  
      1427          
      1428         WindowPositionType      pos;  
      1429         prefsString >> pos.x;  
      1430         if (prefsString.fail()) {  
      1431             continue;  
      1432         }  
      1433         prefsString >> pos.y;  
      1434         if (prefsString.fail()) {  
      1435             continue;  
      1436         }  
      1437         prefsString >> pos.width;  
      1438         if (prefsString.fail()) {  
      1439             continue;  
      1440         }  
      1441         prefsString >> pos.height;  
      1442         if (prefsString.fail()) {  
      1443             continue;  
      1444         }  
      1445          
      1446         windowPositions[windowName] = pos;  
      1447     }  
      1448 }  
      1449  
  • trunk/livesupport/src/products/gLiveSupport/src/SchedulerWindow.cxx

    r1601 r1869  
    52 52 /* ================================================  local constants & macros */  
    53 53  
      54 /**  
      55  *  The name of the window, used by the keyboard shortcuts (or by the .gtkrc).  
      56  */  
      57 static const Glib::ustring  windowName = "schedulerWindow";  
      58  
    54 59  
    55 60 /* ===============================================  local function prototypes */  
     
    141 146     add(*mainBox);  
    142 147  
      148     set_name(windowName);  
    143 149     show_all();  
    144 150  
    299 305 SchedulerWindow :: onCloseButtonClicked (void)                  throw ()  
    300 306 {  
      307     gLiveSupport->putWindowPosition(shared_from_this());  
    301 308     hide();  
    302 309 }  
    303 310  
    304    
  • trunk/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx

    r1787 r1869  
    431 431         metadataEntry->set_text("");  
    432 432     }  
    433    
    434 433     statusBar->set_text("");  
    435    
    436 434     isAudioClipValid = false;  
    437 435  
      436     gLiveSupport->putWindowPosition(shared_from_this());  
    438 437     hide();  
    439 438 }  
  • trunk/livesupport/src/products/gLiveSupport/src/GLiveSupport.h

    r1823 r1869  
    309 309         KeyboardShortcutListType    keyboardShortcutList;  
    310 310  
      311         /**  
      312          *  The type for a single window position.  
      313          */  
      314         typedef struct {  
      315                     int x;  
      316                     int y;  
      317                     int width;  
      318                     int height;  
      319                 }                   WindowPositionType;  
      320         /**  
      321          *  The type for storing the window positions.  
      322          */  
      323         typedef std::map<const Glib::ustring, WindowPositionType>  
      324                                     WindowPositionsListType;  
      325  
      326         /**  
      327          *  The positions of the various windows.  
      328          */  
      329         WindowPositionsListType     windowPositions;  
      330  
    311 331  
    312 332     protected:  
    952 972                    unsigned int             modifiers,  
    953 973                    unsigned int             key) const              throw ();  
      974  
      975         /**  
      976          *  Save the position and size of the window.  
      977          *  
      978          *  The coordinates of the window's North-West corner and the  
      979          *  size of the window are read, and stored in a variable of the  
      980          *  GLiveSupport object, indexed by the window's get_name().  
      981          *  
      982          *  @param  window   the window to save the position and size of.  
      983          *  @see    getWindowPosition()  
      984          */  
      985         void  
      986         putWindowPosition(Ptr<const Gtk::Window>::Ref    window)   throw ();  
      987          
      988         /**  
      989          *  Apply saved position and size data to the window.  
      990          *  
      991          *  If position and size data were previously saved for a window  
      992          *  with the same get_name(), then these data are read and applied to  
      993          *  the window, restoring its position and size.  
      994          *  
      995          *  @param  window   the window to apply the position and size info to.  
      996          *  @see    putWindowPosition()  
      997          */  
      998         void  
      999         getWindowPosition(Ptr<Gtk::Window>::Ref    window)         throw ();  
      1000  
      1001         /**  
      1002          *  Store the saved window positions.  
      1003          *  
      1004          *  The window positions (and sizes) are stored in a user preference  
      1005          *  item.  This is called when the user logs out.  
      1006          *  
      1007          *  @see    loadWindowPositions()  
      1008          */  
      1009         void  
      1010         storeWindowPositions(void)                                  throw ();  
      1011          
      1012         /**  
      1013          *  Load the window positions.  
      1014          *  
      1015          *  The window positions (and sizes) are retrieved from the user  
      1016          *  preference item they were stored in.  This is called when the  
      1017          *  user logs in.  
      1018          *  
      1019          *  @see    storeWindowPosition()  
      1020          */  
      1021         void  
      1022         loadWindowPositions(void)                                   throw ();  
    954 1023 };  
    955 1024  
  • trunk/livesupport/src/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx

    r1823 r1869  
    161 161            5, 0);  
    162 162  
    163       // show only the anonymous UI  
    164       gLiveSupport->showAnonymousUI();  
      163     show_all();  
    165 164 }  
    166 165  
  • trunk/livesupport/src/products/gLiveSupport/src/LiveModeWindow.cxx

    r1787 r1869  
    378 378 }  
    379 379  
      380  
      381 /*------------------------------------------------------------------------------  
      382  *  Event handler for the close button getting clicked.  
      383  *----------------------------------------------------------------------------*/  
      384 void  
      385 LiveModeWindow :: onCloseButtonClicked (void)                       throw ()  
      386 {  
      387     gLiveSupport->putWindowPosition(shared_from_this());  
      388     hide();  
      389 }  
      390  
  • trunk/livesupport/src/products/gLiveSupport/src/SearchWindow.cxx

    r1851 r1869  
    497 497  
    498 498  
      499 /*------------------------------------------------------------------------------  
      500  *  The event when the close button has been clicked.  
      501  *----------------------------------------------------------------------------*/  
      502 void  
      503 SearchWindow :: onCloseButtonClicked(void)                      throw ()  
      504 {  
      505     gLiveSupport->putWindowPosition(shared_from_this());  
      506     hide();  
      507 }  
      508  
  • trunk/livesupport/src/products/gLiveSupport/src/LoginWindow.cxx

    r1601 r1869  
    194 194     set_name("loginWindow");  
    195 195     set_modal(true);  
    196       property_window_position().set_value(Gtk::WIN_POS_NONE);  
      196     property_window_position().set_value(Gtk::WIN_POS_CENTER);  
    196 196     set_resizable(false);  
    197 197     property_destroy_with_parent().set_value(false);  
  • trunk/livesupport/src/products/gLiveSupport/src/MasterPanelWindow.cxx

    r1858 r1869  
    379 379  
    380 380         liveModeWindow.reset(new LiveModeWindow(gLiveSupport, bundle));  
      381         gLiveSupport->getWindowPosition(liveModeWindow);  
    381 382     }  
    382 383      
     
    386 387      
    387 388     if (!liveModeWindow->is_visible()) {  
      389         gLiveSupport->getWindowPosition(liveModeWindow);  
    388 390         liveModeWindow->show();  
    389 391     }  
     
    407 409  
    408 410         uploadFileWindow.reset(new UploadFileWindow(gLiveSupport, bundle));  
      411         gLiveSupport->getWindowPosition(uploadFileWindow);  
    409 412         uploadFileWindow->show();  
    410 413         return;  
     
    412 415  
    413 416     if (!uploadFileWindow->is_visible()) {  
      417         gLiveSupport->getWindowPosition(uploadFileWindow);  
    414 418         uploadFileWindow->show();  
    415 419     } else {  
      420         gLiveSupport->putWindowPosition(uploadFileWindow);  
    416 421         uploadFileWindow->hide();  
    417 422     }  
     
    433 438             return;  
    434 439         }  
    435    
    436 440         scratchpadWindow.reset(new ScratchpadWindow(gLiveSupport, bundle));  
      441         gLiveSupport->getWindowPosition(scratchpadWindow);  
    437 442     }  
    438 443  
     
    440 445  
    441 446     if (!scratchpadWindow->is_visible()) {  
      447         gLiveSupport->getWindowPosition(scratchpadWindow);  
    442 448         scratchpadWindow->show();  
    443 449     }  
     
    462 468         simplePlaylistMgmtWindow.reset(  
    463 469                 new SimplePlaylistManagementWindow(gLiveSupport, bundle));  
      470         gLiveSupport->getWindowPosition(simplePlaylistMgmtWindow);  
    464 471     }  
    465 472      
     
    467 474      
    468 475     if (!simplePlaylistMgmtWindow->is_visible()) {  
      476         gLiveSupport->getWindowPosition(simplePlaylistMgmtWindow);  
    469 477         simplePlaylistMgmtWindow->show();  
    470 478     }  
     
    490 498  
    491 499         schedulerWindow.reset(new SchedulerWindow(gLiveSupport, bundle));  
      500         gLiveSupport->getWindowPosition(schedulerWindow);  
    492 501     }  
    493 502      
     
    499 508  
    500 509     if (!schedulerWindow->is_visible()) {  
      510         gLiveSupport->getWindowPosition(schedulerWindow);  
    501 511         schedulerWindow->show();  
    502 512     }  
     
    520 530  
    521 531         searchWindow.reset(new SearchWindow(gLiveSupport, bundle));  
      532         gLiveSupport->getWindowPosition(searchWindow);  
    522 533     }  
    523 534  
    524 535     if (!searchWindow->is_visible()) {  
      536         gLiveSupport->getWindowPosition(searchWindow);  
    525 537         searchWindow->show();  
    526 538     }  
    543 555      
    544 556     if (liveModeWindow.get()) {  
    545           liveModeWindow->hide();  
      557         if (liveModeWindow->is_visible()) {  
      558             gLiveSupport->putWindowPosition(liveModeWindow);  
      559             liveModeWindow->hide();  
      560         }  
    546 561         liveModeWindow.reset();  
    547 562     }  
    548 563     if (uploadFileWindow.get()) {  
    549           uploadFileWindow->hide();  
      564         if (uploadFileWindow->is_visible()) {  
      565             gLiveSupport->putWindowPosition(uploadFileWindow);  
      566             uploadFileWindow->hide();  
      567         }  
    550 568         uploadFileWindow.reset();  
    551 569     }  
    552 570     if (scratchpadWindow.get()) {  
    553           scratchpadWindow->hide();  
      571         if (scratchpadWindow->is_visible()) {  
      572             gLiveSupport->putWindowPosition(scratchpadWindow);  
      573             scratchpadWindow->hide();  
      574         }  
    554 575         scratchpadWindow.reset();  
    555 576     }  
    556 577     if (simplePlaylistMgmtWindow.get()) {  
    557           simplePlaylistMgmtWindow->hide();  
      578         if (simplePlaylistMgmtWindow->is_visible()) {  
      579             gLiveSupport->putWindowPosition(simplePlaylistMgmtWindow);  
      580             simplePlaylistMgmtWindow->hide();  
      581         }  
    558 582         simplePlaylistMgmtWindow.reset();  
    559 583     }  
    560 584     if (schedulerWindow.get()) {  
    561           schedulerWindow->hide();  
      585         if (schedulerWindow->is_visible()) {  
      586             gLiveSupport->putWindowPosition(schedulerWindow);  
      587             schedulerWindow->hide();  
      588         }  
    562 589         schedulerWindow.reset();  
    563 590     }  
    564 591     if (searchWindow.get()) {  
    565           searchWindow->hide();  
      592         if (searchWindow->is_visible()) {  
      593             gLiveSupport->putWindowPosition(searchWindow);  
      594             searchWindow->hide();  
      595         }  
    566 596         searchWindow.reset();  
    567 597     }  
  • trunk/livesupport/src/products/gLiveSupport/src/ScratchpadWindow.cxx

    r1776 r1869  
    688 688 }  
    689 689  
      690  
      691 /*------------------------------------------------------------------------------  
      692  *  The event when the close button has been clicked.  
      693  *----------------------------------------------------------------------------*/  
      694 void  
      695 ScratchpadWindow :: onCloseButtonClicked(void)                  throw ()  
      696 {  
      697     gLiveSupport->putWindowPosition(shared_from_this());  
      698     hide();  
      699 }  
      700  
  • trunk/livesupport/src/modules/widgets/include/LiveSupport/Widgets/WhiteWindow.h

    r1601 r1869  
    99 99  *  @see WidgetFactory#getWhiteWindowCorners  
    100 100  */  
    101   class WhiteWindow : public Gtk::Window  
      101 class WhiteWindow : public Gtk::Window,  
      102                     public boost::enable_shared_from_this<WhiteWindow>  
    102 103 {  
    103 104     private: