//---------------------------------------------------------------------------- // $Id: SlotQtDlg.cpp,v 1.291 2011/08/03 22:11:31 lynn Exp $ //---------------------------------------------------------------------------- //+class // // CLASS: // SlotQtDlg : BaseQtMainWin // // DESCRIPTION: // Dialog to view, reconfigure, and edit the values of the any of the // following types of Slots: // // SeriesSlot // AggSeriesSlot // MultiSlot // TableSlot // TableSeriesSlot // PeriodicSlot -- Added May 2008 // SeriesSlot with RPL Expression -- Added June 2009 // // SUPPORING WIDGETS: // QtGUI / SlotQDlgTable _slotDataTable // QtUtils / PartialDateTimeEditor _partialDateTimeEditor; // QtUtils / DisplayCompressPanel _dispCompressPanel; // QtUtils / DescriptDisplayPanel _descDispPanel // QtRpl / RplFrame _rplFrame; // QtRpl / RowOToggles _rplToggles; // QtRpl / RowOToggles _descToggles; // // CHILD DIALOGS: // QtGUI/ SlotConfigQtDlg : Slot Configuration // QtGUI/ PeriodicSlotCfg : Periodic Slot Configuration // QtGUI/ SlotTimeseriesRangeQtDlg : Slot Timeseries Range // QtGUI/ RowColLabelEditor : Row / Column Label Editor // //---------------------------------------------------------------------------- // Module configuration static const bool CALLBACK_DEBUG (false); static const bool ENA_SEL_STATS_FOR_ALL_SLOTS (false); // development static const bool SCROLL_BUTTON_USES_ICON (false); // development static const bool DT_SPIN_USE_3LETTER_MONTHS (true); static const bool DESCRIPT_SUPPORT_ON_ALL_SLOTS (true); static const bool SHOW_DESCRIPTION_PANEL_CONTROLS (false); static const bool SHOW_SHOW_DESCRIPT_PUSHBUTTON_DEMO (false); // We're deciding to _not_ include the "Show Commas in Numbers" checkbox in // the view menu of the Slot dialogs, because it is a _global_ toggle. // (But I think we still could choose to include it there). [Phil 11-8-2010]. static const bool SHOW_SHOW_COMMA_SEPS_TOGGLE (false); /// Environment Variable Symbols static const char* RW_ENA_OPEN_SLOT_TESTS ("RW_ENA_OPEN_SLOT_TESTS"); #ifndef SlotQtDlgINCLUDED #include "SlotQtDlg.hpp" #endif #ifndef RwQt3UtilsINCLUDED #include "RwQt3Utils.hpp" #endif #ifndef RwQPixmap11INCLUDED #include "RwQPixmap11.hpp" #endif #ifndef RwQPixmap16INCLUDED #include "RwQPixmap16.hpp" #endif #ifndef PlotDialogINCLUDED #include "PlotDialog.hpp" #endif #ifndef DateTimeQtSpinnerINCLUDED #include "DateTimeQtSpinner.hpp" #endif #ifndef SlotQDlgTableINCLUDED #include "SlotQDlgTable.hpp" #endif #ifndef ObjAcctSumSelINCLUDED #include "ObjAcctSumSel.hpp" #endif #ifndef AcctOrderPanelINCLUDED #include "AcctOrderPanel.hpp" #endif #ifndef TimeStepSelPanelINCLUDED #include "TimeStepSelPanel.hpp" #endif #ifndef ObjAcctSumSaveDlgINCLUDED #include "ObjAcctSumSaveDlg.hpp" #endif #ifndef SlotQDlgSelStatFrameINCLUDED #include "SlotQDlgSelStatFrame.hpp" #endif #ifndef RplDlgMgrINCLUDED #include "RplDlgMgr.hpp" #endif #ifndef RplFrameINCLUDED #include "RplFrame.hpp" #endif #ifndef RplExprSlotMgrINCLUDED #include "RplExprSlotMgr.hpp" #endif #ifndef RplPrinterINCLUDED #include "RplPrinter.hpp" #endif #ifndef SlotConfigQtDlgINCLUDED #include "SlotConfigQtDlg.hpp" #endif #ifndef PeriodicSlotCfgINCLUDED #include "PeriodicSlotCfg.hpp" #endif #ifndef SlotTimeseriesRangeQtDlgINCLUDED #include "SlotTimeseriesRangeQtDlg.hpp" #endif #ifndef SpecifyDimsDlgINCLUDED #include "SpecifyDimsDlg.hpp" #endif #ifndef RowColLabelEditorINCLUDED #include "RowColLabelEditor.hpp" #endif #ifndef LinkedSlotsPopupMenuINCLUDED #include "LinkedSlotsPopupMenu.hpp" #endif #ifndef AcctCellColorLegendINCLUDED #include "AcctCellColorLegend.hpp" #endif #ifndef PartialDateTimeEditorINCLUDED #include "PartialDateTimeEditor.hpp" #endif #ifndef ExchBalanceKeyTreeWidgetINCLUDED #include "ExchBalanceKeyTreeWidget.hpp" #endif #ifndef DescriptDisplayPanelINCLUDED #include "DescriptDisplayPanel.hpp" #endif #ifndef QGuiINCLUDED #include "QGui.hpp" #endif #ifndef AnnoDefsINCLUDED #include "AnnoDefs.hpp" #endif #ifndef AnnoMgrINCLUDED #include "AnnoMgr.hpp" #endif #ifndef AnnoNoteAssocINCLUDED #include "AnnoNoteAssoc.hpp" #endif #ifndef AnnoCallbackDataINCLUDED #include "AnnoCallbackData.hpp" #endif #ifndef NoteGroupMgrDlgINCLUDED #include "NoteGroupMgrDlg.hpp" #endif #ifndef NoteQtUtilsINCLUDED #include "NoteQtUtils.hpp" #endif #ifndef SctDialogINCLUDED #include "SctDialog.hpp" #endif #ifndef AccountMgrDlgINCLUDED #include "AccountMgrDlg.hpp" #endif #ifndef AccountingSysConfigDlgINCLUDED #include "AccountingSysConfigDlg.hpp" #endif #ifndef SupplyMgrDlgINCLUDED #include "SupplyMgrDlg.hpp" #endif #ifndef ExchangeMgrDlgINCLUDED #include "ExchangeMgrDlg.hpp" #endif #ifndef DisplayCompressPanelINCLUDED #include "DisplayCompressPanel.hpp" #endif #ifndef rwQSpacersINCLUDED #include "rwQSpacers.hpp" #endif #ifndef RwPushButtonINCLUDED #include "RwPushButton.hpp" #endif #ifndef RwTimeScrollButtonINCLUDED #include "RwTimeScrollButton.hpp" #endif #ifndef QtAcctGuiMgrINCLUDED #include "QtAcctGuiMgr.hpp" #endif #ifndef DlgGeometryMgrINCLUDED #include "DlgGeometryMgr.hpp" #endif #include "RplExpressionMenu.hpp" #include "RowOToggles.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ======================= // End of Qt include files #undef slots // ======================= #ifndef cwfpointerINCLUDED #include "cwfpointer.h" #endif #ifndef cwFileINCLUDED #include "cwFile.hpp" #endif #ifndef cwEnvINCLUDED #include "cwEnv.hpp" #endif #ifndef rwErrorINCLUDED #include "rwError.hpp" #endif #ifndef SlotGUIUtilsINCLUDED #include "SlotGUIUtils.hpp" #endif #ifndef SlotINCLUDED #include "Slot.hpp" #endif #ifndef AggSeriesSlotINCLUDED #include "AggSeriesSlot.hpp" #endif #ifndef MultiSlotINCLUDED #include "MultiSlot.hpp" #endif #ifndef AccountMultiSlotINCLUDED #include "AccountMultiSlot.hpp" #endif #ifndef TableSlotINCLUDED #include "TableSlot.hpp" #endif #ifndef TableSeriesSlotINCLUDED #include "TableSeriesSlot.hpp" #endif #ifndef PeriodicSlotINCLUDED #include "PeriodicSlot.hpp" #endif #ifndef SimObjINCLUDED #include "SimObj.hpp" #endif #ifndef ExchangeINCLUDED #include "Exchange.hpp" #endif #ifndef AcctSlotSummaryINCLUDED #include "AcctSlotSummary.hpp" #endif #ifndef guiUtilsINCLUDED #include "guiUtils.hpp" #endif #ifndef SlotDialogManagerINCLUDED #include "SlotDialogManager.hpp" #endif #ifndef UnitMgrINCLUDED #include "UnitMgr.hpp" #endif #ifndef ControllerINCLUDED #include "Controller.hpp" #endif #ifndef cwFormatINCLUDED #include "cwFormat.hpp" #endif #ifndef cwstrstreamINCLUDED #include "cwsstream.hpp" #endif #ifndef PartialDateTimeINCLUDED #include "PartialDateTime.hpp" #endif #ifndef PartialDateTimeEncoderINCLUDED #include "PartialDateTimeEncoder.hpp" #endif #ifndef cwExceptINCLUDED #include "cwExcept.hpp" #endif #ifndef cwReturnStatusINCLUDED #include "cwReturnStatus.hpp" #endif #ifndef RplDebuggerINCLUDED #include "RplDebugger.hpp" #endif #include "rwStr.hpp" //============================================================================ // Static Data Members //============================================================================ int SlotQtDlg::_instanceCnt (0); QString SlotQtDlg::_importExportSlotPath (""); int SlotQtDlg::_resizedHeight_Series (300); int SlotQtDlg::_resizedHeight_NonSeries (300); int SlotQtDlg::_resizedHeight_AcctSum (500); std::list SlotQtDlg::_acctSumDlgList; std::list SlotQtDlg::_editAcctDlgList; std::list SlotQtDlg::_exchBalDlgList; //============================================================================ // Constructors and Destructors //============================================================================ //---------------------------------------------------------------------------- //+public // // METHOD: // SlotQtDlg::SlotQtDlg (Root *rootObj, // BaseRWDlg *parent) // // PURPOSE: // Constructs a Slot dialog for the given SeriesSlot, AggSeriesSlot, // MultiSlot, TableSlot, or TableSeriesSlot. // // PARAMETERS: // (I/O) root - The Slot or Account to be shown/editted in the dialog // (I) parent - Parent dialog // //---------------------------------------------------------------------------- SlotQtDlg::SlotQtDlg (Root *root, BaseRWDlg *parent) : BaseQtMainWin (parent), DescriptDisplayPanel_Listener(), PeriodicSlotCfgListener(), _instanceNum (++_instanceCnt), _appMode (SQD_APP_MODE_UND), _scrollDateSpinner (NULL), _scrollAnnoPushButton (NULL), _scrollAnnoPopupMenu (NULL), _unitTypeFlowPushButton (NULL), _plotPushButton (NULL), _displayCompressPushButton (NULL), _showDescriptPushButton (NULL), _slot (dynamic_cast (root)), _slotAcct (_slot ? _slot->getAccount() : NULL), _account (dynamic_cast (root)), _exchange (dynamic_cast (root)), _simObj (dynamic_cast (root)), _isSeriesSlot (false), // computed below _isRplExprSeriesSlot (false), // computed below _isAggSeriesSlot (false), // computed below _isMultiSlot (false), // computed below _isTableSlot (false), // computed below _isTableSeriesSlot (false), // computed below _isPeriodicSlot (false), // computed below _isPhysSlot (false), // computed below _isAcctSlot (false), // computed below _isSplySlot (false), // computed below _seriesMode (false), // computed below _exchBalMode (false), // computed below _isSlotOnDataObj (false), // computed below _selStatsSupported (false), // computed below _timeColMode (false), _disableModelEditCalled (false), _adjustMenuSensitizeNeeded (true), _shipGoingDown (false), _noteGroupsMenuGroupNames(), _scrollAnnoPopupMenuAbsSecs(), _seriesDisplayCompressSpec(), _slotCallbacks(), _acctCallback (NULL), _exchCallback (NULL), _annoCallback (NULL), _runInfoCallback (NULL), _simWsCallback (NULL), _rwSystemCallback (NULL), _installNewAcctSlotSummary_inProgress (false), _schedResizeOptimalTimer (NULL), _serviceSlotDataChangeTimer (NULL), _serviceSlotDataChangeReschedCount (0), _tableTopCtrlFrame (NULL), _tableTopCtrlFrameLayout (NULL), _rplFrame (NULL), _rplToggles (NULL), _rplTogglesIndex_comments (-1), _undoStack(), _rplEvalSettingPanel (NULL), _rplEvalGrid (NULL), _rplEvalTimeTitleLabel (NULL), _rplEvalTimeValueLabel (NULL), _rplEvalRangeTitleLabel (NULL), _rplEvalRangeValueLabel (NULL), _slotDataTableFrame (NULL), _slotDataTableStack (NULL), _slotDataTable_timeColMode (NULL), _slotDataTable_slotColMode (NULL), _slotDataTable (NULL), _descDispBox (NULL), _descToggles (NULL), _descTogglesIndex_desc (-1), _descDispPanel (NULL), _scrollControlFrame (NULL), _scrollControlFrameLayout (NULL), _dispCompressPanel (NULL), _objAcctSumSel (NULL), _acctOrderPanel (NULL), _tstepSelPanel (NULL), _selStatFrame (NULL), _acctSlotSum (NULL), _objAcctSumSaveDlg (NULL), _exchBalKeyTreeWidget (NULL), _periodicSlotBottomWidgets (NULL), _periodicInterpButtonGroup (NULL), _periodicInterpRadioBut (NULL), _periodicLookupRadioBut (NULL), _periodicTextLabel (NULL), _menubar (NULL), _fileMenu (NULL), _editMenu (NULL), _rowMenu (NULL), _columnMenu (NULL), _viewMenu (NULL), _timestepMenu (NULL), _evalMenu (NULL), _evalTimeMenu (NULL), _rplExprMenu (NULL), _configMenu (NULL), _adjustMenu (NULL), _importResizeMenu (NULL), _importFixedSizeMenu (NULL), _exportDispPrecMenu (NULL), _exportModelPrecMenu (NULL), _sctMenu (NULL), _linkedSlotsPopupMenu (NULL), _noteGroupsMenu (NULL), _configMenuAcctSlotSumVector(), _importResizeAction (NULL), _importFixedSizeAction (NULL), _exportDispPrecAction (NULL), _exportModelPrecAction (NULL), _importResizeSelColAction (NULL), _importFixedSizeSelColAction (NULL), _exportDispPrecSelColAction (NULL), _exportModelPrecSelColAction (NULL), _plotAction (NULL), _exprPrintAction (NULL), _addToNewSctAction (NULL), _addToOpenSctAction (NULL), _showWorkspaceAction (NULL), _closeWindowAction (NULL), _cutAction (NULL), _copyAction (NULL), _pasteAction (NULL), _pasteAsInputAction (NULL), _exportCopyAction (NULL), _importPasteAction (NULL), _insertRowCopyAction (NULL), _insertRowNewAction (NULL), _appendRowAction (NULL), _deleteRowsAction (NULL), _deleteRowsBelowAction (NULL), _clearAllOutputsAction (NULL), _fillBelowAction (NULL), _replaceNansBelowAction (NULL), _interpolateAction (NULL), _adjustValuesAction (NULL), _clearAction (NULL), _setNumBlocksAction (NULL), _insertTableColAction (NULL), _appendBlockAction (NULL), _deleteBlockAction (NULL), _deleteLastBlockAction (NULL), _setDimensionsAction (NULL), _setColumnValueAction (NULL), _maxSyncAction (NULL), _syncToColumn0Action (NULL), _slotTest1Action (NULL), _slotTest2Action (NULL), _slotTest3Action (NULL), _configureAction (NULL), _seriesRangeAction (NULL), _columnLabelsAction (NULL), _rowLabelsAction (NULL), _showColSumRowAction (NULL), _showPrioritiesAction (NULL), _showNotesColAction (NULL), _showCommaSepsAction (NULL), _showDispCompAction (NULL), _showSelStatsAction (NULL), _editAnnoGroupAction (NULL), _showExpressionAction (NULL), _addDescriptionAction (NULL), _showDescriptionAction (NULL), _setInputSelAction (NULL), _setInputAllAction (NULL), _setOutputSelAction (NULL), _setOutputAllAction (NULL), _clearSelNonInputsAction (NULL), _clearSelValuesAction (NULL), _clearAllValuesAction (NULL), _reverseIOAction (NULL), _reverseIOAllAction (NULL), _setTargetBeginAction (NULL), _setTargetAction (NULL), _setBestEfficiencyAction (NULL), _setMaxCapacityAction (NULL), _setUnitValuesFlagAction (NULL), _setDriftAction (NULL), _openAccountsMgrAction (NULL), _openSuppliesMgrAction (NULL), _openExchangesMgrAction (NULL), _acctSysConfigAction (NULL), _useAcctColorsAction (NULL), _showAcctLegendAction (NULL), _configSaveAsAction (NULL), _growColsToDataAction (NULL), _fitColsToHeadAction (NULL), _fitColsToDataAction (NULL), _fitColsToAllAction (NULL), _setColWidthsAction (NULL), _perioSlot_SetRowDate (NULL), _perioSlot_AddRow (NULL), _perioSlot_DupRow (NULL), _perioSlot_DelRows (NULL), _perioSlot_AddColumn (NULL), _perioSlot_DupColumn (NULL), _perioSlot_DelColumn (NULL), _slotNameHBox (NULL), _acctIconButton (NULL), _slotNameLabel (NULL), _slotNameEdit (NULL), _colMapEntityDispLabel (NULL), _partialDateTimeEditor (NULL), _bottomOptionsFrame (NULL), _showEmptySlotsFrame (NULL), _showSubslotsFrame (NULL), _showEmptySlotsHLine (NULL), _showEmptySlotsCheckBox (NULL), _showSuppliesCheckBox (NULL), _showSubslotsCheckBox (NULL) { static const char (*mname) ("SlotQtDlg ctor"); QString dlgName ("SlotQtDlg"); setAttribute (Qt::WA_DeleteOnClose, true); setAttribute (Qt::WA_AlwaysShowToolTips); if (_slot) { _appMode = SQD_APP_MODE_OPEN_SLOT; _simObj = _slot->getSimObj(); if ((_simObj == NULL) && (_slotAcct != NULL)) { _simObj = _slotAcct->getSimObj(); } _seriesMode = SlotGUIUtils::hasSeries (_slot); // [Phil, 8-2-2008]: Working on getting this working on TableSlots too. _selStatsSupported = _seriesMode || ENA_SEL_STATS_FOR_ALL_SLOTS; dlgName.sprintf ("SlotQtDlg %s", qPrintable(_slot->getCompleteName())); // Record Slot pointer with the BaseRWDlg base class setDlgSlot (_slot); setDlgAccount (_slot->getAccount()); // may be NULL setDlgSimObj (_simObj); // may be NULL // Initialize the Display Compression Spec settings from the Slot const DisplayCompressSpec* slotSpec = _slot->displayCompressSpec(); if (slotSpec) _seriesDisplayCompressSpec = *slotSpec; } else if (_account) { _appMode = SQD_APP_MODE_ACCT_EDIT; _simObj = _account->getSimObj(); _seriesMode = true; _selStatsSupported = true; dlgName.sprintf ("SlotQtDlg %s", qPrintable(_account->getCompleteName())); setDlgAccount (_account); setDlgSimObj (_simObj); _editAcctDlgList.push_back (this); AccountMgrDlg::updateDlg (_account); } else if (_exchange) { _appMode = SQD_APP_MODE_EXCH_BAL; _seriesMode = true; _exchBalMode = true; _selStatsSupported = true; dlgName.sprintf ("SlotQtDlg %s", qPrintable(_exchange->getCompleteName())); _exchBalDlgList.push_back (this); } else if (_simObj) { // This case is active only if the _simObj field was reassigned initially // from the dyanmic cast of the Root parameter. _appMode = SQD_APP_MODE_OBJ_ACCT_SUM; // Assign new dynamic instance to _acctSlotSum installNewAcctSlotSummary (_simObj->getAnyAcctSlotSummary()); if (rwAssert (_acctSlotSum != NULL)) { _seriesMode = true; _selStatsSupported = true; } setDlgSimObj (_simObj); _acctSumDlgList.push_back (this); // *** Temporary Diagnostics *** // _simObj->acctSlotSummaryMap_diagDump(); } setName (dlgName); // QObject setDlgName (dlgName.ascii()); // BaseRWDlg _isSeriesSlot = (dynamic_cast (_slot) != NULL); _isAggSeriesSlot = (dynamic_cast (_slot) != NULL); _isMultiSlot = (dynamic_cast (_slot) != NULL); _isTableSlot = (dynamic_cast (_slot) != NULL); _isTableSeriesSlot = (dynamic_cast (_slot) != NULL); _isPeriodicSlot = (dynamic_cast (_slot) != NULL); _isPhysSlot = (_slot && _slot->isManagedBySimObj()); _isAcctSlot = (_account || (_slot && _slot->isManagedByAccount())); _isSplySlot = (_slot && _slot->isManagedBySupply()); _isSlotOnDataObj = (_slot && _slot->getSimObj() && _slot->getSimObj()->isDataObj()); _isRplExprSeriesSlot = _isSeriesSlot && _slot && _slot->computedByExpr(); createActions(); buildQtWidgets (NULL, dlgName.ascii()); buildMenus(); // Qt Settings enableDestructiveClose(); languageChange(); resize (minimumSizeHint()); initWidgets(); initConnections(); sensitizeScrollAnnoMenu(); setScrollAnnoPushButtonIcon(); addCallbacks(); // register for notifications from SlotQDlgTable if (rwAssert (_slotDataTable_timeColMode != NULL)) { _slotDataTable_timeColMode->registerSlotQtDlg (this); _slotDataTable_timeColMode->setMainLineEditWidget (_slotValueEdit); _slotDataTable_timeColMode-> setPartialDateTimeEditor (_partialDateTimeEditor); _slotDataTable_timeColMode->setUnitsLabelWidget (_slotUnitLabel); _slotDataTable_timeColMode->setDateTimeQtSpinnerWidget ( _scrollDateSpinner); _slotDataTable_timeColMode->initializeSelection(); _slotDataTable_timeColMode->growColsToData_handler(); } // register for notifications from SlotQDlgTable if (rwAssert (_slotDataTable_slotColMode != NULL)) { _slotDataTable_slotColMode->registerSlotQtDlg (this); _slotDataTable_slotColMode->setMainLineEditWidget (_slotValueEdit); _slotDataTable_slotColMode-> setPartialDateTimeEditor (_partialDateTimeEditor); _slotDataTable_slotColMode->setUnitsLabelWidget (_slotUnitLabel); _slotDataTable_slotColMode->setDateTimeQtSpinnerWidget ( _scrollDateSpinner); _slotDataTable_slotColMode->initializeSelection(); // If just a single column, grow to fit data AND header text. const int colCnt (_slotDataTable_slotColMode->numCols()); if (colCnt == 1) { _slotDataTable_slotColMode->growColsToHeader_handler(); } _slotDataTable_slotColMode->growColsToData_handler(); } // Trigger Object Account Summary computation if (_objAcctSumSel) { _objAcctSumSel->setConfig (_acctSlotSum); } installSlotDataTable (_acctSlotSum); // Set height to at least the height of a recently resized SlotQtDlg, // distinct for series-like Slots vs. non-series-like Slots. // QSize curSize (size()); int recentHgt (_resizedHeight_AcctSum); if (_appMode != SQD_APP_MODE_OBJ_ACCT_SUM) { recentHgt = (_seriesMode ? _resizedHeight_Series : _resizedHeight_NonSeries); } if (recentHgt > curSize.height()) { curSize.setHeight (recentHgt); // std::cout << mname << " resize (" << curSize.width() << "," // << curSize.height() << ")" << std::endl; resize (curSize); } if (_dispCompressPanel) { // Initialize Display Compression mechanism const bool specFixup = _dispCompressPanel->setCompressionSpec (_seriesDisplayCompressSpec); if (specFixup) { const DisplayCompressSpec fixupSpec = _dispCompressPanel->compressionSpecRef(); const bool doUpdateSlot (fixupSpec.panelShown() && _slot); // std::cout << mname << " DisplayCompressSpec Fixup" // << (doUpdateSlot ? " (Update Slot)" : "") // << std::endl; _seriesDisplayCompressSpec = fixupSpec; if (doUpdateSlot) { // Assign fixed-up series display compression spec to Slot. _slot->setDisplayCompressSpec (fixupSpec); } schedResizeOptimal(); } } if (_acctOrderPanel) { _acctOrderPanel->updateAcctList (_acctSlotSum); } if (_tstepSelPanel) { _tstepSelPanel->updateTstepList (_acctSlotSum); } sensitizePrioritiesRelevant (true); // enable force on } //---------------------------------------------------------------------------- // protected // // METHOD: // void initWidgets() // // PURPOSE: // Initializes the dialogs widgets to correspond to the current settings of // the slot to be edited. // //---------------------------------------------------------------------------- void SlotQtDlg::initWidgets() { // prepare SeriesSlot pointer, may be NULL. //SeriesSlot (*sslot) (dynamic_cast (_slot)); unit_type primSlotUnitType (SlotGUIUtils::getUnitType (_slot, -1, false)); unit_type altSlotUnitType (SlotGUIUtils::getUnitType (_slot, -1, true)); // We're not using the native status bar statusBar()->setShown (false); // Set Object Icon from type of slot's Object. RwQtUtils::setQButtonIconForSimObj (_objectIconButton, _simObj); if ((_acctIconButton != NULL) && (_slotAcct != NULL)) { _acctIconButton->setPixmap ( RwQtUtils::getQPixmapIcon14ForAccount (_slotAcct)); _acctIconButton->setText (QString::null); QToolTip::remove (_acctIconButton); QToolTip::add (_acctIconButton, qPrintable(_slotAcct->getCompleteName())); } if (_slotNameLabel != NULL) { // Set Slot Type Icon for slot's type if (_slot != NULL) { _slotNameLabel->setPixmap (RwQtUtils::getQPixmapIconForSlot (_slot)); _slotNameLabel->setText (QString::null); _slotNameLabel->setShown (true); QToolTip::remove (_slotNameLabel); QToolTip::add (_slotNameLabel, qPrintable(_slot->getCompleteName())); } else if (_account != NULL) { _slotNameLabel->setPixmap ( RwQtUtils::getQPixmapIcon14ForAccount (_account)); _slotNameLabel->setText (QString::null); _slotNameLabel->setShown (true); QToolTip::remove (_slotNameLabel); // Note: The Account Name is already shown in the QLineEdit. // QToolTip::add (_slotNameLabel, _account->getCompleteName()); QToolTip::add (_slotNameLabel, _account->getType()); } else if (_exchange != NULL) { _slotNameLabel->setPixmap (QPixmap()); // Null QPixmap _slotNameLabel->setText ("Exchange:"); _slotNameLabel->setShown (true); } else { _slotNameLabel->setShown (false); } } // Enable full editing for slots on data objects const bool onDataObj (_simObj && _simObj->isDataObj()); if (_slotNameEdit != NULL) { _slotNameEdit->setReadOnly (!onDataObj); } // Configure the slot data table _slotDataTable->setMainLineEditWidget (_slotValueEdit); _slotDataTable->setPartialDateTimeEditor (_partialDateTimeEditor); _slotDataTable->setUnitsLabelWidget (_slotUnitLabel); // Note: _scrollDateSpinner may be NULL (e.g. for a regular Table Slot). _slotDataTable->setDateTimeQtSpinnerWidget (_scrollDateSpinner); if (_tstepSelPanel != NULL) { _tstepSelPanel->setDateTimeQtSpinnerWidget (_scrollDateSpinner); } if (_scrollDateSpinner && _scrollDatePushButton) { _scrollDatePushButton->setDateTimeQtSpinner (_scrollDateSpinner); } bool preferFlowUnits (true); // tentative if (_slot) { _slotDataTable->setGeneratorSlot (_slot); _partialDateTimeEditor->configure (_slot); preferFlowUnits = (primSlotUnitType == FLOW); } else if (_account) { _slotDataTable->setGeneratorAccount (_account); _partialDateTimeEditor->configure (NULL); } else if (_exchange) { _slotDataTable->setGeneratorExchange (_exchange); _exchBalKeyTreeWidget->setExchange (_exchange); _partialDateTimeEditor->configure (NULL); } else if (_acctSlotSum) { installSlotDataTable (_acctSlotSum); _partialDateTimeEditor->configure (NULL); if (_acctOrderPanel) { _acctOrderPanel->updateAcctList (_acctSlotSum); } if (_tstepSelPanel) { _tstepSelPanel->updateTstepList (_acctSlotSum); } } else { _slotDataTable->recomputeCellLayout (0); // change serial number } // Condition Flow/Vol button. if (_exchange) { unitTypeFlowPushButtonToggled (false); _unitTypeFlowPushButton ->setShown (false); } else if (_isAcctSlot || (_acctSlotSum != NULL)) { if (_slot && (altSlotUnitType == NOUNITS)) { _unitTypeFlowPushButton ->setShown (false); } else if (_acctSlotSum && !_acctSlotSum->acctSlotDomainListUsesAltUnits()) { _unitTypeFlowPushButton ->setShown (false); } else { unitTypeFlowPushButtonToggled (preferFlowUnits); _unitTypeFlowPushButton ->setShown (true); } } else { _unitTypeFlowPushButton ->setShown (false); } initDateTime(); bool useScrollFrame (false); // tentative switch (_appMode) { case SQD_APP_MODE_OPEN_SLOT: useScrollFrame = SlotGUIUtils::hasSeries (_slot); break; case SQD_APP_MODE_ACCT_EDIT: case SQD_APP_MODE_OBJ_ACCT_SUM: case SQD_APP_MODE_EXCH_BAL: useScrollFrame = true; break; } if (!useScrollFrame && _scrollControlFrame) { _scrollControlFrame->setShown(false); } // Update the text of the begin/end "block" for this controller updateRplEvalTime(); updateRplSeriesRange(); controllerChangedHandler(); refreshObjectName(); refreshPeriodicSlotBottomWidgets(); initShowEmptySlotsCheckBox(); initShowSuppliesCheckBox(); refreshBottomOptionsFrame(); const TableSlot* tslot (dynamic_cast (_slot)); const bool hasColMap (tslot && tslot->hasColumnMap()); if (hasColMap) { refreshColMapEntityName(); } if ( !rwSystem->modelEditIsAllowed() || (_slot && _slot->isScenario()) || rwWorkspace->isBaselineModel() ) { disableModelEdit(); } // *************************** // *** Not Yet Implemented *** // *************************** if (_showSuppliesCheckBox != NULL) { _showSuppliesCheckBox->setShown (false); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::createActions() { // actions _importResizeAction = new QAction (this, "_importResizeAction"); _importFixedSizeAction = new QAction (this, "_importFixedSizeAction"); _exportDispPrecAction = new QAction (this, "_exportDispPrecAction"); _exportModelPrecAction = new QAction (this, "_exportModelPrecAction"); _importResizeSelColAction = new QAction (this, "_importResizeSelColAction"); _importFixedSizeSelColAction = new QAction (this, "_importFixedSizeSelColAction"); _exportDispPrecSelColAction = new QAction (this, "_exportDispPrecSelColAction"); _exportModelPrecSelColAction = new QAction (this, "_exportModelPrecSelColAction"); _plotAction = new QAction (this, "_plotAction"); _exprPrintAction = new QAction (this, "_exprPrintAction"); _addToNewSctAction = new QAction (this, "_addToNewSctAction"); _addToOpenSctAction = new QAction (this, "_addToOpenSctAction"); _showWorkspaceAction = new QAction (this, "_showWorkspaceAction"); _closeWindowAction = new QAction (this, "_closeWindowAction"); _cutAction = new QAction (this, "_cutAction"); _copyAction = new QAction (this, "_copyAction"); _pasteAction = new QAction (this, "_pasteAction"); _pasteAsInputAction = new QAction (this, "_pasteAsInputAction"); _exportCopyAction = new QAction (this, "_exportCopyAction"); _importPasteAction = new QAction (this, "_importPasteAction"); _insertRowCopyAction = new QAction (this, "_insertRowCopyAction"); _insertRowNewAction = new QAction (this, "_insertRowNewAction"); _appendRowAction = new QAction (this, "_appendRowAction"); _deleteRowsAction = new QAction (this, "_deleteRowsAction"); _deleteRowsBelowAction = new QAction (this, "_deleteRowsBelowAction"); _clearAllOutputsAction = new QAction (this, "_clearAllOutputsAction"); _fillBelowAction = new QAction (this, "_fillBelowAction"); _replaceNansBelowAction = new QAction (this, "_replaceNansBelowAction"); _interpolateAction = new QAction (this, "_interpolateAction"); _adjustValuesAction = new QAction (this, "_adjustValuesAction"); _clearAction = new QAction (this, "_clearAction"); _setNumBlocksAction = new QAction (this, "_setNumBlocksAction"); _insertTableColAction = new QAction (this, "_insertTableColAction"); _appendBlockAction = new QAction (this, "_appendBlockAction"); _deleteBlockAction = new QAction (this, "_deleteBlockAction"); _deleteLastBlockAction = new QAction (this, "_deleteLastBlockAction"); _setDimensionsAction = new QAction (this, "_setDimensionsAction"); _setColumnValueAction = new QAction (this, "_setColumnValueAction"); _maxSyncAction = new QAction (this, "_maxSyncAction"); _syncToColumn0Action = new QAction (this, "_syncToColumn0Action"); _slotTest1Action = new QAction (this, "_slotTest1Action"); _slotTest2Action = new QAction (this, "_slotTest2Action"); _slotTest3Action = new QAction (this, "_slotTest3Action"); _configureAction = new QAction (this, "_configureAction"); _seriesRangeAction = new QAction (this, "_seriesRangeAction"); _columnLabelsAction = new QAction (this, "_columnLabelsAction"); _rowLabelsAction = new QAction (this, "_rowLabelsAction"); _showColSumRowAction = new QAction (this, "_showColSumRowAction"); _showColSumRowAction->setToggleAction (true); _showColSumRowAction->setOn (false); _showPrioritiesAction = new QAction (this, "_showPrioritiesAction"); _showPrioritiesAction->setToggleAction (true); _showPrioritiesAction->setOn (false); _showNotesColAction = new QAction (this, "_showNotesColAction"); _showNotesColAction->setToggleAction (true); _showNotesColAction->setOn (false); _showCommaSepsAction = new QAction (this, "_showCommaSepsAction"); _showCommaSepsAction->setToggleAction (true); _showCommaSepsAction->setOn (cwFormat::showNumSeparatorEna()); _showDispCompAction = new QAction (this, "_showDispCompAction"); _showDispCompAction->setToggleAction (true); _showDispCompAction->setOn (false); _showSelStatsAction = new QAction (this, "_showSelStatsAction"); _showSelStatsAction->setToggleAction (true); _showSelStatsAction->setOn (false); _showExpressionAction = new QAction (this, "_showExpressionAction"); _showExpressionAction->setToggleAction (true); _showExpressionAction->setOn (false); _editAnnoGroupAction = new QAction (this, "_editAnnoGroupAction"); _addDescriptionAction = new QAction (this, "_addDescriptionAction"); _showDescriptionAction = new QAction (this, "_showDescriptionAction"); _showDescriptionAction->setToggleAction (true); _showDescriptionAction->setOn (false); _setInputSelAction = new QAction (this, "_setInputSelAction"); _setInputAllAction = new QAction (this, "_setInputAllAction"); _setOutputSelAction = new QAction (this, "_setOutputSelAction"); _setOutputAllAction = new QAction (this, "_setOutputAllAction"); _clearSelNonInputsAction = new QAction (this, "_clearSelNonInputsAction"); _clearSelValuesAction = new QAction (this, "_clearSelValuesAction"); _clearAllValuesAction = new QAction (this, "_clearAllValuesAction"); _reverseIOAction = new QAction (this, "_reverseIOAction"); _reverseIOAllAction = new QAction (this, "_reverseIOAllAction"); _setTargetBeginAction = new QAction (this, "_setTargetBeginAction"); _setTargetAction = new QAction (this, "_setTargetAction"); _setBestEfficiencyAction = new QAction (this, "_setBestEfficiencyAction"); _setMaxCapacityAction = new QAction (this, "_setMaxCapacityAction"); _setUnitValuesFlagAction = new QAction (this, "_setUnitValuesFlagAction"); _setDriftAction = new QAction (this, "_setDriftAction"); _openAccountsMgrAction = new QAction (this, "_openAccountsMgrAction"); _openSuppliesMgrAction = new QAction (this, "_openSuppliesMgrAction"); _openExchangesMgrAction = new QAction (this, "_openExchangesMgrAction"); _acctSysConfigAction = new QAction (this, "_acctSysConfigAction"); _useAcctColorsAction = new QAction (this, "_useAcctColorsAction"); _useAcctColorsAction->setToggleAction (true); _showAcctLegendAction = new QAction (this, "_showAcctLegendAction"); _configSaveAsAction = new QAction (this, "_configSaveAsAction"); _setColWidthsAction = new QAction (this, "_setColWidthsAction"); _growColsToDataAction = new QAction (this, "_growColsToDataAction"); _fitColsToDataAction = new QAction (this, "_fitColsToDataAction"); _fitColsToAllAction = new QAction (this, "_fitColsToAllAction"); _fitColsToHeadAction = new QAction (this, "_fitColsToHeadAction"); _perioSlot_SetRowDate = new QAction (this, "_perioSlot_SetRowDate"); _perioSlot_AddRow = new QAction (this, "_perioSlot_AddRow"); _perioSlot_DupRow = new QAction (this, "_perioSlot_DupRow"); _perioSlot_DelRows = new QAction (this, "_perioSlot_DelRows"); _perioSlot_AddColumn = new QAction (this, "_perioSlot_AddColumn"); _perioSlot_DupColumn = new QAction (this, "_perioSlot_DupColumn"); _perioSlot_DelColumn = new QAction (this, "_perioSlot_DelColumn"); // Note: Disabling QActions on Solaris doesn't seem to change icons // accordingly. So, manage the disabled state of the icon manually. // _setColWidthsAction -> setIconSet (RwQPixmap16::sizeColsCurEna()); _growColsToDataAction -> setIconSet (RwQPixmap16::growColsDataEna()); _fitColsToDataAction -> setIconSet (RwQPixmap16::sizeColsDataEna()); _fitColsToAllAction -> setIconSet (RwQPixmap16::sizeColsAllEna()); _fitColsToHeadAction -> setIconSet (RwQPixmap16::sizeColsHeadEna()); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildMenus() { // menubar _menubar = menuBar(); const TableSlot* tslot (dynamic_cast (_slot)); const bool hasColMap (tslot && tslot->hasColumnMap()); const bool supportsPriorities (_seriesMode); // *********************** // *** Build File Menu *** // *********************** _fileMenu = _menubar -> addMenu (tr ("&File")); if (_isAggSeriesSlot) { _importResizeMenu = _fileMenu -> addMenu (tr ("Import (&Resize)")); _importFixedSizeMenu = _fileMenu -> addMenu (tr ("Import (&Fixed Size)")); _exportDispPrecMenu = _fileMenu -> addMenu (tr ("Export (&Display Precision)")); _exportModelPrecMenu = _fileMenu -> addMenu (tr ("Export (&Model Precision)")); _importResizeMenu -> addAction (_importResizeAction); _importResizeMenu -> addAction (_importResizeSelColAction); _importFixedSizeMenu -> addAction (_importFixedSizeAction); _importFixedSizeMenu -> addAction (_importFixedSizeSelColAction); _exportDispPrecMenu -> addAction (_exportDispPrecAction); _exportDispPrecMenu -> addAction (_exportDispPrecSelColAction); _exportModelPrecMenu -> addAction (_exportModelPrecAction); _exportModelPrecMenu -> addAction (_exportModelPrecSelColAction); } else // (not _isAggSeriesSlot) { _importResizeMenu = NULL; _importFixedSizeMenu = NULL; _exportDispPrecMenu = NULL; _exportModelPrecMenu = NULL; _fileMenu -> addAction (_importResizeAction); _fileMenu -> addAction (_importFixedSizeAction); _fileMenu -> addAction (_exportDispPrecAction); _fileMenu -> addAction (_exportModelPrecAction); } _fileMenu->addSeparator(); //--------- _fileMenu->addAction (_plotAction); if (_isRplExprSeriesSlot) { _fileMenu->addAction (_exprPrintAction); } _sctMenu = _fileMenu -> addMenu (tr ("SCT")); _sctMenu -> addAction (_addToNewSctAction); _sctMenu -> addAction (_addToOpenSctAction); _fileMenu->addSeparator(); //--------- _fileMenu->addAction (_showWorkspaceAction); _fileMenu->addAction (_closeWindowAction); // *********************** // *** Build Edit Menu *** // *********************** const bool useRowColMenus (_isTableSlot); const bool onDataObj (_simObj && _simObj->isDataObj()); const bool showBlockOps (SlotGUIUtils::supportsBlocks(_slot)); const bool showSerSync (_isAggSeriesSlot); const bool showSetDim (onDataObj && _isTableSlot); _editMenu = _menubar -> addMenu (tr ("&Edit")); _editMenu -> addAction (_cutAction); _editMenu -> addAction (_copyAction); _editMenu -> addAction (_pasteAction); _editMenu -> addAction (_pasteAsInputAction); _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_exportCopyAction); _editMenu -> addAction (_importPasteAction); if (!useRowColMenus) { _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_insertRowCopyAction); _editMenu -> addAction (_insertRowNewAction); _editMenu -> addAction (_appendRowAction); _editMenu -> addAction (_deleteRowsAction); _editMenu -> addAction (_deleteRowsBelowAction); } _editMenu -> addSeparator(); //--------- if (_isSeriesSlot || !_slot) { _editMenu -> addAction (_clearAllOutputsAction); } else { _editMenu -> addAction (_clearSelValuesAction); } _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_fillBelowAction); _editMenu -> addAction (_replaceNansBelowAction); _editMenu -> addAction (_interpolateAction); _editMenu -> addAction (_adjustValuesAction); if (!useRowColMenus && showBlockOps) { _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_setNumBlocksAction); _editMenu -> addAction (_insertTableColAction); _editMenu -> addAction (_appendBlockAction); _editMenu -> addAction (_deleteBlockAction); _editMenu -> addAction (_deleteLastBlockAction); } if (showSerSync) { _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_maxSyncAction); _editMenu -> addAction (_syncToColumn0Action); } static const bool enaSlotTestOps (cwTestBoolEnv (RW_ENA_OPEN_SLOT_TESTS)); if (enaSlotTestOps) { _editMenu -> addSeparator(); //--------- _editMenu -> addAction (_slotTest1Action); _editMenu -> addAction (_slotTest2Action); _editMenu -> addAction (_slotTest3Action); } // ********************** // *** Build Row Menu *** // ********************** if (useRowColMenus) { _rowMenu = _menubar -> addMenu (tr ("&Row")); if (_isPeriodicSlot) { _rowMenu -> addAction (_perioSlot_SetRowDate); _rowMenu -> addAction (_perioSlot_AddRow); _rowMenu -> addAction (_perioSlot_DupRow); _rowMenu -> addAction (_perioSlot_DelRows); } else { _rowMenu -> addAction (_rowLabelsAction); _rowMenu -> addAction (_insertRowCopyAction); _rowMenu -> addAction (_insertRowNewAction); _rowMenu -> addAction (_appendRowAction); _rowMenu -> addAction (_deleteRowsAction); _rowMenu -> addAction (_deleteRowsBelowAction); } } // ************************* // *** Build Column Menu *** // ************************* if (useRowColMenus) { _columnMenu = _menubar -> addMenu (tr ("&Column")); if (hasColMap) { _columnMenu -> addAction (_setColumnValueAction); } else { _columnMenu -> addAction (_columnLabelsAction); } if (_isPeriodicSlot) { _columnMenu -> addAction (_perioSlot_AddColumn); _columnMenu -> addAction (_perioSlot_DupColumn); _columnMenu -> addAction (_perioSlot_DelColumn); } else // (!_isPeriodicSlot) { if (showBlockOps) { _columnMenu -> addAction (_setNumBlocksAction); _columnMenu -> addAction (_insertTableColAction); _columnMenu -> addAction (_appendBlockAction); _columnMenu -> addAction (_deleteBlockAction); _columnMenu -> addAction (_deleteLastBlockAction); } if (showSetDim) { _columnMenu -> addAction (_setDimensionsAction); } } } // *********************** // *** Build View Menu *** // *********************** _viewMenu = _menubar -> addMenu (tr ("Vie&w")); _viewMenu -> addAction (_configureAction); _viewMenu -> addAction (_seriesRangeAction); if (!useRowColMenus) { _viewMenu -> addSeparator(); //--------- _viewMenu -> addAction (_columnLabelsAction); _viewMenu -> addAction (_rowLabelsAction); } if (_appMode == SQD_APP_MODE_OPEN_SLOT) { // Unfortunately, whether or not the Slot has links may change during // the life of the dialog, and of the View menu. So, we really can't // choose to not create the LinkedSlotPopupMenu now. That dynamic // submenu itself will show (only) a "No Links" item if there are not // any Slot links, and that's good enough. // // int linkedSlotCnt = LinkedSlotsPopupMenu::linkedSlotCount (_slot); // if (linkedSlotCnt > 0) // { // _linkedSlotsPopupMenu = // new LinkedSlotsPopupMenu (_viewMenu, "_linkedSlotsPopupMenu"); // _viewMenu->addSeparator(); //--------- // _viewMenu->insertItem (tr ("Linked Slots"), _linkedSlotsPopupMenu); // } // else // (linkedSlotCnt <= 0) // { // QAction* noLinkedSlotsDummyAction = // new QAction (this, "noLinkedSlotsDummyAction"); // _viewMenu -> addAction (noLinkedSlotsDummyAction); // // noLinkedSlotsDummyAction->setText (tr ("No Linked Slots")); // noLinkedSlotsDummyAction->setEnabled (false); // } // See note above. _linkedSlotsPopupMenu = new LinkedSlotsPopupMenu (_viewMenu, "_linkedSlotsPopupMenu"); _viewMenu -> addSeparator(); //--------- _viewMenu -> insertItem (tr ("Linked Slots"), _linkedSlotsPopupMenu); } if (_isTableSlot && !_isTableSeriesSlot) { _viewMenu -> addAction (_showColSumRowAction); } if (_seriesMode) { _viewMenu -> addSeparator(); //--------- _viewMenu -> addAction (_showDispCompAction); } if (_selStatsSupported) { _viewMenu -> addAction (_showSelStatsAction); } if (supportsPriorities) { _viewMenu -> addAction (_showPrioritiesAction); } _viewMenu -> addAction (_showCommaSepsAction); _noteGroupsMenu = NULL; if ( // (_appMode == SQD_APP_MODE_ACCT_EDIT) || // not yet supported // (_appMode == SQD_APP_MODE_EXCH_BAL) || // not yet supported NoteQtUtils::slotSupportsNotes (_slot) ) { _viewMenu -> addSeparator(); //--------- _viewMenu -> addAction (_showNotesColAction); _noteGroupsMenu = new QMenu (_viewMenu); _viewMenu->insertItem (tr ("Note Groups"), _noteGroupsMenu); } const bool descSupported = _isSlotOnDataObj || ((_appMode == SQD_APP_MODE_OPEN_SLOT) && DESCRIPT_SUPPORT_ON_ALL_SLOTS); if (descSupported) { _viewMenu -> addAction (_addDescriptionAction); _viewMenu -> addAction (_showDescriptionAction); } if (_isRplExprSeriesSlot) { rwDebugAssert(_rplFrame && _slot && _rplToggles); _rplExprMenu = new RplExpressionMenu(*_rplFrame, _undoStack, _slot, this); _menubar->addMenu(_rplExprMenu); connect(_rplExprMenu, SIGNAL(evalTimeChanged()), this, SLOT (rplEvalTimeChanged())); connect(_rplExprMenu, SIGNAL(showExprChanged(bool)), this, SLOT (setShowExpression(bool))); } else // (not _isRplExprSeriesSlot) { // *************************** // *** Build Timestep Menu *** // *************************** if (!_slot || _slot->isA(Slot::SeriesSlotBit)) { _timestepMenu = _menubar -> addMenu (tr ("Time&Step I/O")); _timestepMenu -> addAction (_setInputSelAction); _timestepMenu -> addAction (_setInputAllAction); _timestepMenu -> addSeparator(); //--------- if ( _isAcctSlot || _isSplySlot || (_exchange != NULL) || (_acctSlotSum != NULL) ) { _timestepMenu -> addAction (_clearSelNonInputsAction); _timestepMenu -> addAction (_clearSelValuesAction); _timestepMenu -> addAction (_clearAllValuesAction); } else { _timestepMenu -> addAction (_setOutputSelAction); _timestepMenu -> addAction (_setOutputAllAction); _timestepMenu -> addSeparator(); //--------- _timestepMenu -> addAction (_reverseIOAction); _timestepMenu -> addAction (_reverseIOAllAction); _timestepMenu -> addSeparator(); //--------- _timestepMenu -> addAction (_setTargetBeginAction); _timestepMenu -> addAction (_setTargetAction); _timestepMenu -> addAction (_setBestEfficiencyAction); _timestepMenu -> addAction (_setMaxCapacityAction); _timestepMenu -> addAction (_setUnitValuesFlagAction); _timestepMenu -> addAction (_setDriftAction); } } } // ************************* // *** Build Config Menu *** // ************************* if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) { _configMenu = _menubar -> addMenu (tr ("&Config")); rebuildConfigMenu(); } // ***************************** // *** Build Accounting Menu *** // ***************************** if ( _isAcctSlot || _isSplySlot || (_exchange != NULL) || (_acctSlotSum != NULL) ) { _acctMenu = _menubar -> addMenu (tr ("&Accounting")); _acctMenu -> addAction (_openAccountsMgrAction); _acctMenu -> addAction (_openSuppliesMgrAction); _acctMenu -> addAction (_openExchangesMgrAction); _acctMenu -> addAction (_acctSysConfigAction); _acctMenu -> addSeparator(); //--------- _acctMenu -> addAction (_useAcctColorsAction); _acctMenu -> addAction (_showAcctLegendAction); } // ************************* // *** Build Adjust Menu *** // ************************* _adjustMenu = _menubar -> addMenu (tr ("A&djust")); _adjustMenu -> addAction (_setColWidthsAction); _adjustMenu -> addAction (_growColsToDataAction); _adjustMenu -> addAction (_fitColsToDataAction); _adjustMenu -> addAction (_fitColsToAllAction); _adjustMenu -> addAction (_fitColsToHeadAction); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::rebuildConfigMenu() { //---------------------------------------------------------------------- // Built: QMenu* _configMenu // Computed: std::vector _configMenuAcctSlotSumVector; //---------------------------------------------------------------------- static const char (*mname) ("SlotQtDlg::rebuildConfigMenu"); static int callCnt (0); ++callCnt; // remove previously created items if (_configMenu) _configMenu->clear(); _configMenuAcctSlotSumVector.clear(); if (_configMenu == NULL) return; if (_simObj == NULL) return; //---------------------------->> // std::cout << mname << " #" << callCnt << std::endl; // Retrieve collection of AcctSlotSummary records from the SimObj. const std::map& sumMap = _simObj->getAcctSlotSumMap(); const int sumCnt (sumMap.size()); _configMenuAcctSlotSumVector.resize (sumCnt+1, NULL); QMenu *configMenuData (_configMenu); std::map::const_iterator iter; int recCnt (0); // ******************************** // *** Insert "Load" Menu Items *** // ******************************** for (iter = sumMap.begin(); iter != sumMap.end(); ++iter) { const QString& name ((*iter).first); AcctSlotSummary* asum ((*iter).second); if (name == AcctSlotSummary::NullName) continue; //---------------------------------------------- configMenuData->insertItem ( name, // text string this, // QObject* receiver SLOT (configMenu_loadId (int)), // const char* member 0, // accel (none) recCnt); // int id _configMenuAcctSlotSumVector [recCnt] = asum; ++recCnt; } // *********************************** // *** Add "Save as ..." menu item *** // *********************************** _configMenu->addSeparator(); //------------ _configSaveAsAction->addTo (_configMenu); // ******************************* // *** Insert "Delete" SubMenu *** // ******************************* if (recCnt > 0) { _configMenu->addSeparator(); //------------ QMenu *delSubMenu = new QMenu (_configMenu); _configMenu->insertItem (tr ("Delete"), delSubMenu); QMenu *delSubMenuData (delSubMenu); for (int recInx = 0; recInx < recCnt; ++recInx) { AcctSlotSummary* asum = _configMenuAcctSlotSumVector [recInx]; const QString& name (asum->name()); delSubMenuData->insertItem ( name, // text string this, // QObject* receiver SLOT (configMenu_deleteId (int)), // const char* member 0, // accel (none) recInx); // int id } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildPeriodicSlotBottomWidgets() { _periodicSlotBottomWidgets = new QWidget (this); _periodicSlotBottomWidgets->setObjectName ("_periodicSlotBottomWidgets"); QVBoxLayout* vlout = new QVBoxLayout (_periodicSlotBottomWidgets); vlout->setObjectName ("vlout"); vlout->setSpacing (3); vlout->setContentsMargins (4, 6, 6, 6); // left top right bottom _periodicInterpButtonGroup = new Q3ButtonGroup (_periodicSlotBottomWidgets); _periodicInterpButtonGroup->setObjectName ("_periodicInterpButtonGroup"); _periodicInterpButtonGroup->setFrameShape (Q3GroupBox::NoFrame); _periodicInterpButtonGroup->setLineWidth (0); _periodicInterpButtonGroup->setColumnLayout (0, Qt::Vertical); _periodicInterpButtonGroup->setRadioButtonExclusive (true); QHBoxLayout* hlout = new QHBoxLayout(); QBoxLayout *boxlayout = qobject_cast (_periodicInterpButtonGroup->layout()); if (boxlayout) boxlayout->addLayout (hlout); hlout->setAlignment (Qt::AlignTop); _periodicInterpButtonGroup->layout()->setContentsMargins (0, 0, 0, 0); _periodicInterpRadioBut = new QRadioButton (_periodicInterpButtonGroup); _periodicLookupRadioBut = new QRadioButton (_periodicInterpButtonGroup); _periodicInterpRadioBut->setObjectName ("_periodicInterpRadioBut"); _periodicLookupRadioBut->setObjectName ("_periodicLookupRadioBut"); _periodicInterpRadioBut->setEnabled (false); // read only _periodicLookupRadioBut->setEnabled (false); // read only hlout->addWidget (_periodicInterpRadioBut); hlout->addWidget (_periodicLookupRadioBut); hlout->addItem (new rwQHorizontalSpring (0)); vlout->addWidget (_periodicInterpButtonGroup); _periodicTextLabel = new QLabel (_periodicSlotBottomWidgets); _periodicTextLabel->setObjectName ("_periodicTextLabel"); _periodicTextLabel->setSizePolicy (QSizePolicy::MinimumExpanding, // horz QSizePolicy::Minimum); // vert vlout->addWidget (_periodicTextLabel); _periodicInterpRadioBut->setText (tr ("Interpolate")); _periodicLookupRadioBut->setText (tr ("Lookup")); _periodicTextLabel->setText (tr ("RowMap TimeLine Config Text")); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::installSlotDataTable (AcctSlotSummary* asum) { static const char (*mname) ("SlotQtDlg::installSlotDataTable"); if (_shipGoingDown) return; //----------------------->> _timeColMode = false; // tentative if (asum != NULL) { AcctSlotSummary::ColMode colMode = asum->colMode(); _timeColMode = (colMode == AcctSlotSummary::COL_MODE_TIME); } SlotQDlgTable* prevSlotDataTable (_slotDataTable); _slotDataTable = _timeColMode ? _slotDataTable_timeColMode : _slotDataTable_slotColMode; if (prevSlotDataTable != _slotDataTable) { if (prevSlotDataTable != NULL) { // std::cout << mname << " Disconnecting " // << prevSlotDataTable->name() // << std::endl; prevSlotDataTable->clearClientSignals(); } initQTableConnections(); } _slotDataTableStack->raiseWidget (_slotDataTable); if (rwAssert (_slotDataTable != NULL)) { if (asum != NULL) { _slotDataTable->setGeneratorAcctSlotSum (asum); } const bool doShowSupplies = showingSupplies(); _slotDataTable->setShowSupplies (doShowSupplies); const bool doShowEmptySlots = showingEmptySlots(); _slotDataTable->setShowEmptySlots (doShowEmptySlots); _slotDataTable->refreshShownSupplies(); if (_timeColMode) _slotDataTable->growColsToHeader_handler(); else _slotDataTable->growColsToData_handler(); } if (_selStatFrame != NULL) { _selStatFrame->setSlotDataTable (_slotDataTable); } if (asum != NULL) { const bool showFlowButton = asum->acctSlotDomainListUsesAltUnits(); _unitTypeFlowPushButton ->setShown (showFlowButton); } schedRefreshDisplayCompression(); refreshStatusBar(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::setShipGoingDown() { _shipGoingDown = true; if (_selStatFrame) _selStatFrame->setShipGoingDown(); if (_slotDataTable_timeColMode) _slotDataTable_timeColMode->setShipGoingDown(); if (_slotDataTable_slotColMode) _slotDataTable_slotColMode->setShipGoingDown(); } //---------------------------------------------------------------------------- // public // // void buildQtWidgets (QWidget* parent = NULL, // const char* name = NULL, // WFlags flags = 0) // //---------------------------------------------------------------------------- void SlotQtDlg::buildQtWidgets (QWidget*, /*parent*/ const char* name, Qt::WFlags) { statusBar(); if (!name) setName ("SlotQtDlg"); setMinimumSize (QSize (250, 225)); QWidget* cenWid = new QWidget (this, "SlotQtDlg CentralWidget"); setCentralWidget (cenWid); _mainVBoxLayout = new QVBoxLayout (cenWid, 8, 2, "_mainVBoxLayout"); _dlgTopFrame = new QFrame (cenWid, "_dlgTopFrame"); _dlgTopFrame->setSizePolicy (QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, _dlgTopFrame->sizePolicy().hasHeightForWidth())); _dlgTopFrame->setFrameShape (QFrame::NoFrame); _dlgTopFrame->setFrameShadow (QFrame::Plain); _dlgTopFrame->setLineWidth (0); _dlgTopFrameLayout = new QHBoxLayout (_dlgTopFrame, 0, 2, "_dlgTopFrameLayout"); _objectIconVBox = new QVBoxLayout (0, 0, 6, "_objectIconVBox"); _objectIconButton = new RwPushButton (_dlgTopFrame); _objectIconButton->setObjectName ("_objectIconButton"); _objectIconButton->setSizePolicy ( QSizePolicy ((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, _objectIconButton->sizePolicy().hasHeightForWidth())); // _objectIconButton->setMaximumSize (QSize (46, 46)); _objectIconButton->setFlat (true); _objectIconVBox->addWidget (_objectIconButton); _objectIconVBox->addItem (new rwQVerticalSpring()); _dlgTopFrameLayout->addLayout (_objectIconVBox); _dlgTopFrameLayout->addItem (new rwQHorizontalStrut (5)); QWidget* topControlFrameParent (NULL); if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) topControlFrameParent = cenWid; else topControlFrameParent = _dlgTopFrame; _topControlFrame = new QFrame (topControlFrameParent, "_topControlFrame"); _topControlFrame->setSizePolicy (QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, _topControlFrame->sizePolicy().hasHeightForWidth())); _topControlFrame->setFrameShape (QFrame::NoFrame); _topControlFrame->setFrameShadow (QFrame::Plain); _topControlFrame->setLineWidth (0); _topControlFrameLayout = new QVBoxLayout (_topControlFrame, 0, 2, "_topControlFrameLayout"); if ((_appMode == SQD_APP_MODE_OPEN_SLOT) && (_slotAcct != NULL)) { if (_slotNameHBox == NULL) _slotNameHBox = new QHBoxLayout (0, 0, 6, "_slotNameHBox"); _acctIconButton = new RwPushButton (_topControlFrame); _acctIconButton->setObjectName ("_acctIconButton"); _slotNameHBox->addWidget (_acctIconButton); } if (_appMode != SQD_APP_MODE_OBJ_ACCT_SUM) { if (_slotNameHBox == NULL) _slotNameHBox = new QHBoxLayout (0, 0, 6, "_slotNameHBox"); _slotNameLabel = new QLabel (_topControlFrame, "_slotNameLabel"); _slotNameHBox->addWidget (_slotNameLabel); _slotNameEdit = new QLineEdit (_topControlFrame, "_slotNameEdit"); _slotNameHBox->addWidget (_slotNameEdit); _topControlFrameLayout->addLayout (_slotNameHBox); } QWidget* tableTopCtrlFrameParent (NULL); switch (_appMode) { case SQD_APP_MODE_ACCT_EDIT: case SQD_APP_MODE_EXCH_BAL: tableTopCtrlFrameParent = _topControlFrame; break; case SQD_APP_MODE_OBJ_ACCT_SUM: tableTopCtrlFrameParent = cenWid; break; } if (tableTopCtrlFrameParent != NULL) { _tableTopCtrlFrame = new QFrame (tableTopCtrlFrameParent, "_tableTopCtrlFrame"); _tableTopCtrlFrame->setSizePolicy (QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, _tableTopCtrlFrame->sizePolicy().hasHeightForWidth())); _tableTopCtrlFrame->setFrameShape (QFrame::NoFrame); _tableTopCtrlFrame->setFrameShadow (QFrame::Plain); _tableTopCtrlFrame->setLineWidth (0); _tableTopCtrlFrameLayout = new QHBoxLayout (_tableTopCtrlFrame, 0, 2, "_tableTopCtrlFrameLayout"); } QWidget* valueFrameParent (NULL); QWidget* partialDTimeEditorParent (NULL); QWidget* scrollFrameParent (NULL); QWidget* dispCompPanelParent (NULL); int dispCompPanelFormat (1); // One or Two rows of widgets switch (_appMode) { case SQD_APP_MODE_OPEN_SLOT: valueFrameParent = _topControlFrame; partialDTimeEditorParent = cenWid; scrollFrameParent = cenWid; dispCompPanelParent = cenWid; dispCompPanelFormat = 2; // Two rows of widgets break; case SQD_APP_MODE_ACCT_EDIT: case SQD_APP_MODE_EXCH_BAL: valueFrameParent = _tableTopCtrlFrame; partialDTimeEditorParent = _tableTopCtrlFrame; scrollFrameParent = _tableTopCtrlFrame; dispCompPanelParent = cenWid; dispCompPanelFormat = 1; // One row of widgets break; case SQD_APP_MODE_OBJ_ACCT_SUM: valueFrameParent = _tableTopCtrlFrame; partialDTimeEditorParent = _tableTopCtrlFrame; scrollFrameParent = _tableTopCtrlFrame; dispCompPanelParent = cenWid; dispCompPanelFormat = 1; // One row of widgets break; } buildSlotValueFrame (valueFrameParent); buildPartialDateTimeEditorFrame (partialDTimeEditorParent); buildScrollControlFrame (scrollFrameParent); _dispCompressPanel = new DisplayCompressPanel (dispCompPanelParent, "_dispCompressPanel", dispCompPanelFormat); // One or Two rows of widgets _dispCompressPanel->setCompressionSpec (_seriesDisplayCompressSpec); if (valueFrameParent == _topControlFrame) { _topControlFrameLayout->addWidget (_slotValueFrame); } else if (valueFrameParent == _tableTopCtrlFrame) { _tableTopCtrlFrameLayout->addWidget (_slotValueFrame); } if (partialDTimeEditorParent == _tableTopCtrlFrame) { _tableTopCtrlFrameLayout->addItem (new rwQHorizontalStrut (5)); _tableTopCtrlFrameLayout->addWidget (_partialDateTimeEditor); } if (scrollFrameParent == _tableTopCtrlFrame) { _tableTopCtrlFrameLayout->addItem (new rwQHorizontalStrut (5)); _tableTopCtrlFrameLayout->addWidget (_scrollControlFrame); } if (dispCompPanelParent == _tableTopCtrlFrame) { _tableTopCtrlFrameLayout->addWidget (_dispCompressPanel); } if (tableTopCtrlFrameParent == _topControlFrame) { _topControlFrameLayout->addWidget (_tableTopCtrlFrame); } if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) { _objAcctSumSel = new ObjAcctSumSel (_dlgTopFrame, "_objAcctSumSel"); _objAcctSumSel->setConfig (_acctSlotSum); _dlgTopFrameLayout->addWidget (_objAcctSumSel); _mainVBoxLayout->addWidget (_dlgTopFrame); _mainVBoxLayout->addWidget (_topControlFrame); } else { _dlgTopFrameLayout->addWidget (_topControlFrame); _mainVBoxLayout->addWidget (_dlgTopFrame); } // ********************************* // *** Widgets below top section *** // ********************************* const TableSlot* tslot (dynamic_cast (_slot)); const bool hasColMap (tslot && tslot->hasColumnMap()); if (hasColMap) { _colMapEntityDispLabel = new QLabel (cenWid); _colMapEntityDispLabel->setObjectName ("_colMapEntityDispLabel"); _colMapEntityDispLabel->setVisible (false); _mainVBoxLayout->addWidget (_colMapEntityDispLabel); } if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) { _acctOrderPanel = new AcctOrderPanel (this, cenWid, "_acctOrderPanel"); _mainVBoxLayout->addWidget (_acctOrderPanel); _tstepSelPanel = new TimeStepSelPanel (this, cenWid, "_tstepSelPanel"); _mainVBoxLayout->addWidget (_tstepSelPanel); // Since the vertical dimension of the AcctOrderPanel is now precisely // controlled by implementing sizeHint(), with a Fixed QSizeType, // we're no longer maniplating the stretch factor of the panel. // // -- _mainVBoxLayout->setStretchFactor (_acctOrderPanel, 1); QFrame* hline = new QFrame (cenWid, "hline"); hline->setFrameShape (QFrame::HLine); hline->setFrameShadow (QFrame::Sunken); _mainVBoxLayout->addWidget (hline); } if (_isRplExprSeriesSlot) { buildRplEvalSettingPanel(); _mainVBoxLayout->addWidget (_rplEvalSettingPanel); } _mainVertSplitter = new QSplitter (cenWid); _mainVertSplitter->setObjectName ("_mainVertSplitter"); _mainVertSplitter->setFrameShape (QFrame::NoFrame); _mainVertSplitter->setFrameShadow (QFrame::Plain); _mainVertSplitter->setLineWidth (0); _mainVertSplitter->setOrientation (Qt::Vertical); _mainVertSplitter->setChildrenCollapsible (false); if (_isRplExprSeriesSlot) { _rplFrame = new RplFrame (_undoStack, _slot, this); connect (_rplFrame, SIGNAL (print()), this, SLOT (printRplExpression())); _mainVertSplitter->addWidget (_rplFrame); _rplFrame->reformat(); connect(_rplFrame, SIGNAL (showCommentsChanged(bool)), SLOT (rplFrame_showCommentsChanged(bool))); connect(_rplFrame, SIGNAL (editted()), SLOT (rplToggles_updateRelevance())); // Add a row of toggles which in this case controls only whether or // not inline comments are shown. _rplToggles = new RowOToggles (this, tr ("Show: ")); _rplTogglesIndex_comments = _rplToggles->addToggle (tr ("Comments")); _rplToggles->setToggleOn (_rplTogglesIndex_comments, _rplFrame->showComments()); rplToggles_updateRelevance(); connect (_rplToggles, SIGNAL (stateChanged (int, bool)), SLOT (rplToggles_stateChanged (int, bool))); _mainVertSplitter->addWidget (_rplToggles); } // ***************************************************************** // *** For read-only slots derived from other slots, an explanation // ***************************************************************** const bool slotHasSourceSlot = (getSlot() && getSlot()->hasSourceSlot()); if (slotHasSourceSlot) { QLabel* _readOnlyReasonLabel = new QLabel(_slotDataTableStack); _readOnlyReasonLabel->setObjectName ("_readOnlyReasonLabel"); _readOnlyReasonLabel->setContentsMargins (1,1,1,1); RwQtUtils::colorHighlightBackground(_readOnlyReasonLabel); static const QString MSG( "Note: these values are automatically generated based on \"%1\"."); _readOnlyReasonLabel->setText(MSG.arg(getSlot()->sourceSlotName())); _mainVertSplitter->addWidget (_readOnlyReasonLabel); } _slotDataTableFrame = new QFrame (cenWid, "_slotDataTableFrame"); _slotDataTableFrame->setFrameShape (QFrame::NoFrame); _slotDataTableFrame->setLineWidth (0); QSizePolicy dataTableSizePolicy (_slotDataTableFrame->sizePolicy()); dataTableSizePolicy.setVerticalStretch (1); _slotDataTableFrame->setSizePolicy (dataTableSizePolicy); QVBoxLayout* dataTableVBox = new QVBoxLayout (_slotDataTableFrame, 2, 4, "dataTableVBox"); dataTableVBox->setContentsMargins (0,0,0,0); if (partialDTimeEditorParent == cenWid) { dataTableVBox->addWidget (_partialDateTimeEditor); } if (scrollFrameParent == cenWid) { dataTableVBox->addWidget (_scrollControlFrame); } if (tableTopCtrlFrameParent == cenWid) { dataTableVBox->addWidget (_tableTopCtrlFrame); } if (dispCompPanelParent == cenWid) { dataTableVBox->addWidget (_dispCompressPanel); } _slotDataTableStack = new Q3WidgetStack (_slotDataTableFrame, "_slotDataTableStack"); QSizePolicy dataStackSizePolicy (_slotDataTableStack->sizePolicy()); dataStackSizePolicy.setVerticalStretch (1); _slotDataTableStack->setSizePolicy (dataStackSizePolicy); _slotDataTable_timeColMode = new SlotQDlgTable (this, _slotDataTableStack, "_slotDataTable_timeColMode"); _slotDataTable_slotColMode = new SlotQDlgTable (this, _slotDataTableStack, "_slotDataTable_slotColMode"); _slotDataTable = _slotDataTable_slotColMode; _slotDataTable_timeColMode->registerSlotQtDlg (this); _slotDataTable_slotColMode->registerSlotQtDlg (this); dataTableVBox->addWidget (_slotDataTableStack); _mainVertSplitter->addWidget (_slotDataTableFrame); _mainVBoxLayout->addWidget (_mainVertSplitter); _mainVBoxLayout->setStretchFactor (_mainVertSplitter, 1); // *************************************** // *** Widgets below the SlotQDlgTable *** // *************************************** buildBottomOptionsFrame (cenWid); dataTableVBox->addWidget (_bottomOptionsFrame); dataTableVBox->setStretchFactor (_bottomOptionsFrame, 0); initShowSuppliesCheckBox(); const bool doShowSupplies = showingSupplies(); _slotDataTable_timeColMode->setShowSupplies (doShowSupplies); _slotDataTable_slotColMode->setShowSupplies (doShowSupplies); initShowEmptySlotsCheckBox(); const bool doShowEmptySlots = showingEmptySlots(); _slotDataTable_timeColMode->setShowEmptySlots (doShowEmptySlots); _slotDataTable_slotColMode->setShowEmptySlots (doShowEmptySlots); _slotDataTable->refreshShownSupplies(); _slotDataTable->refreshShowHideSlotItems(); schedRefreshDisplayCompression(); _slotDataTable->growColsToData_handler(); refreshBottomOptionsFrame(); // ************************************* // *** Exchange Balance Key ListView *** // ************************************* if (_appMode == SQD_APP_MODE_EXCH_BAL) { // *** Horizontal divider QFrame* div = new QFrame (cenWid, "exchBalKeyListView Div"); div->setFrameShape (QFrame::HLine); div->setFrameShadow (QFrame::Sunken); _mainVBoxLayout->addWidget (div); _mainVBoxLayout->setStretchFactor (div, 0); // *** Exchange Balance Key ListView _exchBalKeyTreeWidget = new ExchBalanceKeyTreeWidget (cenWid, "_exchBalKeyTreeWidget"); _mainVBoxLayout->addWidget (_exchBalKeyTreeWidget); _mainVBoxLayout->setStretchFactor (_exchBalKeyTreeWidget, 1); } // ************************************ // *** Periodic Slot Bottom Widgets *** // ************************************ if (_isPeriodicSlot) { buildPeriodicSlotBottomWidgets(); refreshPeriodicSlotBottomWidgets(); _mainVBoxLayout->addWidget (_periodicSlotBottomWidgets); _mainVBoxLayout->setStretchFactor (_periodicSlotBottomWidgets, 0); } // *************************** // *** Description Panel *** // *************************** const bool descSupported = _isSlotOnDataObj || ((_appMode == SQD_APP_MODE_OPEN_SLOT) && DESCRIPT_SUPPORT_ON_ALL_SLOTS); if (descSupported) { _descDispBox = new QFrame (_slotDataTableStack); _descDispBox->setObjectName ("_descDispBox"); QVBoxLayout* lout = new QVBoxLayout (_descDispBox); lout->setSpacing (3); lout->setContentsMargins (1, 1, 1, 1); // ************************************* // *** Description "Row-O-Toggles" *** // ************************************* _descToggles = new RowOToggles (this, tr ("Show: ")); _descTogglesIndex_desc = _descToggles->addToggle (tr ("Description")); _descToggles->setToggleOn (_descTogglesIndex_desc, false); descToggles_updateRelevance(); connect (_descToggles, SIGNAL (stateChanged (int, bool)), SLOT (descToggles_stateChanged (int, bool))); lout->addWidget (_descToggles); // *************************************************** // *** Description Panel under a "Row-O-Toggles" *** // *************************************************** _descDispBox->setContentsMargins (1,1,1,1); _descDispPanel = new DescriptDisplayPanel (_descDispBox); lout->addWidget (_descDispPanel); _descDispPanel->configure (this); _descDispPanel->setMode ( SHOW_DESCRIPTION_PANEL_CONTROLS ? DescriptDisplayPanel::Mode_Controls_NoDismiss : DescriptDisplayPanel::Mode_NoControls); _mainVertSplitter->addWidget (_descDispBox); // Fix _descToggles RowOToggles height const int hgt = _descToggles->sizeHint().height(); _descToggles->setFixedHeight (hgt); } // **************************** // *** Selection Status Bar *** // **************************** bool showStatusBarDefault (false); switch (_appMode) { case SQD_APP_MODE_ACCT_EDIT: showStatusBarDefault = true; break; case SQD_APP_MODE_EXCH_BAL: showStatusBarDefault = true; break; case SQD_APP_MODE_OBJ_ACCT_SUM: showStatusBarDefault = true; break; case SQD_APP_MODE_OPEN_SLOT: { if (_slot) { // const int slotColCnt (SlotGUIUtils::getNumCols (_slot)); // --- Maybe, but not yet --- // showStatusBarDefault = (slotColCnt >= 2); // Yes: Account MultiSlots if ((NULL != dynamic_cast (_slot))) showStatusBarDefault = true; // --- Maybe, but not yet --- // // Yes: TableSlots with two or more columns // else if ((slotColCnt >= 2) && // (NULL != dynamic_cast (_slot))) // showStatusBarDefault = true; } } } if (_selStatsSupported) { _selStatFrame = new SlotQDlgSelStatFrame (cenWid, "_selStatFrame"); _selStatFrame->setFrameStyle ((int) QFrame::Box | (int) QFrame::Plain); _selStatFrame->setLineWidth (1); _selStatFrame->setSlotDataTable (_slotDataTable); _selStatFrame->setVisible (showStatusBarDefault); _showSelStatsAction->setOn (showStatusBarDefault); _mainVBoxLayout->addWidget (_selStatFrame); _mainVBoxLayout->setStretchFactor (_selStatFrame, 0); } // Moved to constructor: // --- languageChange(); // --- resize (minimumSizeHint()); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildSlotValueFrame (QWidget* parent) { _slotValueFrame = new QFrame (parent, "_slotValueFrame"); _slotValueFrame->setSizePolicy (QSizePolicy ( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, _slotValueFrame->sizePolicy().hasHeightForWidth())); _slotValueFrame->setFrameShape (QFrame::NoFrame); _slotValueFrame->setFrameShadow (QFrame::Plain); _slotValueFrame->setLineWidth (0); _slotValueFrameLayout = new QHBoxLayout (_slotValueFrame, 2, 6, "_slotValueFrameLayout"); _slotValueLabel = new QLabel (_slotValueFrame, "_slotValueLabel"); _slotValueFrameLayout->addWidget (_slotValueLabel); _slotValueEdit = new QLineEdit (_slotValueFrame, "_slotValueEdit"); _slotValueFrameLayout->addWidget (_slotValueEdit); _slotUnitLabel = new QLabel (_slotValueFrame, "_slotUnitLabel"); _slotValueFrameLayout->addWidget (_slotUnitLabel); if (_appMode != SQD_APP_MODE_OPEN_SLOT) { _unitTypeFlowPushButton = new RwPushButton (_slotValueFrame); _unitTypeFlowPushButton->setObjectName ("_unitTypeFlowPushButton"); _unitTypeFlowPushButton->setToggleButton (TRUE); _slotValueFrameLayout->addWidget (_unitTypeFlowPushButton); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildPartialDateTimeEditorFrame (QWidget* parent) { _partialDateTimeEditor = new PartialDateTimeEditor (parent, "_partialDateTimeEditor"); _partialDateTimeEditor->configure (_slot); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildScrollControlFrame (QWidget* parent) { const SeriesSlot* sslot = dynamic_cast (_slot); const bool isIntInx = sslot && sslot->usersIndexByInt(); _scrollControlFrame = new QFrame (parent, "_scrollControlFrame"); _scrollControlFrame->setSizePolicy (QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, _scrollControlFrame->sizePolicy().hasHeightForWidth())); _scrollControlFrame->setFrameShape (QFrame::NoFrame); _scrollControlFrame->setFrameShadow (QFrame::Plain); _scrollControlFrame->setLineWidth (0); _scrollControlFrameLayout = new QHBoxLayout (_scrollControlFrame, 2, 3, "_scrollControlFrameLayout"); _scrollDatePushButton = new RwTimeScrollButton (_scrollControlFrame); _scrollDatePushButton->setObjectName ("_scrollDatePushButton"); _scrollControlFrameLayout->addWidget (_scrollDatePushButton); QToolTip::remove (_scrollDatePushButton); if (SCROLL_BUTTON_USES_ICON) { QToolTip::add (_scrollDatePushButton, tr ("Scroll to Date/Time;\n" "Shift-click to Global Scroll")); } else { QToolTip::add (_scrollDatePushButton, tr ("Shift-click for Global Scroll")); } const bool showDtScroll = _seriesMode && !isIntInx; if (showDtScroll) { _scrollDateSpinner = new DateTimeQtSpinner (_scrollControlFrame, "_scrollDateSpinner"); _scrollDateSpinner->setSizePolicy (QSizePolicy ( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 1, 0, _scrollDateSpinner->sizePolicy().hasHeightForWidth())); _scrollControlFrameLayout->addWidget (_scrollDateSpinner); _scrollAnnoPushButton = new RwPushButton (_scrollControlFrame); _scrollAnnoPushButton ->setObjectName ("_scrollAnnoPushButton"); _scrollControlFrameLayout->addWidget (_scrollAnnoPushButton); _scrollAnnoPopupMenu = new QMenu (_scrollAnnoPushButton); _scrollAnnoPopupMenu->setObjectName ("_scrollAnnoPopupMenu"); _scrollAnnoPushButton->setPopup (_scrollAnnoPopupMenu); } else // (!showDtScroll) { _scrollDatePushButton->setVisible (false); rwQHorizontalSpring* sp1 = new rwQHorizontalSpring(); _scrollControlFrameLayout->addItem (sp1); } if (_appMode == SQD_APP_MODE_OPEN_SLOT) { _unitTypeFlowPushButton = new RwPushButton (_scrollControlFrame); _unitTypeFlowPushButton->setObjectName ("_unitTypeFlowPushButton"); _unitTypeFlowPushButton->setToggleButton (TRUE); _scrollControlFrameLayout->addWidget (_unitTypeFlowPushButton); } _showDescriptPushButton = new RwPushButton (_scrollControlFrame); _showDescriptPushButton->setObjectName ("_showDescriptPushButton"); _scrollControlFrameLayout->addWidget (_showDescriptPushButton); _showDescriptPushButton->setShown (SHOW_SHOW_DESCRIPT_PUSHBUTTON_DEMO); _displayCompressPushButton = new RwPushButton (_scrollControlFrame); _displayCompressPushButton->setObjectName ("_displayCompressPushButton"); _scrollControlFrameLayout->addWidget (_displayCompressPushButton); _displayCompressPushButton->setShown (false); // Conditionally Shown _plotPushButton = new RwPushButton (_scrollControlFrame); _plotPushButton->setObjectName ("_plotPushButton"); _scrollControlFrameLayout->addWidget (_plotPushButton); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildBottomOptionsFrame (QWidget* parent) { _bottomOptionsFrame = new QFrame (parent, "_bottomOptionsFrame"); _bottomOptionsFrame->setFrameShape (QFrame::NoFrame); _bottomOptionsFrame->setLineWidth (0); _bottomOptionsVBoxLayout = new QVBoxLayout (_bottomOptionsFrame, 2, 4, "_bottomOptionsVBoxLayout"); _showEmptySlotsFrame = new QFrame (_bottomOptionsFrame, "_showEmptySlotsFrame"); _showEmptySlotsFrame->setFrameShape (QFrame::NoFrame); _showEmptySlotsFrame->setLineWidth (0); _showEmptySlotsHBoxLayout = new QHBoxLayout ( _showEmptySlotsFrame, 2, 11, "_showEmptySlotsHBoxLayout"); _showEmptySlotsHBoxLayout->setStretchFactor (_showEmptySlotsHBoxLayout, 0); _showSubslotsFrame = new QFrame (_bottomOptionsFrame, "_showSubslotsFrame"); _showSubslotsFrame->setFrameShape (QFrame::NoFrame); _showSubslotsFrame->setLineWidth (0); _showSubslotsHBoxLayout = new QHBoxLayout ( _showSubslotsFrame, 2, 11, "_showSubslotsHBoxLayout"); // *** Horizontal divider _showEmptySlotsHLine = new QFrame (_bottomOptionsFrame, "_showEmptySlotsHLine"); _showEmptySlotsHLine->setFrameShape (QFrame::HLine); _showEmptySlotsHLine->setFrameShadow (QFrame::Sunken); _showEmptySlotsHBoxLayout->addWidget (_showEmptySlotsHLine); _bottomOptionsVBoxLayout->addWidget (_showEmptySlotsFrame); _bottomOptionsVBoxLayout->addWidget (_showSubslotsFrame); _bottomOptionsVBoxLayout->addWidget (_showEmptySlotsHLine); _bottomOptionsVBoxLayout->setStretchFactor (_showEmptySlotsFrame, 0); _bottomOptionsVBoxLayout->setStretchFactor (_showSubslotsFrame, 0); _bottomOptionsVBoxLayout->setStretchFactor (_showEmptySlotsHLine, 0); // ***************************************** // *** Show Empty Slots Checkbox Frame *** // ***************************************** _showEmptySlotsCheckBox = new QCheckBox (_showEmptySlotsFrame, "_showEmptySlotsCheckBox"); _showEmptySlotsHBoxLayout->addWidget (_showEmptySlotsCheckBox); _showEmptySlotsHBoxLayout->addItem (new rwQHorizontalStrut (15)); _showSuppliesCheckBox = new QCheckBox (_showEmptySlotsFrame, "_showSuppliesCheckBox"); _showEmptySlotsHBoxLayout->addWidget (_showSuppliesCheckBox); _showEmptySlotsHBoxLayout->addItem (new rwQHorizontalSpring (0)); _showEmptySlotsCheckBox->setText (tr("Show empty Slots")); RwQtUtils::qButtonLimitWidth (_showEmptySlotsCheckBox); _showSuppliesCheckBox->setText (tr("Show Supplies")); const bool useShowEmptySlotsToggle ( (_appMode == SQD_APP_MODE_ACCT_EDIT) || (_appMode == SQD_APP_MODE_EXCH_BAL) || (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) ); _showEmptySlotsCheckBox->setChecked (!useShowEmptySlotsToggle); // ************************************** // *** Show Subslots Checkbox Frame *** // ************************************** _showSubslotsCheckBox = new QCheckBox (_showSubslotsFrame, "_showSubslotsCheckBox"); _showSubslotsCheckBox->setText (""); // set in refreshBottomOptionsFrame() bool showSubslotsOn (true); // tentative const bool togSupported = showSubslotsSupported (&showSubslotsOn); _showSubslotsCheckBox->setChecked (showSubslotsOn || !togSupported); _showSubslotsHBoxLayout->addWidget (_showSubslotsCheckBox); _showSubslotsHBoxLayout->addItem (new rwQHorizontalSpring (0)); // -------------------------------------- // signals and slots connections connect (_showEmptySlotsCheckBox, SIGNAL (toggled(bool)), this, SLOT (showEmptySlotsCheckBox_toggled(bool))); connect (_showSubslotsCheckBox, SIGNAL (toggled(bool)), this, SLOT (showSubslotsCheckBox_toggled(bool))); connect (_showSuppliesCheckBox, SIGNAL (toggled(bool)), this, SLOT (showSuppliesCheckBox_toggled(bool))); } /* * Sets the strings of the subwidgets using the current * language. */ void SlotQtDlg::languageChange() { SeriesSlot (*sslot) (dynamic_cast (_slot)); const bool intIndexedSlot(sslot && sslot->usersIndexByInt()); _slotValueLabel->setText (tr ("Value:")); _slotUnitLabel ->setText (tr ("units")); if (_slotNameLabel) _slotNameLabel->setText (QString::null); _objectIconButton->setText (QString::null); if (SCROLL_BUTTON_USES_ICON) { // Replace "Scroll:" text button with icon button _scrollDatePushButton -> setText (QString::null); _scrollDatePushButton -> setPixmap (RwQPixmap16::plotVertCenter()); _scrollDatePushButton -> setMaximumWidth (24); // (16 + (2 * 4)) } else { _scrollDatePushButton ->setText (tr ("Scroll:")); RwQtUtils::qButtonLimitWidth (_scrollDatePushButton); } _plotPushButton ->setText (QString::null); _plotPushButton ->setPixmap (RwQPixmap16::plotSlots()); _plotPushButton ->setMaximumWidth (24); // (16 + (2 * 4)) QToolTip::remove (_plotPushButton); QToolTip::add (_plotPushButton, tr ("Plot the selected columns")); _showDescriptPushButton ->setText (QString::null); _showDescriptPushButton ->setPixmap (RwQPixmap16::notepad1Blue()); _showDescriptPushButton ->setMaximumWidth (24); // (16 + (2 * 4)) _showDescriptPushButton ->setToolTip (tr ("Show Description")); _displayCompressPushButton ->setText (QString::null); _displayCompressPushButton ->setPixmap (RwQPixmap16::displayCompress()); _displayCompressPushButton ->setMaximumWidth (24); // (16 + (2 * 4)) QToolTip::remove (_displayCompressPushButton); QToolTip::add (_displayCompressPushButton, tr ("Series Display Compression")); if (_scrollAnnoPushButton) { _scrollAnnoPushButton ->setText (QString::null); _scrollAnnoPushButton ->setIconSet (RwQPixmap11::annoIcon_Yello()); } // Used only for AggSeriesSlots, under cascading menus _importResizeSelColAction->setText (tr ("&Selected Column")); _importFixedSizeSelColAction->setText (tr ("&Selected Column")); _exportDispPrecSelColAction->setText (tr ("&Selected Column")); _exportModelPrecSelColAction->setText (tr ("&Selected Column")); if (_isAggSeriesSlot) { _importResizeAction->setText (tr ("&All Columns")); _importFixedSizeAction->setText (tr ("&All Columns")); _exportDispPrecAction->setText (tr ("&All Columns")); _exportModelPrecAction->setText (tr ("&All Columns")); } else if (_slot) { _importResizeAction->setText (tr ("Import (&Resize)")); _importFixedSizeAction->setText (tr ("Import (&Fixed Size)")); _exportDispPrecAction->setText (tr ("Export (&Display Precision)")); _exportModelPrecAction->setText (tr ("Export (&Model Precision)")); } else { _importResizeAction->setText (tr ("Import Slot (&Resize)")); _importFixedSizeAction->setText (tr ("Import Slot (&Fixed Size)")); _exportDispPrecAction->setText (tr ("Export Slot (&Display Precision)")); _exportModelPrecAction->setText (tr ("Export Slot (&Model Precision)")); } _plotAction->setText (tr ("&Plot...")); _exprPrintAction->setText (tr ("Print Expression...")); _addToNewSctAction->setText (tr ("Show in New SCT...")); _addToOpenSctAction->setText (tr ("Add to Open SCT...")); _showWorkspaceAction->setText (tr ("Show Workspace...")); _closeWindowAction->setText (tr ("&Close Window")); if (_isAggSeriesSlot) { _cutAction->setText (tr ("Cu&t Cells")); } else { _cutAction->setText (tr ("Cu&t Rows")); } _copyAction->setText (tr ("&Copy")); _pasteAction->setText (tr ("&Paste")); _pasteAsInputAction->setText (tr ("Paste As Input")); _exportCopyAction->setText (tr ("Export Copy...")); _importPasteAction->setText (tr ("Import Paste...")); if (_isAggSeriesSlot) { _insertRowCopyAction->setText (tr ("Insert Copied Cells")); _insertRowNewAction->setText (tr ("&Insert New Cell")); _appendRowAction->setText (tr ("&Append New Cell")); _deleteRowsAction->setText (tr ("&Delete Cells")); _deleteRowsBelowAction->setText (tr ("Delete Cells &Below")); } else { _insertRowCopyAction->setText (tr ("Insert Copied Rows")); _insertRowNewAction->setText (tr ("&Insert New Row")); _appendRowAction->setText (tr ("&Append New Row")); _deleteRowsAction->setText (tr ("&Delete Rows")); _deleteRowsBelowAction->setText (tr ("Delete Rows &Below")); } _clearAllOutputsAction->setText (tr ("Clear All Outputs")); _fillBelowAction->setText (tr ("&Fill Values Below")); _replaceNansBelowAction->setText (tr ("&Replace NaNs Below")); _interpolateAction->setText (tr ("Interpolate")); _adjustValuesAction->setText (tr ("Adjust Values...")); _clearAction->setText (tr ("Clear")); const bool singleColumnBlocks (SlotGUIUtils::getBlockSize (_slot) == 1); if (singleColumnBlocks) { _setNumBlocksAction->setText (tr ("Set Number of Columns")); _insertTableColAction->setText (tr ("Insert Column")); _appendBlockAction->setText (tr ("Append Column")); _deleteBlockAction->setText (tr ("Delete Column")); _deleteLastBlockAction->setText (tr ("Delete Last Column")); // Insert Column (for single column blocks) is supported. _insertTableColAction->setVisible (true); } else { _setNumBlocksAction->setText (tr ("Set Number of Blocks")); _insertTableColAction->setText (tr ("Insert Block")); _appendBlockAction->setText (tr ("Append Block")); _deleteBlockAction->setText (tr ("Delete Block")); _deleteLastBlockAction->setText (tr ("Delete Last Block")); // Insert Block not yet supported _insertTableColAction->setVisible (false); } _setDimensionsAction->setText (tr ("Set Dimensions")); _setColumnValueAction->setText (tr ("Set Column Value...")); _maxSyncAction->setText (tr ("&Max Synch")); _syncToColumn0Action->setText (tr ("&Sync to Column 0")); _slotTest1Action ->setText (tr ("Set Test Values")); _slotTest2Action ->setText (tr ("Compare Test Values")); _slotTest3Action ->setText (tr ("Apply PartialDateTime Scope")); if (_account != NULL) { _configureAction->setText (tr ("&Open Account...")); // Gnats 4294 } else { _configureAction->setText (tr ("&Configure...")); } if (intIndexedSlot) { _seriesRangeAction->setText (tr ("Series Range...")); } else if (_isRplExprSeriesSlot) { _seriesRangeAction->setText (tr ("Evaluation Range...")); } else { _seriesRangeAction->setText (tr ("&Time Series Range...")); } _columnLabelsAction -> setText (tr ("Edit Column Labels...")); _rowLabelsAction -> setText (tr ("Edit Row Labels...")); _showColSumRowAction -> setText (tr ("Show Column Sum Row")); _showPrioritiesAction -> setText (tr ("Show Priorities")); _showNotesColAction -> setText (tr ("Show Notes Column")); _showDispCompAction -> setText (tr ("Series Display Compression")); _showSelStatsAction -> setText (tr ("Show Selection Statistics")); // Tentative text: Computed in "about to show" _showCommaSepsAction -> setText (tr ("SHOW COMMA SEPARATORS")); _openAccountsMgrAction -> setText (tr ("Accounts Manager...")); _openSuppliesMgrAction -> setText (tr ("Supplies Manager...")); _openExchangesMgrAction -> setText (tr ("Exchanges Manager...")); _acctSysConfigAction -> setText (tr ("Account System Configuration...")); _useAcctColorsAction -> setText (tr ("Account TimeStep Graphics")); _showAcctLegendAction -> setText (tr ("Show Account Color Legend ...")); _editAnnoGroupAction -> setText (tr ("Edit ...")); _showExpressionAction -> setText (tr ("Show Expression")); _addDescriptionAction -> setText (tr ("Add Description...")); _showDescriptionAction -> setText (tr ("Show Description")); _setInputSelAction -> setText (tr ("Set to &Input")); _setInputAllAction -> setText (tr ("Set All to I&nput")); _setOutputSelAction -> setText (tr ("Set to &Output")); _setOutputAllAction -> setText (tr ("Set All to O&utput")); _clearSelNonInputsAction -> setText (tr ("Clear Non-Inputs")); _clearSelValuesAction -> setText (tr ("Clear Values")); _clearAllValuesAction -> setText (tr ("Clear All Values")); _reverseIOAction -> setText (tr ("&Reverse Input/Output")); _reverseIOAllAction -> setText (tr ("R&everse Input/Output All")); _setTargetBeginAction -> setText (tr ("T&arget Begin")); _setTargetAction -> setText (tr ("&Target")); _setBestEfficiencyAction -> setText (tr ("&Best Efficiency")); _setMaxCapacityAction -> setText (tr ("&Max Capacity")); _setUnitValuesFlagAction -> setText (tr ("Unit Values")); _setDriftAction -> setText (tr ("&Drift")); _configSaveAsAction -> setText (tr ("&Save as ...")); _setColWidthsAction -> setText (tr ("&Set Column Widths")); _growColsToDataAction -> setText (tr ("&Grow Columns to Fit Data")); _fitColsToDataAction -> setText (tr ("Fit Columns to &Data")); _fitColsToAllAction -> setText (tr ("&Fit Columns to Headers and Data")); _fitColsToHeadAction -> setText (tr ("Fit Columns to &Headers")); _perioSlot_SetRowDate -> setText (tr ("Set Row Date")); _perioSlot_AddRow -> setText (tr ("Add Row")); _perioSlot_DupRow -> setText (tr ("Duplicate Row")); _perioSlot_DelRows -> setText (tr ("Delete Rows")); _perioSlot_AddColumn -> setText (tr ("Add Column")); _perioSlot_DupColumn -> setText (tr ("Duplicate Column")); _perioSlot_DelColumn -> setText (tr ("Delete Column")); // ******************** // *** Accelerators *** // ******************** _importResizeAction -> setAccel (tr ("Ctrl+I")); _importFixedSizeAction -> setAccel (tr ("Ctrl+Shift+I")); _exportDispPrecAction -> setAccel (tr ("Ctrl+E")); _exportModelPrecAction -> setAccel (tr ("Ctrl+Shift+E")); _plotAction -> setAccel (tr ("Ctrl+P")); _closeWindowAction -> setAccel (tr ("Ctrl+W")); if (_isRplExprSeriesSlot) { _exprPrintAction -> setAccel (tr ("Ctrl+Shift+P")); } else { _cutAction -> setAccel (tr ("Ctrl+X")); _copyAction -> setAccel (tr ("Ctrl+C")); _pasteAction -> setAccel (tr ("Ctrl+V")); _showPrioritiesAction -> setAccel (tr ("Ctrl+Shift+P")); } _insertRowNewAction -> setAccel (tr ("Alt+=")); _appendRowAction -> setAccel (tr ("Ctrl+=")); _fillBelowAction -> setAccel (tr ("Ctrl+D")); _setDimensionsAction -> setAccel (tr ("Ctrl+Shift+D")); if (_account != NULL) { _configureAction -> setAccel (tr ("Alt+Shift+O")); // Gnats 4294 } else { _configureAction -> setAccel (tr ("Alt+Shift+C")); } _setInputSelAction -> setAccel (tr ("Alt+I")); _setInputAllAction -> setAccel (tr ("Ctrl+Alt+I")); if ( _isAcctSlot || _isSplySlot || (_exchange != NULL) || (_acctSlotSum != NULL) ) { _clearSelValuesAction -> setAccel (tr ("Alt+O")); _clearAllValuesAction -> setAccel (tr ("Ctrl+Alt+O")); } else { _setOutputSelAction -> setAccel (tr ("Alt+O")); _setOutputAllAction -> setAccel (tr ("Ctrl+Alt+O")); } _setTargetAction -> setAccel (tr ("Ctrl+T")); _setBestEfficiencyAction -> setAccel (tr ("Ctrl+B")); _setMaxCapacityAction -> setAccel (tr ("Ctrl+M")); } //---------------------------------------------------------------------------- // protected // // METHOD: // void initConnections() // // PURPOSE: // Initializes the connections between SlotQtDlg signals and slots // //---------------------------------------------------------------------------- void SlotQtDlg::initConnections() { const bool onDataObj (_simObj && _simObj->isDataObj()); if (_objAcctSumSel) { connect (_objAcctSumSel, SIGNAL (acctSlotSumSettingsChanged()), this, SLOT (acctSlotSumSettingsChanged())); connect (_objAcctSumSel, SIGNAL (acctSlotSumObjSelected (const QString&)), this, SLOT (acctSlotSumObjSelected (const QString&))); } if (_acctOrderPanel) { connect (_acctOrderPanel, SIGNAL (acctSlotSumAcctListChanged()), this, SLOT (acctSlotSumAcctListChanged())); } if (_tstepSelPanel) { connect (_tstepSelPanel, SIGNAL (acctSlotSumTstepListChanged()), this, SLOT (acctSlotSumTstepListChanged())); connect (_tstepSelPanel, SIGNAL (setLocalScroll (const Date_Time&)), this, SLOT (tstepSelPanel_setLocalScroll (const Date_Time&))); } connect (_closeWindowAction, SIGNAL (activated()), this, SLOT (close())); connect (_objectIconButton, SIGNAL (clicked()), this, SLOT (objectIconClicked())); if (_acctIconButton != NULL) { connect (_acctIconButton, SIGNAL (clicked()), this, SLOT (acctIconButtonClicked())); } connect (_scrollDatePushButton, SIGNAL (clicked()), this, SLOT (scrollDatePushButtonClicked())); connect (_unitTypeFlowPushButton, SIGNAL (toggled(bool)), this, SLOT (unitTypeFlowPushButtonToggled(bool))); connect (_plotPushButton, SIGNAL (clicked()), this, SLOT (plotPushButtonClicked())); connect (_showDescriptPushButton, SIGNAL (clicked()), this, SLOT (showDescriptPushButtonClicked())); connect (_displayCompressPushButton, SIGNAL (clicked()), this, SLOT (displayCompressPushButtonClicked())); connect (_viewMenu, SIGNAL (aboutToShow()), this, SLOT (viewMenu_aboutToShow())); connect (_adjustMenu, SIGNAL (aboutToShow()), this, SLOT (adjustPopupMenu_aboutToShow())); if (_rowMenu != NULL) { connect (_rowMenu, SIGNAL (aboutToShow()), this, SLOT (rowMenu_aboutToShow())); } if (_columnMenu != NULL) { connect (_columnMenu, SIGNAL (aboutToShow()), this, SLOT (columnMenu_aboutToShow())); } if (_sctMenu != NULL) { connect (_sctMenu, SIGNAL (aboutToShow()), this, SLOT (sctMenu_aboutToShow())); } if (_configMenu != NULL) { connect (_configMenu, SIGNAL (aboutToShow()), this, SLOT (configMenu_aboutToShow())); } if (_linkedSlotsPopupMenu != NULL) { connect (_linkedSlotsPopupMenu, SIGNAL (aboutToShow()), this, SLOT (linkedSlotsPopupMenu_aboutToShow())); } if (_noteGroupsMenu) { connect (_noteGroupsMenu, SIGNAL (aboutToShow()), this, SLOT (noteGroupsPopupMenu_aboutToShow())); connect (_noteGroupsMenu, SIGNAL (triggered (QAction*)), this, SLOT (noteGroupsPopupMenu_actionTriggered (QAction*))); } if (_scrollAnnoPopupMenu) { connect (_scrollAnnoPopupMenu, SIGNAL (aboutToShow()), this, SLOT (scrollAnnoPopupMenu_aboutToShow())); connect (_scrollAnnoPopupMenu, SIGNAL (triggered (QAction*)), this, SLOT (scrollAnnoPopupMenu_actionTriggered (QAction*))); } connect (_configureAction, SIGNAL (activated()), this, SLOT (configUnitsHandler())); connect (_seriesRangeAction, SIGNAL (activated()), this, SLOT (configSeriesHandler())); connect (_columnLabelsAction, SIGNAL (activated()), this, SLOT (setColumnLabelsAction())); connect (_rowLabelsAction, SIGNAL (activated()), this, SLOT (setRowLabelsAction())); connect (_showColSumRowAction, SIGNAL (toggled (bool)), this, SLOT (showColSumRowHandler (bool))); connect (_showPrioritiesAction, SIGNAL (toggled (bool)), this, SLOT (showPrioritiesHandler (bool))); connect (_showNotesColAction, SIGNAL (toggled (bool)), this, SLOT (showNotesColHandler (bool))); connect (_showCommaSepsAction, SIGNAL (toggled (bool)), this, SLOT (showCommaSepsHandler (bool))); connect (_showDispCompAction, SIGNAL (toggled (bool)), this, SLOT (showDispCompHandler (bool))); connect (_showSelStatsAction, SIGNAL (toggled (bool)), this, SLOT (showSelStatsHandler (bool))); connect (_editAnnoGroupAction, SIGNAL (activated()), this, SLOT (editAnnoGroupHandler())); connect (_addDescriptionAction, SIGNAL (activated()), this, SLOT (addDescriptionHandler())); connect (_showDescriptionAction, SIGNAL (toggled (bool)), this, SLOT (showDescriptionHandler (bool))); connect (_openAccountsMgrAction, SIGNAL (activated()), this, SLOT (openAccountsMgr_activated())); connect (_openSuppliesMgrAction, SIGNAL (activated()), this, SLOT (openSuppliesMgr_activated())); connect (_openExchangesMgrAction, SIGNAL (activated()), this, SLOT (openExchangesMgr_activated())); connect (_acctSysConfigAction, SIGNAL (activated()), this, SLOT (openAcctSysConfig_activated())); connect (_useAcctColorsAction, SIGNAL (toggled (bool)), this, SLOT (useAcctColorsToggled (bool))); connect (_showAcctLegendAction, SIGNAL (activated()), this, SLOT (showAcctLegend_activated ())); connect (_setDimensionsAction, SIGNAL (activated()), this, SLOT (setDimensionsHandler())); if (onDataObj && _slotNameEdit) { connect (_slotNameEdit, SIGNAL (returnPressed()), this, SLOT (nameTextChanged())); connect (_slotNameEdit, SIGNAL (lostFocus()), this, SLOT (nameTextChanged())); } connect (_plotAction, SIGNAL (activated()), this, SLOT (plotSlot())); connect (_addToNewSctAction, SIGNAL (activated()), this, SLOT (addToNewSct_activated())); connect (_addToOpenSctAction, SIGNAL (activated()), this, SLOT (addToOpenSct_activated())); connect (_showWorkspaceAction, SIGNAL (activated()), this, SLOT (showWorkspaceAction_activated())); connect (_importResizeAction, SIGNAL (activated()), this, SLOT (importResize())); connect (_importFixedSizeAction, SIGNAL (activated()), this, SLOT (importFixed())); connect (_exportDispPrecAction, SIGNAL (activated()), this, SLOT (exportDisplay())); connect (_exportModelPrecAction, SIGNAL (activated()), this, SLOT (exportModel())); connect (_importResizeSelColAction, SIGNAL (activated()), this, SLOT (importResizeSelCol())); connect (_importFixedSizeSelColAction, SIGNAL (activated()), this, SLOT (importFixedSelCol())); connect (_exportDispPrecSelColAction, SIGNAL (activated()), this, SLOT (exportDisplaySelCol())); connect (_exportModelPrecSelColAction, SIGNAL (activated()), this, SLOT (exportModelSelCol())); connect (_configSaveAsAction, SIGNAL (activated()), this, SLOT (configSaveAs_activated())); connect (_slotTest1Action, SIGNAL (activated()), this, SLOT (slotTest1Handler())); connect (_slotTest2Action, SIGNAL (activated()), this, SLOT (slotTest2Handler())); connect (_slotTest3Action, SIGNAL (activated()), this, SLOT (slotTest3Handler())); if (_dispCompressPanel) { connect (_dispCompressPanel, SIGNAL (compressionSpecChanged (const DisplayCompressSpec&)), this, SLOT (displayCompressSpec_changed (const DisplayCompressSpec&))); connect (_dispCompressPanel, SIGNAL (compressionRecomputeNeeded (const DisplayCompressSpec&)), this, SLOT (displayCompressRecomp_needed (const DisplayCompressSpec&))); } connect (_exprPrintAction, SIGNAL (activated()), this, SLOT (printRplExpression())); // ******************************************* // *** Initialize myriad Connecions to the *** // *** currently installed SlotQDlgTable. *** // ******************************************* initQTableConnections(); } //---------------------------------------------------------------------------- // protected // // METHOD: // void initQTableConnections() // // PURPOSE: // Initializes the connections between SlotQtDlg signals and // SlotQDlgTable slots // //---------------------------------------------------------------------------- void SlotQtDlg::initQTableConnections() { static const char (*mname) ("SlotQtDlg::initQTableConnections()"); // std::cout << mname << " " // << (_slotDataTable ? _slotDataTable->name() : "") // << std::endl; SlotQDlgTable* tab (_slotDataTable); if (tab == NULL) return; //-------------------->> tab->clearClientSignals(); // Note: SlotQDlgTable::mainPopupMenuAboutToShow() calls // sensitizeOperations() after computing the cell operation selections. tab->connectClientSignal (_fileMenu, SIGNAL (aboutToShow()), SLOT (mainPopupMenuAboutToShow())); tab->connectClientSignal (_editMenu, SIGNAL (aboutToShow()), SLOT (mainPopupMenuAboutToShow())); tab->connectClientSignal (_viewMenu, SIGNAL (aboutToShow()), SLOT (mainPopupMenuAboutToShow())); if (_timestepMenu) { tab->connectClientSignal (_timestepMenu, SIGNAL (aboutToShow()), SLOT (mainPopupMenuAboutToShow())); } tab->connectClientSignal (_cutAction, SIGNAL (activated()), SLOT (cut_handler())); tab->connectClientSignal (_copyAction, SIGNAL (activated()), SLOT (copy_handler())); tab->connectClientSignal (_pasteAction, SIGNAL (activated()), SLOT (paste_handler())); tab->connectClientSignal (_pasteAsInputAction, SIGNAL (activated()), SLOT (pasteAsInput_handler())); tab->connectClientSignal (_exportCopyAction, SIGNAL (activated()), SLOT (exportCopy_handler())); tab->connectClientSignal (_importPasteAction, SIGNAL (activated()), SLOT (importPaste_handler())); tab->connectClientSignal (_insertRowCopyAction, SIGNAL (activated()), SLOT (insertCopied_handler())); tab->connectClientSignal (_clearAllOutputsAction, SIGNAL (activated()), SLOT (clearAllOutputs_handler())); tab->connectClientSignal (_fillBelowAction, SIGNAL (activated()), SLOT (fillValuesBelow_handler())); tab->connectClientSignal (_replaceNansBelowAction, SIGNAL (activated()), SLOT (replaceNaNsBelow_handler())); tab->connectClientSignal (_interpolateAction, SIGNAL (activated()), SLOT (interpolate_handler())); tab->connectClientSignal (_adjustValuesAction, SIGNAL (activated()), SLOT (adjustValues_handler())); tab->connectClientSignal (_setColumnValueAction, SIGNAL (activated()), SLOT (setColumnValue_handler())); tab->connectClientSignal (_insertRowNewAction, SIGNAL (activated()), SLOT (insertNewRow_handler())); tab->connectClientSignal (_appendRowAction, SIGNAL (activated()), SLOT (appendNewRow_handler())); tab->connectClientSignal (_deleteRowsAction, SIGNAL (activated()), SLOT (deleteRows_handler())); tab->connectClientSignal (_deleteRowsBelowAction, SIGNAL (activated()), SLOT (deleteRowsBelow_handler())); tab->connectClientSignal (_setNumBlocksAction, SIGNAL (activated()), SLOT (setNumBlocks_handler())); tab->connectClientSignal (_insertTableColAction, SIGNAL (activated()), SLOT (insertTableColumn_handler())); tab->connectClientSignal (_appendBlockAction, SIGNAL (activated()), SLOT (appendBlock_handler())); tab->connectClientSignal (_deleteBlockAction, SIGNAL (activated()), SLOT (deleteBlock_handler())); tab->connectClientSignal (_deleteLastBlockAction, SIGNAL (activated()), SLOT (deleteLastBlock_handler())); tab->connectClientSignal (_maxSyncAction, SIGNAL (activated()), SLOT (maxSyncAction_handler())); tab->connectClientSignal (_syncToColumn0Action, SIGNAL (activated()), SLOT (syncToColumn0Action_handler())); tab->connectClientSignal (_setInputSelAction, SIGNAL (activated()), SLOT (setFlagInput_handler())); tab->connectClientSignal (_setInputAllAction, SIGNAL (activated()), SLOT (setFlagInputAll_handler())); tab->connectClientSignal (_setOutputSelAction, SIGNAL (activated()), SLOT (setFlagOutput_handler())); tab->connectClientSignal (_setOutputAllAction, SIGNAL (activated()), SLOT (setFlagOutputAll_handler())); tab->connectClientSignal (_clearSelNonInputsAction, SIGNAL (activated()), SLOT (clearSelOutputs_handler())); tab->connectClientSignal (_clearSelValuesAction, SIGNAL (activated()), SLOT (clearSelValues_handler())); tab->connectClientSignal (_clearAllValuesAction, SIGNAL (activated()), SLOT (clearAllValues_handler())); tab->connectClientSignal (_reverseIOAction, SIGNAL (activated()), SLOT (reverseFlag_handler())); tab->connectClientSignal (_reverseIOAllAction, SIGNAL (activated()), SLOT (reverseFlagAll_handler())); tab->connectClientSignal (_setTargetBeginAction, SIGNAL (activated()), SLOT (setFlagTargetBegin_handler())); tab->connectClientSignal (_setTargetAction, SIGNAL (activated()), SLOT (setFlagTarget_handler())); tab->connectClientSignal (_setBestEfficiencyAction, SIGNAL (activated()), SLOT (setFlagBestEfficiency_handler())); tab->connectClientSignal (_setMaxCapacityAction, SIGNAL (activated()), SLOT (setFlagBestCapacity_handler())); tab->connectClientSignal (_setUnitValuesFlagAction, SIGNAL (activated()), SLOT (setFlagUnitValues_handler())); tab->connectClientSignal (_setDriftAction, SIGNAL (activated()), SLOT (setFlagDrift_handler())); tab->connectClientSignal (_growColsToDataAction, SIGNAL (activated()), SLOT (growColsToData_handler())); tab->connectClientSignal (_fitColsToHeadAction, SIGNAL (activated()), SLOT (fitColsToHead_handler())); tab->connectClientSignal (_fitColsToDataAction, SIGNAL (activated()), SLOT (fitColsToData_handler())); tab->connectClientSignal (_fitColsToAllAction, SIGNAL (activated()), SLOT (fitColsToAll_handler())); tab->connectClientSignal (_setColWidthsAction, SIGNAL (activated()), SLOT (setColWidths_handler())); tab->connectClientSignal (_perioSlot_SetRowDate, SIGNAL (activated()), SLOT (perioSlot_SetRowDate_handler())); tab->connectClientSignal (_perioSlot_AddRow, SIGNAL (activated()), SLOT (perioSlot_AddRow_handler())); tab->connectClientSignal (_perioSlot_DupRow, SIGNAL (activated()), SLOT (perioSlot_DupRow_handler())); tab->connectClientSignal (_perioSlot_DelRows, SIGNAL (activated()), SLOT (perioSlot_DelRows_handler())); tab->connectClientSignal (_perioSlot_AddColumn, SIGNAL (activated()), SLOT (perioSlot_AddColumn_handler())); tab->connectClientSignal (_perioSlot_DupColumn, SIGNAL (activated()), SLOT (perioSlot_DupColumn_handler())); tab->connectClientSignal (_perioSlot_DelColumn, SIGNAL (activated()), SLOT (perioSlot_DelColumn_handler())); } //---------------------------------------------------------------------------- //+protected // // METHOD: // SlotQtDlg::initDateTime() // // PURPOSE: // Initialize the date time editor with current info from RunInfo //---------------------------------------------------------------------------- void SlotQtDlg::initDateTime() { if (_scrollDateSpinner == NULL) return; //----------------------------------->> _scrollDateSpinner->setDisplayFormat ( DT_SPIN_USE_3LETTER_MONTHS ? DateTimeQtSpinner::ABRIDGED_ABBRV_FMT : DateTimeQtSpinner::ABRIDGED_FMT); SimWorkspace* ws = rwSystem->getSimWorkspace(); RunInfo* ri = (ws ? ws->getRunInfo() : NULL); // default values: use run control DeltaTime delta (ri->getRunStep()); Date_Time startDate (ri->getStartDate (true)); // getRunInitDate Date_Time endDate (*(ri->getEndDate())); if (_slot && SlotGUIUtils::hasSeries(_slot)) { delta = SlotGUIUtils::getStep(_slot); startDate = *SlotGUIUtils::getSlotStartDate(_slot); endDate = *SlotGUIUtils::getSlotEndDate(_slot); } else if (_account) { SlotGUIUtils::getAccountSeriesTimeRange (_account, delta, startDate, endDate); } else if (_exchange) { SlotGUIUtils::getExchBalanceSeriesTimeRange (_exchange, delta, startDate, endDate); } else if (_acctSlotSum) { SlotGUIUtils::getAcctSlotSumSeriesTimeRange (_acctSlotSum, delta, startDate, endDate); } // Use the earliest and latest allowed riverware date_times const Date_Time earliestDate = *(Date_Time::getEarliestAllowedDateTime()); const Date_Time latestDate = *(Date_Time::getLatestAllowedDateTime()); // // Initialize the internal dates for the date time spinner // _scrollDateSpinner->init (delta, // const DeltaTime& timeStep earliestDate, // const Date_Time& baseDateTime earliestDate, // const Date_Time& minDateTime latestDate, // const Date_Time& maxDateTime startDate); // const Date_Time& currDateTime const Date_Time globalDateTime (DateTimeQtSpinner::globalScrollDateTime()); scrollToDate (globalDateTime); // Include this spinner in global scroll navigation _scrollDateSpinner->setUsedForNavigation (true); } //---------------------------------------------------------------------------- //+protected // // METHOD: // SlotQtDlg::checkSpinnerRange() // // PURPOSE: // Initialize the date time editor with current info from RunInfo //---------------------------------------------------------------------------- void SlotQtDlg::checkSpinnerRange() { static const char (*mname) ("SlotQtDlg::checkSpinnerRange"); if (!_seriesMode) return; if (_scrollDateSpinner == NULL) return; //----------------------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } _scrollDateSpinner->setDisplayFormat ( DT_SPIN_USE_3LETTER_MONTHS ? DateTimeQtSpinner::ABRIDGED_ABBRV_FMT : DateTimeQtSpinner::ABRIDGED_FMT); SimWorkspace* ws = rwSystem->getSimWorkspace(); RunInfo* ri = (ws ? ws->getRunInfo() : NULL); // default values: use run control DeltaTime delta (ri->getRunStep()); Date_Time startDate (ri->getStartDate (true)); // getRunInitDate Date_Time endDate (*(ri->getEndDate())); if (_slot) { delta = SlotGUIUtils::getStep(_slot); startDate = *SlotGUIUtils::getSlotStartDate(_slot); endDate = *SlotGUIUtils::getSlotEndDate(_slot); } else if (_account) { SlotGUIUtils::getAccountSeriesTimeRange (_account, delta, startDate, endDate); } else if (_exchange) { SlotGUIUtils::getExchBalanceSeriesTimeRange (_exchange, delta, startDate, endDate); } DeltaTime spinDelta (*_scrollDateSpinner->getTimeStep()); Date_Time spinStartDate (*_scrollDateSpinner->getMinDateTime()); Date_Time spinEndDate (*_scrollDateSpinner->getMaxDateTime()); Date_Time spinCurDate (*_scrollDateSpinner->getDateTime()); const bool stepChange (delta != spinDelta); if ( (!stepChange) && (startDate == spinStartDate) && (endDate == spinEndDate) ) return; //--------------------------------------->> // Insure that current date is within new range if (stepChange) { spinCurDate = startDate; } else if (spinCurDate < startDate) { spinCurDate = startDate; } else if (spinCurDate > endDate) { spinCurDate = endDate; } // Re-Initialize internal dates for the date time spinner _scrollDateSpinner->init (delta, // const DeltaTime& timeStep startDate, // const Date_Time& baseDateTime startDate, // const Date_Time& minDateTime endDate, // const Date_Time& maxDateTime spinCurDate); // const Date_Time& currDateTime } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::initShowEmptySlotsCheckBox() { if ( (_acctSlotSum != NULL) && (_showEmptySlotsCheckBox != NULL) ) { const bool checked = _showEmptySlotsCheckBox->isChecked(); const bool flagOn = _acctSlotSum->showEmptySlots(); if (checked != flagOn) { _showEmptySlotsCheckBox->setChecked (flagOn); } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::initShowSuppliesCheckBox() { if (_showSuppliesCheckBox == NULL) return; //-------------------------------------->> bool timeColMode (false); bool flagOn (false); if (_acctSlotSum != NULL) { AcctSlotSummary::ColMode colMode = _acctSlotSum->colMode(); timeColMode = (colMode == AcctSlotSummary::COL_MODE_TIME); // Note: "Show Supplies" is currently supported // only in TimeStep Column mode. // flagOn = timeColMode && _acctSlotSum->showSupplies(); } const bool checked = _showSuppliesCheckBox->isChecked(); if (checked != flagOn) { _showSuppliesCheckBox->setChecked (flagOn); } // Note: "Show Supplies" is currently supported // only in TimeStep Column mode. // _showSuppliesCheckBox->setEnabled (timeColMode); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- bool SlotQtDlg::descriptionShown() const { const bool isShown = _descToggles && _descToggles->isToggleOn (_descTogglesIndex_desc); return (isShown); } bool SlotQtDlg::descriptionDefined() const { const bool slotHasDesc = _slot && _slot->hasUserDesc(); return (slotHasDesc); } //---------------------------------------------------------------------------- // Updates the display of the stat fn's configuration options. //---------------------------------------------------------------------------- void SlotQtDlg::refreshObjectName() { static const char* mname ("SlotQtDlg::refreshObjectName"); if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } if (_slot != NULL) { _slotAcct = _slot->getAccount(); // may be NULL setCaption (_slot->getCompleteName()); if (_slotNameEdit != NULL) { _slotNameEdit->setText (_slot->getName()); // Move position to left side of Slot Name so that if any visual // truncation occurs, at least the beginning of the Slot Name is // visible. // _slotNameEdit->home (false); // don't mark } if (_slotNameLabel) { QToolTip::remove (_slotNameLabel); QToolTip::add (_slotNameLabel, _slot->getCompleteName()); } } else if (_account != NULL) { setCaption (_account->getCompleteName()); if (_slotNameEdit != NULL) { _slotNameEdit->setText (_account->getCompleteName()); // Move position to left side of Account Name so that if any visual // truncation occurs, at least the beginning of the Slot Name is // visible. // _slotNameEdit->home (false); // don't mark } if (_slotNameLabel) { QToolTip::remove (_slotNameLabel); // Note: The Account Name is already shown in the QLineEdit. // QToolTip::add (_slotNameLabel, _account->getCompleteName()); QToolTip::add (_slotNameLabel, _account->getType()); } } else if (_exchange != NULL) { QString exchCaption ("Exchange Balance -- "); exchCaption += _exchange->getCompleteName(); setCaption (exchCaption); if (_slotNameEdit != NULL) { _slotNameEdit->setText (_exchange->getCompleteName()); // Move position to left side of Account Name so that if any visual // truncation occurs, at least the beginning of the Slot Name is // visible. // _slotNameEdit->home (false); // don't mark } if (_exchBalKeyTreeWidget != NULL) { _exchBalKeyTreeWidget->rebuild(); } } else if (_simObj != NULL) { QString sumTitle ("Object Account Summary - "); sumTitle += _simObj->getName(); setCaption (sumTitle); } if (_acctIconButton) { QToolTip::remove (_acctIconButton); if (_slotAcct != NULL) { QToolTip::add (_acctIconButton, _slotAcct->getCompleteName()); } } if (_objectIconButton) { _objectIconButton->setShown (_simObj != NULL); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::refreshColMapEntityName() { static const char* mname ("SlotQtDlg::refreshColMapEntityName"); if (_shipGoingDown) return; //----------------------->> if (_colMapEntityDispLabel == NULL) return; //--------------------------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } bool hasEntName (false); if (_isTableSlot) { const TableSlot* tslot (dynamic_cast (_slot)); if (tslot) { const QString colMapEntName = tslot->getColMapEntityName(); hasEntName = !colMapEntName.isEmpty(); if (hasEntName) { QString entityDispText ("Column Entity: "); entityDispText += colMapEntName; _colMapEntityDispLabel->setText (entityDispText); } } } _colMapEntityDispLabel->setVisible (hasEntName); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::refreshPartialDateTimeEditor() { static const char (*mname) ("SlotQtDlg::refreshPartialDateTimeEditor"); static int callCnt (0); ++callCnt; if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } // Retrieve Cell Operation Selection List from SlotQDlgTable const SlotQDlgSelectionList& selList ( _slotDataTable->cellOpSelectionsList()); const bool hasOnlyDateTimeVals (selList.hasDateTimeValues (true)); // only int refSlotCol (0); Slot* refSlot (selList.firstSlotAndCol (refSlotCol)); if (refSlot == NULL) { refSlot = _slot; refSlotCol = 0; } // std::cout << mname << " [#" << callCnt << "]" // << (hasOnlyDateTimeVals ? " ENA" : " DIS") // << std::endl; if (_partialDateTimeEditor) { _partialDateTimeEditor->configure (refSlot, refSlotCol); _partialDateTimeEditor->setEnabled (hasOnlyDateTimeVals); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::refreshPeriodicSlotBottomWidgets() { static const char (*mname) ("SlotQtDlg::refreshPeriodicSlotBottomWidgets"); static int callCnt (0); ++callCnt; // std::cout << mname << " [#" << callCnt << "]" << std::endl; if (_shipGoingDown) return; //----------------------->> if (_periodicSlotBottomWidgets == NULL) return; //------------------------------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } static const QString NotPeriodicStr ("Not Periodic Slot"); QString configText (NotPeriodicStr); bool isLookup (false); bool isInterp (false); const PeriodicSlot* pslot = dynamic_cast (_slot); if (pslot) { isLookup = pslot->defaultAccessMethodIsLookup(); isInterp = !isLookup; const TimeLine* rowMap = pslot->getRowMap(); static const QString NullRowMapStr ("Null RowMap TimeLine"); configText = rowMap ? rowMap->configDisplayText() : NullRowMapStr; } const bool changed = ( (isInterp != _periodicInterpRadioBut->isChecked()) || (isLookup != _periodicLookupRadioBut->isChecked()) || (configText != _periodicTextLabel->text()) ); if (changed) { _periodicInterpRadioBut->setChecked (isInterp); _periodicLookupRadioBut->setChecked (isLookup); _periodicTextLabel->setText (configText); _periodicTextLabel->adjustSize(); _periodicTextLabel->updateGeometry(); _periodicSlotBottomWidgets->adjustSize(); _periodicSlotBottomWidgets->updateGeometry(); updateGeometry(); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::refreshStatusBar (bool doInvalidateSelection /*=true*/) { static const char* mname ("SlotQtDlg::refreshStatusBar"); if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } if (_slotDataTable && doInvalidateSelection) { _slotDataTable->invalidateSelection(); } if (_selStatFrame) { _selStatFrame->updateStatusBar ((SeriesSlot*) NULL, false); // dataChangeOnly } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- bool SlotQtDlg::showingEmptySlots() const { bool doShowEmptySlots (true); // tentative if (_acctSlotSum) { doShowEmptySlots = _acctSlotSum->showEmptySlots(); } else if (_showEmptySlotsCheckBox != NULL) { doShowEmptySlots = _showEmptySlotsCheckBox->isChecked(); } return (doShowEmptySlots); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- bool SlotQtDlg::showingSupplies() const { bool doShowSupplies (false); // tentative bool timeColMode (false); if (_acctSlotSum != NULL) { AcctSlotSummary::ColMode colMode = _acctSlotSum->colMode(); timeColMode = (colMode == AcctSlotSummary::COL_MODE_TIME); } if (!timeColMode) { // Note: "Show Supplies" currently supported only // only in TimeStep Column Mode. // doShowSupplies = false; } else if (_acctSlotSum) { doShowSupplies = _acctSlotSum->showSupplies(); } else if (_showSuppliesCheckBox != NULL) { doShowSupplies = _showSuppliesCheckBox->isChecked(); } return (doShowSupplies); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::installNewAcctSlotSummary (AcctSlotSummary* src) { if (_shipGoingDown) return; if (src == NULL) return; //----------------------->> //------------------------------------------------------------ const bool saveInProg = _installNewAcctSlotSummary_inProgress; _installNewAcctSlotSummary_inProgress = true; //------------------------------------------------------------ deleteAllSlotCallbacks(); if (_acctSlotSum == NULL) { _acctSlotSum = new AcctSlotSummary(); } // Copy source *_acctSlotSum = *src; initShowSuppliesCheckBox(); const bool doShowSupplies = showingSupplies(); initShowEmptySlotsCheckBox(); const bool doShowEmptySlots = showingEmptySlots(); if (_objAcctSumSel != NULL) { _objAcctSumSel->setConfig (_acctSlotSum); } AcctSlotSummary::ColMode colMode (_acctSlotSum->colMode()); if (_acctOrderPanel != NULL) { const bool showAcctOrderPanel = (colMode == AcctSlotSummary::COL_MODE_ACCTS) || (colMode == AcctSlotSummary::COL_MODE_TIME); _acctOrderPanel->setShown (showAcctOrderPanel); _acctOrderPanel->updateAcctList (_acctSlotSum); } if (_tstepSelPanel) { _tstepSelPanel->setShown (colMode == AcctSlotSummary::COL_MODE_TIME); _tstepSelPanel->updateTstepList (_acctSlotSum); } //------------------------------------------------------------ _installNewAcctSlotSummary_inProgress = saveInProg; //------------------------------------------------------------ if (_slotDataTable != NULL) { installSlotDataTable (_acctSlotSum); // Re-establish Slot Callbacks deleteAllSlotCallbacks(); addAcctSlotSumSlotCallbacks (_acctSlotSum); _slotDataTable->setShowSupplies (doShowSupplies); _slotDataTable->setShowEmptySlots (doShowEmptySlots); _slotDataTable->refreshShownSupplies(); _slotDataTable->refreshShowHideSlotItems(); schedRefreshDisplayCompression(); _slotDataTable->growColsToData_handler(); } if (_acctOrderPanel) { _acctOrderPanel->schedCustomUpdateGeometry(); } if (_tstepSelPanel) { _tstepSelPanel->schedCustomUpdateGeometry(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::refreshBottomOptionsFrame() { static const char* mname ("SlotQtDlg::refreshBottomOptionsFrame"); if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } const bool showShowEmptySlotsFrame ( (_appMode == SQD_APP_MODE_ACCT_EDIT) || (_appMode == SQD_APP_MODE_EXCH_BAL) || (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) ); const bool showShowSubslotsFrame (showSubslotsSupported()); const bool showBottomOptions ( showShowEmptySlotsFrame || showShowSubslotsFrame ); if (showShowSubslotsFrame && (_showSubslotsCheckBox != NULL)) { QString cboxText ("Show Subslots"); // tentative AggSeriesSlot* asSlot (dynamic_cast (_slot)); MultiSlot* mSlot (dynamic_cast (_slot)); if (asSlot != NULL) { cboxText.sprintf ("Show Slot Columns (%d)", asSlot->numSeriesSlots()); } else if (mSlot != NULL) { cboxText.sprintf ("Show Subslots (%d)", mSlot->numSubSlots()); } _showSubslotsCheckBox->setText (cboxText); RwQtUtils::qButtonLimitWidth (_showSubslotsCheckBox); } _showEmptySlotsFrame -> setVisible (showShowEmptySlotsFrame); _showSubslotsFrame -> setVisible (showShowSubslotsFrame); _showEmptySlotsHLine -> setVisible (false); // not used now. _bottomOptionsFrame -> setVisible (showBottomOptions); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addSlotCallbacks (Slot* slot) { static const char (*mname) ("SlotQtDlg::addSlotCallbacks"); if (CALLBACK_DEBUG) { std::cout << mname << (slot ? " SLOT" : " NULL") << std::endl; } if (slot == NULL) return; //--------------------->> Slot (*prevColSlot) (NULL); // If a callback is already registered for this slot, // don't add another one. CbMapIterator slotIter = _slotCallbacks.find(slot); if (slotIter == _slotCallbacks.end()) { MethodCb* cb = new MethodCb( this, &SlotQtDlg::slotCallbackHandler, ANY_CALLBACK_TYPE); slot->addCCallback (ANY_CALLBACK_TYPE, cb); _slotCallbacks.insert (CbMap::value_type(slot, cb)); prevColSlot = slot; if (CALLBACK_DEBUG) { std::cout << mname << ": " << qPrintable(slot->getCompleteName()) << std::endl; } } const int slotColCnt (SlotGUIUtils::getNumCols (slot)); for (int col = 0; col < slotColCnt; ++col) { Slot (*colSlot) (SlotGUIUtils::getColSubSlot (slot, col)); if (colSlot == NULL) continue; if (colSlot == prevColSlot) continue; //----------------------------------- // If a callback is already registered for this slot, // don't add another one. CbMapIterator slotIter2 = _slotCallbacks.find(colSlot); if (slotIter2 != _slotCallbacks.end()) continue; //---------------------------------------------- MethodCb* cb = new MethodCb( this, &SlotQtDlg::slotCallbackHandler, ANY_CALLBACK_TYPE); colSlot->addCCallback (ANY_CALLBACK_TYPE, cb); _slotCallbacks.insert (CbMap::value_type(colSlot, cb)); prevColSlot = colSlot; if (CALLBACK_DEBUG) { std::cout << mname << " [" << col << "]: " << qPrintable(colSlot->getCompleteName()) << std::endl; } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addAcctSlotCallbacks (Account* acct) { if (acct == NULL) return; //--------------------->> Slot (*slotPtr) (NULL); cwIterator slotIter; for (slotPtr = acct->firstSlot (slotIter); slotPtr; slotPtr = acct->nextSlot (slotIter)) { SeriesSlot (*sslot) (dynamic_cast (slotPtr)); if (sslot != NULL) { addSlotCallbacks (sslot); } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addExchSlotCallbacks (Exchange* exch) { static const char (*mname) ("SlotQtDlg::addExchSlotCallbacks"); if (exch == NULL) return; //--------------------->> // std::cout << mname << " " << exch->getCompleteName() << std::endl; std::list slotList; std::list roleStrList; SlotGUIUtils::getExchangeBalanceSlotList (exch, slotList, roleStrList); std::list::const_iterator slotIter; for (slotIter = slotList.begin(); slotIter != slotList.end(); ++slotIter) { Slot (*slotPtr) (*slotIter); if (slotPtr) { addSlotCallbacks (slotPtr); } } slotList.clear(); roleStrList.clear(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addAcctSlotSumSlotCallbacks (AcctSlotSummary* acctSlotSum) { if (acctSlotSum == NULL) return; //---------------------------->> acctSlotSum->computeAcctSlotDomainList(); const cwDlist& slotList = acctSlotSum->acctSlotDomainList(); cwIterator slotIter; for (slotIter = slotList.first(); slotIter; slotIter = slotList.next (slotIter)) { Slot* slotPtr (slotList.elem (slotIter)); SeriesSlot (*sslot) (dynamic_cast (slotPtr)); if (sslot != NULL) { addSlotCallbacks (sslot); } } // ************************************************************ // *** Register callback for Summation Temporary Slots too. *** // ************************************************************ SeriesSlot* domainSumSlot = acctSlotSum->domainSumSlot(); if (domainSumSlot) addSlotCallbacks (domainSumSlot); SeriesSlot* selectedSumSlot = acctSlotSum->selectedSumSlot(); if (selectedSumSlot) addSlotCallbacks (selectedSumSlot); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addRunInfoCallback() { RunInfo (*rinfo) (rwWorkspace->getRunInfo()); if (rinfo) { MethodCb* riCb = new MethodCb(this, &SlotQtDlg::runInfoCallbackHandler, ANY_CALLBACK_TYPE); rinfo->addCCallback (ANY_CALLBACK_TYPE, riCb); _runInfoCallback = riCb; } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addRwSystemCallback() { static const char (*mname) ("SlotQtDlg::addRwSystemCallback"); // std::cout << mname << std::endl; MethodCb* rsCb = new MethodCb( this, &SlotQtDlg::rwSystemCallbackHandler, ANY_CALLBACK_TYPE); rwSystem->addCCallback (ANY_CALLBACK_TYPE, rsCb); _rwSystemCallback = rsCb; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addSimWsCallback() { static const char (*mname) ("SlotQtDlg::addSimWsCallback"); // std::cout << mname << std::endl; SimWorkspace* ws = rwSystem->getSimWorkspace(); if (!ws) return; //============>> MethodCb* wsCb = new MethodCb( this, &SlotQtDlg::simWsCallbackHandler, ANY_CALLBACK_TYPE); ws->addCCallback (ANY_CALLBACK_TYPE, wsCb); _simWsCallback = wsCb; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteAllSlotCallbacks() { static const char (*mname) ("SlotQtDlg::deleteAllSlotCallbacks"); // std::cout << mname << std::endl; CbMapIterator slotIter; for (slotIter = _slotCallbacks.begin(); slotIter != _slotCallbacks.end(); ++slotIter) { (*slotIter).first->deleteCallback((*slotIter).second); } _slotCallbacks.clear(); } void SlotQtDlg::deleteSlotCallbacks (Slot *slot) { static const char (*mname) ("SlotQtDlg::deleteSlotCallbacks"); if (CALLBACK_DEBUG) { std::cout << mname << (slot ? " SLOT" : " NULL") << std::endl; } if (slot == NULL) return; //--------------------->> Slot (*prevColSlot) (NULL); // Remove the callback for this slot CbMapIterator slotIter = _slotCallbacks.find(slot); if (slotIter != _slotCallbacks.end()) { slot->deleteCallback((*slotIter).second); _slotCallbacks.erase(slotIter); prevColSlot = slot; } const int slotColCnt (SlotGUIUtils::getNumCols (slot)); for (int col = 0; col < slotColCnt; ++col) { Slot (*colSlot) (SlotGUIUtils::getColSubSlot (slot, col)); if (colSlot == NULL) continue; if (colSlot == prevColSlot) continue; //----------------------------------- // Remove the callback for this slot slotIter = _slotCallbacks.find(colSlot); if (slotIter != _slotCallbacks.end()) { colSlot->deleteCallback((*slotIter).second); _slotCallbacks.erase(slotIter); prevColSlot = colSlot; } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteRunInfoCallback() { if (_runInfoCallback) { RunInfo (*rinfo) (rwWorkspace->getRunInfo()); rinfo->deleteCallback (_runInfoCallback); _runInfoCallback = NULL; } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteRwSystemCallback() { static const char (*mname) ("SlotQtDlg::deleteRwSystemCallback"); // std::cout << mname << std::endl; if (_rwSystemCallback) { rwSystem->deleteCallback (_rwSystemCallback); _rwSystemCallback = NULL; } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteSimWsCallback() { static const char (*mname) ("SlotQtDlg::deleteSimWsCallback"); // std::cout << mname << std::endl; SimWorkspace* ws = rwSystem->getSimWorkspace(); if (!ws) return; //============>> if (_simWsCallback) { ws->deleteCallback (_simWsCallback); _simWsCallback = NULL; } } //---------------------------------------------------------------------------- // protected // // METHOD: // void addCallbacks() // // PURPOSE: // Adds the Sim callbacks for this slot. // //---------------------------------------------------------------------------- void SlotQtDlg::addCallbacks() { static const char (*mname) ("SlotQtDlg::addCallbacks"); // std::cout << mname << std::endl; // // Register for model callbacks // addSimObjDeletedCallback(rwWorkspace); // Be notified when the controller-type changes RunInfo (*rinfo)(rwWorkspace->getRunInfo()); addControllerChangedCallback((Root *)rinfo); if (_simObj) { addSimObjNamedCallback (_simObj); addSimObjIconChangedCallback (_simObj); addSlotDeletedCallback (_simObj); } // Register for Annotation Group Manager callback addAnnoCallback(); // Add Slot Callbacks if (_slot) { addSlotCallbacks (_slot); if (_slotAcct) { addAcctCallback(); } // Note: Gnats 1942: Added _isTableSeriesSlot // .. see: http://cadswes2.colorado.edu/~philw/2009/bugs/1942/ // if (_isSeriesSlot || _isTableSeriesSlot) { addRunInfoCallback(); } } else if (_account) { addAcctCallback(); addAcctSlotCallbacks (_account); addRunInfoCallback(); } else if (_exchange) { addExchCallback(); addExchSlotCallbacks (_exchange); addRunInfoCallback(); } else if (_acctSlotSum) { addAcctSlotSumSlotCallbacks (_acctSlotSum); addRunInfoCallback(); } addRwSystemCallback(); addSimWsCallback(); } //---------------------------------------------------------------------------- // protected // // METHOD: // void deleteCallbacks() // // PURPOSE: // Deletes the Sim callbacks for this slot. // //---------------------------------------------------------------------------- void SlotQtDlg::deleteCallbacks() { static const char (*mname) ("SlotQtDlg::deleteCallbacks"); // std::cout << mname << std::endl; // // Deleting all the model callbacks // deleteSimObjDeletedCallback (rwWorkspace); if (_simObj) { deleteSimObjNamedCallback (_simObj); deleteSimObjIconChangedCallback (_simObj); deleteSlotDeletedCallback (_simObj); } // Delete Annotation Group Manager callback deleteAnnoCallback(); deleteAcctCallback(); deleteExchCallback(); deleteAllSlotCallbacks(); deleteRunInfoCallback(); deleteRwSystemCallback(); deleteSimWsCallback(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addAcctCallback() { deleteAcctCallback(); if (_account || _slotAcct) { _acctCallback = new MethodCb (this, &SlotQtDlg::acctCallbackHandler, ANY_CALLBACK_TYPE); if (_account) _account->addCCallback (ANY_CALLBACK_TYPE, _acctCallback); else if (_slotAcct) _slotAcct->addCCallback (ANY_CALLBACK_TYPE, _acctCallback); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteAcctCallback() { if (_acctCallback) { if (_account != NULL) { _account->deleteCallback (_acctCallback); } else if (_slotAcct != NULL) { _slotAcct->deleteCallback (_acctCallback); } _acctCallback = NULL; } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addExchCallback() { deleteExchCallback(); if (_exchange != NULL) { _exchCallback = new MethodCb (this, &SlotQtDlg::exchCallbackHandler, ANY_CALLBACK_TYPE); _exchange->addCCallback (ANY_CALLBACK_TYPE, _exchCallback); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteExchCallback() { if (_exchCallback) { if (_exchange != NULL) { _exchange->deleteCallback (_exchCallback); } _exchCallback = NULL; } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::addAnnoCallback() { AnnoMgr* mgr = AnnoMgr::instance(); if (_annoCallback) { mgr->deleteCallback (_annoCallback); _annoCallback = NULL; } _annoCallback = new MethodCb (this, &SlotQtDlg::annoCallbackHandler, ANY_CALLBACK_TYPE); mgr->addCCallback (ANY_CALLBACK_TYPE, _annoCallback); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::deleteAnnoCallback() { if (_annoCallback) { if (AnnoMgr::instanceExists()) { AnnoMgr* mgr = AnnoMgr::instance(); mgr->deleteCallback (_annoCallback); } _annoCallback = NULL; } } //----------------------------------------------------------------------------- //+public // // METHOD: // SlotQtDlg::~SlotQtDlg() // //----------------------------------------------------------------------------- SlotQtDlg::~SlotQtDlg() { _shipGoingDown = true; deleteCallbacks(); if (_schedResizeOptimalTimer) { _schedResizeOptimalTimer->stop(); } if (_serviceSlotDataChangeTimer) { _serviceSlotDataChangeTimer->stop(); _serviceSlotDataChangeReschedCount = 0; } if (_appMode = SQD_APP_MODE_OBJ_ACCT_SUM) { std::list::iterator iter = std::find (_acctSumDlgList.begin(), _acctSumDlgList.end(), this); if (iter != _acctSumDlgList.end()) { _acctSumDlgList.remove (this); } } if (_appMode = SQD_APP_MODE_ACCT_EDIT) { Account* acct = _account; std::list::iterator iter = std::find (_editAcctDlgList.begin(), _editAcctDlgList.end(), this); if (iter != _editAcctDlgList.end()) { _editAcctDlgList.remove (this); } AccountMgrDlg::updateDlg (acct); } if (_appMode = SQD_APP_MODE_EXCH_BAL) { std::list::iterator iter = std::find (_exchBalDlgList.begin(), _exchBalDlgList.end(), this); if (iter != _exchBalDlgList.end()) { _exchBalDlgList.remove (this); } } if (_acctSlotSum != NULL) { delete _acctSlotSum; _acctSlotSum = NULL; } SlotDialogManager::removeDlg_fromDestructor (_slot); _slot = NULL; _slotAcct = NULL; _noteGroupsMenuGroupNames.clear(); _scrollAnnoPopupMenuAbsSecs.clear(); // We don't want this dialog or our RPL frame to be updating // because the stack changes or for any other reason. _undoStack.blockSignals(true); if (_rplFrame) { rplDlgMgr->removeRplFrame(_rplFrame); } if (_rplExprMenu) { rplDlgMgr->removeRplExpressionMenu(_rplExprMenu); } } // ------------------------- // <<< Not yet developed >>> // ------------------------- // // //------------------------------------------------------------------------- // // virtual from BaseRWDlg // //------------------------------------------------------------------------- // void SlotQtDlg::updateSeriesDateTimeFormat() // { // if (_slotDataTable) // { // _slotDataTable->updateSeriesDateTimeFormat(); // } // } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // virtual from QWidget void SlotQtDlg::showEvent (QShowEvent* evt) { static const char (*mname) ("SlotQtDlg::showEvent"); // std::cout << mname << std::endl; // Call base class method BaseQtMainWin::showEvent (evt); // conditionally restore dialog geometry from prior hide. void* refObj = _slot; if (refObj == NULL) refObj = _account; if (refObj == NULL) refObj = _exchange; if (refObj == NULL) refObj = _simObj; DlgGeometryMgr::processShow ("SlotQtDlg", refObj, this, evt); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // virtual from QWidget void SlotQtDlg::hideEvent (QHideEvent* evt) { static const char (*mname) ("SlotQtDlg::hideEvent"); // std::cout << mname << std::endl; // save dialog geometry. void* refObj = _slot; if (refObj == NULL) refObj = _account; if (refObj == NULL) refObj = _exchange; if (refObj == NULL) refObj = _simObj; DlgGeometryMgr::processHide ("SlotQtDlg", refObj, this, evt); // Call base class method BaseQtMainWin::hideEvent (evt); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // virtual from QWidget void SlotQtDlg::closeEvent (QCloseEvent* evt) { if (_descDispPanel) { _descDispPanel->implicitAccept(); } // Call base class method BaseQtMainWin::closeEvent (evt); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // virtual from QWidget void SlotQtDlg::moveEvent (QMoveEvent* evt) { static const char (*mname) ("SlotQtDlg::moveEvent"); // Call base class method BaseQtMainWin::moveEvent (evt); const QPoint oldPos (evt->oldPos()); const QPoint newPos (evt->pos()); // std::cout << mname << " [#" << _instanceNum << "] " // << "(" << oldPos.x() << ", " << oldPos.y() << ") --> " // << "(" << newPos.x() << ", " << newPos.y() << ") " // << std::endl; static int moveToOriginCnt (0); if ( (newPos.x() == 0) && (newPos.y() == 0) ) { ++moveToOriginCnt; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // virtual from QWidget void SlotQtDlg::resizeEvent (QResizeEvent* evt) // from QWidget { if (_shipGoingDown) return; //----------------------->> // Call base class method BaseQtMainWin::resizeEvent (evt); // Save the user-adjusted height to apply as the initial default // of subsequently opened SlotQtDlgs, with a reasonable minimum applied. static const char (*mname) ("SlotQtDlg::resizeEvent"); if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) { _resizedHeight_AcctSum = height(); // std::cout << mname << " [ASm] hgt: " << height() << std::endl; } else if (_seriesMode) { _resizedHeight_Series = height(); // std::cout << mname << " [Ser] hgt: " << height() << std::endl; } else { _resizedHeight_NonSeries = height(); // std::cout << mname << " [Nsr] hgt: " << height() << std::endl; } // Custom adjustment to the Account Selection/Order ListView if (_acctOrderPanel != NULL) { _acctOrderPanel->schedCustomUpdateGeometry(); } if (_tstepSelPanel) { _tstepSelPanel->schedCustomUpdateGeometry(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::schedResizeOptimal() { static const char (*mname) ("SlotQtDlg::schedResizeOptimal"); // std::cout << mname << std::endl; if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } if (_schedResizeOptimalTimer == NULL) { _schedResizeOptimalTimer = new QTimer (this); connect (_schedResizeOptimalTimer, SIGNAL (timeout()), this, SLOT (resizeOptimal())); } else { _schedResizeOptimalTimer->stop(); } _schedResizeOptimalTimer->setSingleShot (true); _schedResizeOptimalTimer->start (200); // [milliseconds] } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::schedServiceSlotDataChange() { static const char (*mname) ("SlotQtDlg::schedServiceSlotDataChange"); // std::cout << mname << std::endl; if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } if (_serviceSlotDataChangeTimer == NULL) { _serviceSlotDataChangeReschedCount = 1; _serviceSlotDataChangeTimer = new QTimer (this); connect (_serviceSlotDataChangeTimer, SIGNAL (timeout()), this, SLOT (serviceSlotDataChange())); } else if (_serviceSlotDataChangeTimer->isActive()) { ++_serviceSlotDataChangeReschedCount; if (_serviceSlotDataChangeReschedCount > 500) { // After the first 500 schedule requests, if the timer is // already running, allow it to complete rather than starting // it all over again. // return; //------>> } _serviceSlotDataChangeTimer->stop(); } const RunInfo* rinfo = rwWorkspace->getRunInfo(); const RunState runState = rinfo->getState(); const bool isRunning = (runState == INITIALIZING) || (runState == INIT_SUSPENDED) || (runState == RUNNING) || (runState == RUN_SUSPENDED) || (runState == WAITING); const int msecs = (isRunning ? 800 : 100); // [milliseconds] _serviceSlotDataChangeTimer->setSingleShot (true); _serviceSlotDataChangeTimer->start (msecs); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::resizeOptimal() { static const char (*mname) ("SlotQtDlg::resizeOptimal"); static int callCnt (0); ++callCnt; if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } const int dialogMargin (_mainVBoxLayout->margin()); const int oldWidth (width()); const int oldHeight (height()); const int tabOptWidth (_slotDataTable ? _slotDataTable->optimalWidth() : 0); const int minWidth (std::max (250, tabOptWidth + (2 * dialogMargin))); const int minHeight (std::max (300, height())); const QSize minSize (minWidth, minHeight); const QSize newSize (minSize.expandedTo (minimumSizeHint())); // std::cout << mname << " [#" << callCnt << "]" // << " [" << oldWidth << "," << oldHeight << "] -->" // << " [" << newSize.width() << "," << newSize.height() << "]" // << ", tab: " << tabOptWidth // << ", minWid: " << minWidth // << std::endl; const bool sizeChange ( (oldWidth != newSize.width()) || (oldHeight != newSize.height()) ); if (sizeChange) { resize (newSize); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::serviceSlotDataChange() { static const char* mname ("SlotQtDlg::serviceSlotDataChange"); if (_shipGoingDown) return; //----------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } _serviceSlotDataChangeReschedCount = 0; _slotDataTable->dataChanged(); if (_dispCompressPanel) _dispCompressPanel->seriesDataChanged(); refreshPeriodicSlotBottomWidgets(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::acctSlotSumSettingsChanged() { static const char (*mname) ("SlotQtDlg::acctSlotSumSettingsChanged"); // std::cout << mname << std::endl; if (_shipGoingDown) return; //----------------------->> if (_installNewAcctSlotSummary_inProgress) { // std::cout << mname << " Install in progress. ABORT." << std::endl; return; //------------------------------------------------------>> } initShowSuppliesCheckBox(); const bool doShowSupplies = showingSupplies(); initShowEmptySlotsCheckBox(); const bool doShowEmptySlots = showingEmptySlots(); const AcctSlotSummary::ColMode colMode (_acctSlotSum->colMode()); const bool isAcctColMode (colMode == AcctSlotSummary::COL_MODE_ACCTS); const bool isTimeColMode (colMode == AcctSlotSummary::COL_MODE_TIME); if (_acctOrderPanel) { const bool showAcctOrderPanel = (isAcctColMode || isTimeColMode); _acctOrderPanel->setShown (showAcctOrderPanel); _acctOrderPanel->updateAcctList (_acctSlotSum); _acctOrderPanel->sortByOrderNumberColumn(); } if (_tstepSelPanel) { _tstepSelPanel->setShown (isTimeColMode); _tstepSelPanel->updateTstepList (_acctSlotSum); } if (_slotDataTable) { installSlotDataTable (_acctSlotSum); } if (isTimeColMode && _dispCompressPanel) { // Hide Display Compression Panel _dispCompressPanel->setShown (false); } // Re-establish Slot Callbacks deleteAllSlotCallbacks(); addAcctSlotSumSlotCallbacks (_acctSlotSum); if (_slotDataTable_timeColMode) { _slotDataTable_timeColMode->setShowSupplies (doShowSupplies); _slotDataTable_timeColMode->setShowEmptySlots (doShowEmptySlots); } if (_slotDataTable_slotColMode) { _slotDataTable_slotColMode->setShowSupplies (doShowSupplies); _slotDataTable_slotColMode->setShowEmptySlots (doShowEmptySlots); } if (_slotDataTable) { _slotDataTable->refreshShownSupplies(); _slotDataTable->refreshShowHideSlotItems(); schedRefreshDisplayCompression(); _slotDataTable->growColsToData_handler(); } refreshStatusBar(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::acctSlotSumAcctListChanged() { static const char (*mname) ("SlotQtDlg::acctSlotSumAcctListChanged"); // std::cout << mname << std::endl; if (_slotDataTable) { installSlotDataTable (_acctSlotSum); // Re-establish Slot Callbacks deleteAllSlotCallbacks(); addAcctSlotSumSlotCallbacks (_acctSlotSum); } refreshStatusBar(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::acctSlotSumTstepListChanged() { static const char (*mname) ("SlotQtDlg::acctSlotSumTstepListChanged"); // std::cout << mname << std::endl; if (_slotDataTable) { installSlotDataTable (_acctSlotSum); // Re-establish Slot Callbacks deleteAllSlotCallbacks(); addAcctSlotSumSlotCallbacks (_acctSlotSum); } refreshStatusBar(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::acctSlotSumObjSelected (const QString& objName) { static const char (*mname) ("SlotQtDlg::acctSlotSumObjSelected"); // std::cout << mname << " '" << objName << "'" << std::endl; if (_shipGoingDown) return; //----------------------->> AcctSlotSummary* oldAcctSlotSummary (_acctSlotSum); if (!objName.isEmpty()) { const QString objNameRw (objName); SimObj* obj = rwWorkspace->locateSimObj (objNameRw); if (obj != NULL) { _simObj = obj; AcctSlotSummary* newAcctSlotSummary ( obj->getAnyAcctSlotSummary (oldAcctSlotSummary)); installNewAcctSlotSummary (newAcctSlotSummary); if (_objectIconButton) { // Set Object Icon from type of slot's Object. RwQtUtils::setQButtonIconForSimObj (_objectIconButton, _simObj); } // Re-establish proper callbacks deleteCallbacks(); addCallbacks(); refreshObjectName(); } } initShowSuppliesCheckBox(); const bool doShowSupplies = showingSupplies(); initShowEmptySlotsCheckBox(); const bool doShowEmptySlots = showingEmptySlots(); _objAcctSumSel->setConfig (_acctSlotSum); installSlotDataTable (_acctSlotSum); _slotDataTable->setShowEmptySlots (doShowEmptySlots); _slotDataTable->setShowSupplies (doShowSupplies); _slotDataTable->refreshShownSupplies(); _slotDataTable->refreshShowHideSlotItems(); schedRefreshDisplayCompression(); _slotDataTable->growColsToData_handler(); if (_acctOrderPanel) { _acctOrderPanel->updateAcctList (_acctSlotSum); } if (_tstepSelPanel) { _tstepSelPanel->updateTstepList (_acctSlotSum); } refreshStatusBar(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::objAcctSumSaveDlg_saveClicked (ObjAcctSumSaveDlg* saveDlg, const QString& saveAsName) { static const char (*mname) ("SlotQtDlg::objAcctSumSaveDlg_saveClicked"); // std::cout << mname << std::endl; if ( !saveAsName.isEmpty() && (_acctSlotSum != NULL) && (_simObj != NULL) ) { // Create a dynamically allocated copy of the AcctSlotSummary // and hand ownership of that instance over to the SimObj. AcctSlotSummary* newASum = new AcctSlotSummary(); *newASum = *_acctSlotSum; newASum->setName (saveAsName); // SimObj takes ownership of this dynamically allocated AcctSlotSummary. _simObj->setAcctSlotSummary (newASum); } if (saveDlg == _objAcctSumSaveDlg) { // Drop pointer to the Object Account Summary Save Dialog _objAcctSumSaveDlg = NULL; // Note: The dialog box closes and deletes itself right after this. } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::objAcctSumSaveDlg_cancelClicked (ObjAcctSumSaveDlg* saveDlg) { if (saveDlg == _objAcctSumSaveDlg) { // Drop pointer to the Object Account Summary Save Dialog _objAcctSumSaveDlg = NULL; // Note: The dialog box closes and deletes itself right after this. } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::tstepSelPanel_setLocalScroll (const Date_Time& when) { static const char (*mname) ("SlotQtDlg::tstepSelPanel_setLocalScroll"); // std::cout << mname << std::endl; if (_scrollDateSpinner) { _scrollDateSpinner->setDateTime (when); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::viewMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::viewMenu_aboutToShow"); // std::cout << mname << std::endl; if (_showCommaSepsAction != NULL) { const bool showSeps = cwFormat::showNumSeparatorEna(); _showCommaSepsAction->setOn (showSeps); const QString sepName = cwFormat::numericSeparatorName (true); // plural const QString showSepsStr = QString (tr ("Show %1")) .arg (sepName); _showCommaSepsAction->setText (showSepsStr); // This may be a hidden feature. _showCommaSepsAction->setVisible (SHOW_SHOW_COMMA_SEPS_TOGGLE); } if ( (_dispCompressPanel != NULL) && (_showDispCompAction != NULL) ) { const bool compPanelShown = _dispCompressPanel->isShown(); const bool toggleActionOn = _showDispCompAction->isChecked(); if (compPanelShown != toggleActionOn) { _showDispCompAction->setOn (compPanelShown); } } if ( _selStatsSupported && (_selStatFrame != NULL) && (_showSelStatsAction != NULL) ) { const bool selStatsShown = _selStatFrame->isShown(); const bool toggleActionOn = _showSelStatsAction->isChecked(); if (selStatsShown != toggleActionOn) { _showSelStatsAction->setOn (selStatsShown); } } if (_showPrioritiesAction) { sensitizePrioritiesRelevant(); } // ************************************************** // *** User Description Panel Show/Hide Actions *** // ************************************************** const bool descShown = descriptionShown(); const bool descSupported = _isSlotOnDataObj || ((_appMode == SQD_APP_MODE_OPEN_SLOT) && DESCRIPT_SUPPORT_ON_ALL_SLOTS); const bool slotHasDesc = descriptionDefined(); if (slotHasDesc) { _addDescriptionAction -> setVisible (false); _showDescriptionAction -> setVisible (descSupported); _showDescriptionAction -> setOn (descShown); } else { _addDescriptionAction -> setVisible (descSupported); _showDescriptionAction -> setVisible (false); _showDescriptionAction -> setOn (descShown); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::rowMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::rowMenu_aboutToShow"); // std::cout << mname << std::endl; sensitizeOperations(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::columnMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::columnMenu_aboutToShow"); // std::cout << mname << std::endl; sensitizeOperations(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sctMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::sctMenu_aboutToShow"); // std::cout << mname << std::endl; sensitizeSctOperations(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::configMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::configMenu_aboutToShow"); // std::cout << mname << std::endl; rebuildConfigMenu(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::configMenu_loadId (int id) { static const char (*mname) ("SlotQtDlg::configMenu_loadId"); // std::cout << mname << " [id " << id << "]" << std::endl; const int sumCnt = _configMenuAcctSlotSumVector.size(); if (id < 0) return; //--------------->> if (!rwAssert (id < sumCnt)) { // ERROR std::cout << mname << " id (" << id << ") out of range (" << sumCnt << ")" << std::endl; return; } AcctSlotSummary* sumRec = _configMenuAcctSlotSumVector [id]; if (!rwAssert (sumRec != NULL)) return; //----------------------------------->> installNewAcctSlotSummary (sumRec); if (_acctOrderPanel) { _acctOrderPanel->sortByOrderNumberColumn(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::configMenu_deleteId (int id) { static const char (*mname) ("SlotQtDlg::configMenu_deleteId"); // std::cout << mname << " [id " << id << "]" << std::endl; const int sumCnt = _configMenuAcctSlotSumVector.size(); if (id < 0) return; //--------------->> if (!rwAssert (id < sumCnt)) { // ERROR std::cout << mname << " id (" << id << ") out of range (" << sumCnt << ")" << std::endl; return; } AcctSlotSummary* sumRec = _configMenuAcctSlotSumVector [id]; if (!rwAssert (sumRec != NULL)) return; //----------------------------------->> const QString sumRecName (sumRec->name()); if (_simObj) { _simObj->deleteAcctSlotSummary (sumRecName); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::configSaveAs_activated() { static const char (*mname) ("SlotQtDlg::configSaveAs_activated"); // std::cout << mname << std::endl; if (_simObj == NULL) return; //------------------------>> QString curSumName (""); if (_acctSlotSum != NULL) curSumName = _acctSlotSum->name(); ObjAcctSumSaveDlg* saveDlg = new ObjAcctSumSaveDlg (this, "ObjAcctSumSaveDlg", _simObj, curSumName); saveDlg->showNormal(); saveDlg->raise(); saveDlg->setActiveWindow(); connect (saveDlg, SIGNAL (saveButton_clicked (ObjAcctSumSaveDlg*, const QString&)), this, SLOT (objAcctSumSaveDlg_saveClicked (ObjAcctSumSaveDlg*, const QString&))); connect (saveDlg, SIGNAL (cancelButton_clicked (ObjAcctSumSaveDlg*)), this, SLOT (objAcctSumSaveDlg_cancelClicked (ObjAcctSumSaveDlg*))); } //----------------------------------------------------------------------------- // Handles button clicked on Object Icon Pushbutton //----------------------------------------------------------------------------- void SlotQtDlg::objectIconClicked() { static const char (*mname) ("SlotQtDlg::objectIconClicked"); // std::cout << mname << std::endl; if (_simObj == NULL) return; //------------------------>> OpenObjectDlg* dlg (NULL); switch (_appMode) { case SQD_APP_MODE_ACCT_EDIT: case SQD_APP_MODE_EXCH_BAL: case SQD_APP_MODE_OBJ_ACCT_SUM: { dlg = QGui::openObject (_simObj, _account, false); // not doShow break; } case SQD_APP_MODE_OPEN_SLOT: { if (_slot && _slot->isManagedByAccount()) dlg = QGui::openObject (_simObj, _account, false); // not doShow else dlg = QGui::openObject (_simObj, _slot, false); // not doShow break; } } if (dlg) { const bool whenOk (_scrollDateSpinner != NULL); if (whenOk) { _scrollDateSpinner->forceInterpretText(); Date_Time when = *(_scrollDateSpinner->getDateTime()); QGui::raiseAndScroll (dlg, when); } else { QGui::raiseDlg (dlg); } } } //----------------------------------------------------------------------------- // Handles button clicked on Account Icon Pushbutton //----------------------------------------------------------------------------- void SlotQtDlg::acctIconButtonClicked() { static const char (*mname) ("SlotQtDlg::acctIconButtonClicked"); // std::cout << mname << std::endl; if (_slotAcct != NULL) { RwQtAutoWaitCursor waitInst (true); SlotQtDlg* dlg = SlotQtDlg::openEditAcctDlg (_slotAcct); if (_scrollDateSpinner && dlg) { _scrollDateSpinner->forceInterpretText(); const Date_Time when (*_scrollDateSpinner->getDateTime()); dlg->scrollToDate (when); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::scrollDatePushButtonClicked() { static const char (*mname) ("SlotQtDlg::scrollDatePushButtonClicked"); // std::cout << mname << std::endl; if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time when (*_scrollDateSpinner->getDateTime()); // std::cout << " ... " << when.userTimeDate() << std::endl; scrollToDate (when); if (_tstepSelPanel != NULL) { _tstepSelPanel->scrollToDate (when); } const int keyModifiers (RwQtUtils::keyModifierState (this)); const bool shiftKey ((keyModifiers & Qt::ShiftButton) != 0); if (shiftKey) { DateTimeQtSpinner::sendNavNotify (when); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::unitTypeFlowPushButtonToggled (bool on) { static const char (*mname) ("SlotQtDlg::unitTypeFlowPushButtonToggled"); // std::cout << mname << (on ? " [ON]" : " [OFF]") << std::endl; if (_shipGoingDown) return; //----------------------->> const bool wasOn (_unitTypeFlowPushButton->isChecked()); if (wasOn != on) { // std::cout << mname << (on ? " [ON]" : " [OFF]") // << " STATE FIXUP" << std::endl; _unitTypeFlowPushButton->setOn (on); } _unitTypeFlowPushButton->setText (on ? "Flow" : "Vol"); RwQtUtils::qButtonLimitWidth (_unitTypeFlowPushButton, "Flow"); _slotDataTable->setColFlowUnitsFlags (on); _slotDataTable->growColsToData_handler(); if (_seriesDisplayCompressSpec.panelShown()) { schedRefreshDisplayCompression(); } if (_selStatFrame) { SeriesSlot *refSlot = dynamic_cast (_slotDataTable->firstSelAggSlotColSlot()); if (refSlot == NULL) refSlot = dynamic_cast (_slot); if (refSlot) _selStatFrame->setDispRefSlot (refSlot); const unit_type utype (on ? FLOW : VOLUME); _selStatFrame->setPreferredUnitType (utype); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::plotPushButtonClicked() { static const char (*mname) ("SlotQtDlg::plotPushButtonClicked"); // std::cout << mname << std::endl; plotSlot(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showDescriptPushButtonClicked() { static const char* mname ("SlotQtDlg::showDescriptPushButtonClicked"); // std::cout << mname << " DEMO" << std::endl; // ******************* // *** DEMO ONLY *** // ******************* bool doShow (false); // tentative if (_descToggles && (_descTogglesIndex_desc >= 0)) { const bool wasOn = _descToggles->isToggleOn (_descTogglesIndex_desc); doShow = !wasOn; _descToggles->setToggleOn (_descTogglesIndex_desc, doShow); } sensitizeOperations(); _mainVertSplitter->refresh(); _mainVertSplitter->update(); if (doShow) { if (_descDispPanel) { _descDispPanel->giveTextEditFocus(); } } else { closeDescBoxSplitterSection(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::displayCompressPushButtonClicked() { // Toggle Show/Hide Display Compression Control Panel // This also applies or cancels series compression (in SlotQDlgTable). if (_dispCompressPanel) { const bool hidePanel (_dispCompressPanel->isShown()); if (hidePanel) { // Hide Display Compression Panel _dispCompressPanel->setShown (false); } else // (showPanel) { // Activate Display Compression DisplayCompressSpec spec (_dispCompressPanel->compressionSpecRef()); spec.setOn (true); _dispCompressPanel->setCompressionSpec (spec); // Show Display Compression Panel _dispCompressPanel->setShown (true); } } } //----------------------------------------------------------------------------- // Handles requests to configure the scalar slot //----------------------------------------------------------------------------- void SlotQtDlg::configUnitsHandler() { static const char (*mname) ("SlotQtDlg::configUnitsHandler"); BaseRWDlg* childDlg (NULL); if (_slot != NULL) { if (_slot->isA (Slot::PeriodicSlotBit)) childDlg = openChildDlg (_slot, ConfigPeriodicSlotEvent, false); else childDlg = openChildDlg (_slot, ConfigurationEvent, false); } else if (_account != NULL) { try { QtAcctGuiMgrInst->openOpenAccountDlg (_account, AcctGuiDefs::EXISTING_ACCOUNT); } catch (const cwException &error) { QMessageBox::warning(this, "Open Account Dialog error", error.what()); } } else if (_exchange != NULL) { // std::cout << mname << ": Exchange " // << _exchange->getCompleteName() << std::endl; QtAcctGuiMgrInst->openExchangeCfgDlg (_exchange, AcctGuiDefs::EXISTING_EXCHANGE); } if (childDlg) { const QRect parentRect = frameGeometry(); QWidget* childDlgWidget = childDlg->getQWidget(); if (childDlgWidget) { RwQtUtils::placeDialogNextTo (childDlgWidget, parentRect); } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::openAccountsMgr_activated() { AccountMgrDlg::openDlg (NULL); // QWidget* parent if (_shipGoingDown) return; //----------------------->> if (_account) { AccountMgrDlg::updateDlg (_account); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::openSuppliesMgr_activated() { if (_shipGoingDown) return; //----------------------->> // Open Qt Supply Manager Dialogs SupplyMgrDlg::openDlg (NULL, _simObj); // _simObj may be NULL if ((_simObj == NULL) && (_exchange != NULL)) { Supply* sply (NULL); if (_exchange->hasBorrowSupply()) { sply = _exchange->getBorrowSupply(); } if (!sply) { sply = _exchange->getInputBorrow(); } if (!sply && _exchange->hasDestSupply()) { sply = _exchange->getDestSupply(); } if (sply != NULL) { SupplyMgrDlg::updateDlg (sply); } } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::openExchangesMgr_activated() { ExchangeMgrDlg::instance()->showNormal(); ExchangeMgrDlg::instance()->raise(); ExchangeMgrDlg::instance()->setActiveWindow(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::openAcctSysConfig_activated() { AccountingSysConfigDlg::openDlg (NULL); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::useAcctColorsToggled (bool newOn) { static const char (*mname) ("SlotQtDlg::useAcctColorsToggled"); // std::cout << mname << " (" << (newOn ? "ON" : "OFF") << ")" // << std::endl; if (_shipGoingDown) return; //----------------------->> // Notify SlotQDlgTable of new Account Color use setting. if (_slotDataTable) _slotDataTable->setUseAcctColors (newOn); SlotDialogManager::updateQtDlgs(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showAcctLegend_activated() { AcctCellColorLegend::showAcctCellColorLegend (this); } //----------------------------------------------------------------------------- // Handles requests to configure the scalar slot //----------------------------------------------------------------------------- void SlotQtDlg::setDimensionsHandler() { const int origNumSlotRows (SlotGUIUtils::getNumSlotRows(_slot)); const int origNumSlotCols (SlotGUIUtils::getNumCols(_slot)); QString captionStr ("Set Dimensions: "); captionStr += _slot->getCompleteName(); SpecifyDimsDlg specifyDimsDlg (this, SpecifyDimsDlg::SELMODE_ROWS_COLS, captionStr, origNumSlotRows, origNumSlotCols); if (specifyDimsDlg.exec()) { const int numRows = specifyDimsDlg.getNumRows(); const int numCols = specifyDimsDlg.getNumCols(); if ((numRows <= 0) || (numCols <= 0)) { QMessageBox::warning(this, QString("Invalid Dimensions"), QString("Invalid number of rows or columns specified.\n")); } else { SlotGUIUtils::setDimensions(_slot, numRows, numCols); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::setColumnLabelsAction() { static const char (*mname) ("SlotQtDlg::setColumnLabelsAction"); // std::cout << mname << std::endl; if (_slot != NULL) { openChildDlg (_slot, ColumnLabelEditorEvent, false); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::setRowLabelsAction() { static const char (*mname) ("SlotQtDlg::setRowLabelsAction"); // std::cout << mname << std::endl; if (_slot != NULL) { openChildDlg (_slot, RowLabelEditorEvent, false); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showColSumRowHandler (bool /*on*/) { static const char (*mname) ("SlotQtDlg::showColSumRowHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; _slotDataTable->recomputeCellLayout (0); // change serial number _slotDataTable->growColsToData_handler(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showPrioritiesHandler (bool on) { static const char (*mname) ("SlotQtDlg::showPrioritiesHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; _slotDataTable->recomputeCellLayout (0); // change serial number if (on) _slotDataTable->growColsToData_handler(); else _slotDataTable->fitColsToAll_handler(); schedResizeOptimal(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showNotesColHandler (bool /*on*/) { static const char (*mname) ("SlotQtDlg::showNotesColHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; _slotDataTable->recomputeCellLayout (0); // change serial number _slotDataTable->growColsToData_handler(); schedResizeOptimal(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showCommaSepsHandler (bool on) { static const char* mname ("SlotQtDlg::showCommaSepsHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; // Turn ON/OFF Comma (or other) Numeric Seperator cwFormat::setShowNumSeparator (on); // ... issues a WS_SHOW_NUMSEP_CHANGED callback. } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showDispCompHandler (bool on) { static const char (*mname) ("SlotQtDlg::showNotesColHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; if (_dispCompressPanel) { // Activate Display Compression DisplayCompressSpec spec (_dispCompressPanel->compressionSpecRef()); spec.setOn (true); _dispCompressPanel->setCompressionSpec (spec); // Show Display Compression Panel _dispCompressPanel->setShown (on); if (on) { schedResizeOptimal(); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showSelStatsHandler (bool on) { static const char (*mname) ("SlotQtDlg::showSelStatsHandler"); // std::cout << mname << " (" << (on ? "ON" : "OFF") << ")" << std::endl; if (_selStatFrame) { // Show Display Compression Panel _selStatFrame->setShown (on); if (on) { _selStatFrame->setSlotDataTable (_slotDataTable); refreshStatusBar(); } else { schedResizeOptimal(); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::editAnnoGroupHandler (AnnoGroupID defaultGroupID /*=(-1)*/) { static const char (*mname) ("SlotQtDlg::editAnnoGroupHandler"); // std::cout << mname << std::endl; NoteGroupMgrDlg* dlg = NoteGroupMgrDlg::instance(); AnnoGroupID groupID = defaultGroupID; Slot* firstSelSlot = _slotDataTable->firstSelAggSlotColSlot(); Slot* annoSlot (NoteQtUtils::annoSlot (firstSelSlot)); if (annoSlot) { dlg->setContextSlot (annoSlot); if (groupID < 0) { groupID = annoSlot->oneAnnoGroupInSlot(); } } if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time scrollSpinDate (*_scrollDateSpinner->getDateTime()); const seconds_t secs (scrollSpinDate.getAbsSeconds()); dlg->setContextSecs (secs); } if (groupID >= 0) { dlg->setContextGroupID (groupID); } dlg->showNormal(); dlg->raise(); dlg->setActiveWindow(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::addDescriptionHandler() { static const char (*mname) ("SlotQtDlg::addDescriptionHandler"); // std::cout << mname << std::endl; if (_descTogglesIndex_desc >= 0) { _descToggles->setToggleOn (_descTogglesIndex_desc, true); } sensitizeOperations(); _mainVertSplitter->refresh(); _mainVertSplitter->update(); if (_descDispPanel) _descDispPanel->giveTextEditFocus(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showDescriptionHandler (bool doShow) { static const char (*mname) ("SlotQtDlg::showDescriptionHandler"); // std::cout << mname << " " << (doShow ? "SHOW" : "HIDE") << std::endl; if (_descTogglesIndex_desc >= 0) { _descToggles->setToggleOn (_descTogglesIndex_desc, doShow); } sensitizeOperations(); if (doShow) { if (_descDispPanel) _descDispPanel->giveTextEditFocus(); } else { if (_descDispPanel) _descDispPanel->implicitAccept(); closeDescBoxSplitterSection(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::closeDescBoxSplitterSection() { // Fixup for QSplitter. For some reason, when the description // panel is "closed" (forced short), the splitter isn't collapsing // that panel's height. const int descDispBoxInx = _mainVertSplitter->indexOf (_descDispBox); QList splitSizes = _mainVertSplitter->sizes(); if ((descDispBoxInx >= 0) && (descDispBoxInx < splitSizes.count())) { splitSizes [descDispBoxInx] = 20; _mainVertSplitter->setSizes (splitSizes); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- static const char* testDates[] = { "03-01-1800 06:30:45", "02-29-2000 02:00:00", "04-03-2006 00:10:00", "05-05-3705 08:00:15", NULL }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- static void numDateTimeTest (Slot* slot, bool setValues) // or compare values? { SeriesSlot (*sslot) (dynamic_cast (slot)); if (sslot == NULL) return; //---------------------->> Date_Time slotDate (*sslot->getStartDate()); DeltaTime slotStep (sslot->getStep()); std::cout.precision (19); Date_Time testDT; for (int scopeInt = 0; scopeInt <= 7; ++scopeInt) { const PartialDateTime::Scope scope ((PartialDateTime::Scope) scopeInt); for (int dateInx = 0; testDates [dateInx] != NULL; ++dateInx) { QString encValStr (""); QString slotValStr (""); testDT.parse (testDates [dateInx]); PartialDateTimeEncoder ndt (testDT, scope); double encVal (ndt.encode()); encValStr.sprintf ("%.7lf", encVal); if (setValues) { std::cout << scopeInt << ": " << testDates [dateInx] << " " << qPrintable (encValStr) << std::endl; sslot->setStdValue (encVal, &slotDate); } else // (compare values) { double slotVal (0.0); errstat valErr = sslot->getStdValue (&slotDate, slotVal); slotValStr.sprintf ("%.7lf", slotVal); if (valErr) { std::cout << " Get value error " << qPrintable(valErr.msg()) << std::endl; } else if (encVal != slotVal) { std::cout << " Value Difference! " << (encVal - slotVal) << " " << qPrintable (encValStr) << " " << qPrintable (slotValStr) << std::endl; } else { std::cout << " OK: " << scopeInt << ": " << testDates [dateInx] << " " << ndt.dateTime().ascii_date_time() << " " << qPrintable (encValStr) << std::endl; } } slotDate += slotStep; } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::slotTest1Handler() { static const char (*mname) ("SlotQtDlg::slotTest1Handler"); std::cout << mname << " Set Values ..." << std::endl; numDateTimeTest (_slot, true); // set values } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::slotTest2Handler() { static const char (*mname) ("SlotQtDlg::slotTest2Handler"); std::cout << mname << " Compare Values ..." << std::endl; numDateTimeTest (_slot, false); // compare values } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::slotTest3Handler() { static const char (*mname) ("SlotQtDlg::slotTest3Handler"); std::cout << mname << " Apply PartialDateTime Scope ..." << std::endl; if (_slot) { _slot->applyDateTimeScopeToValues(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::generalPopupMenu_aboutToShow() { if (_slotDataTable) { _slotDataTable->mainPopupMenuAboutToShow(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::adjustPopupMenu_aboutToShow() { if (_slotDataTable) { _slotDataTable->mainPopupMenuAboutToShow(); } if (_adjustMenuSensitizeNeeded) { sensitizeAdjustOperations(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::noteGroupsPopupMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::noteGroupsPopupMenu_aboutToShow"); // std::cout << mname << std::endl; if (!rwAssert (_noteGroupsMenu != NULL)) return; //-------------------------------------------->> _noteGroupsMenu->clear(); _noteGroupsMenuGroupNames.clear(); Slot* firstSelSlot = _slotDataTable->firstSelAggSlotColSlot(); Slot* annoSlot (NoteQtUtils::annoSlot (firstSelSlot)); if (annoSlot == NULL) return; //------------------------->> AnnoMgr* mgr = AnnoMgr::instance(); // Populate with AnnoGroup Toggle Actions cwSlist annoGroupIdList; mgr->getAnnoGroupIds (annoGroupIdList); const int groupCnt = annoGroupIdList.size(); _noteGroupsMenuGroupNames.resize (groupCnt+1, QString ("")); int itemId (0); // used as both Menu Item ID and vector index // Iterate over All AnnoGroups (registered with the AnnoGroupMgr). cwIterator groupIter; for (groupIter = annoGroupIdList.first(); groupIter; groupIter = annoGroupIdList.next (groupIter)) { const AnnoGroupID groupID (annoGroupIdList.elem (groupIter)); if (groupID < 0) continue; //------------------------ AnnoGroup* group = mgr->annoGroup (groupID); if (group == NULL) continue; //-------------------------- const QString groupName = group->annoGroupName(); const AnnoIconColor iconColor = group->annoIconColor(); const QPixmap& annoPmap = RwQPixmap11::annoIconPixmap (iconColor); // "Remove (slot) from" and "Add (slot) to" (Group) is not relevant // in the new Annotations architecture. (The purpose of this menu // will probably be the "default group" for creating new notes -- // I'm not even sure about that). // //-- QString menuItemStr; //-- if (grp->contains (annoSlot)) //-- menuItemStr = "Remove from: "; //-- else //-- menuItemStr = "Add to: "; //-- //-- menuItemStr += groupName; // Since this QAction is parented by the QMenu into which it will // be placed, the QAction will automatically be deleted when that // QMenu is cleared. QAction* noteGroupAction = new QAction (annoPmap, groupName, _noteGroupsMenu); noteGroupAction->setData (QVariant (itemId)); // std::cout << " [" << itemId << "] '" // << qPrintable (groupName) << "'" << std::endl; _noteGroupsMenu->addAction (noteGroupAction); _noteGroupsMenuGroupNames [itemId] = groupName; ++itemId; } _noteGroupsMenu->addSeparator(); //--------- _editAnnoGroupAction->addTo (_noteGroupsMenu); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::noteGroupsPopupMenu_actionTriggered (QAction* trigAction) { static const char (*mname) ("SlotQtDlg::noteGroupsPopupMenu_actionTriggered"); if (trigAction == NULL) return; //--------------------------->> bool idOk (false); const int id = trigAction->data().toInt (&idOk); const int grpNameCnt = _noteGroupsMenuGroupNames.size(); if (!idOk) return; if (id < 0) return; if (id >= grpNameCnt) return; //------------------------->> const QString grpName = _noteGroupsMenuGroupNames [id]; // std::cout << mname << " [" << id << "] " // << qPrintable (grpName) << std::endl; AnnoMgr* mgr = AnnoMgr::instance(); AnnoGroup* annoGroup = mgr->annoGroup (grpName); editAnnoGroupHandler (annoGroup ? annoGroup->annoGroupID() : (-1)); if (_slotDataTable) { _slotDataTable->refreshAnnoColReadOnlyStatus(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::scrollAnnoPopupMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::scrollAnnoPopupMenu_aboutToShow"); // std::cout << mname << std::endl; if (_scrollDateSpinner == NULL) return; if (_scrollAnnoPopupMenu == NULL) return; //------------------------------------->> _scrollDateSpinner->forceInterpretText(); const Date_Time scrollSpinDate (*_scrollDateSpinner->getDateTime()); const seconds_t scrollSpinAbsSecs (scrollSpinDate.getAbsSeconds()); SeriesNoteQMultiMap seriesNoteMap; _slotDataTable->getCompositeSeriesNoteQMultiMap (seriesNoteMap); const int itemCnt = seriesNoteMap.count(); _scrollAnnoPopupMenu->clear(); _scrollAnnoPopupMenuAbsSecs.clear(); _scrollAnnoPopupMenuAbsSecs.resize (itemCnt+2, (seconds_t) 0); int itemId (0); // used as both Menu Item ID and vector index AnnoMgr* mgr = AnnoMgr::instance(); QMultiMap ::iterator assocIter; for (assocIter = seriesNoteMap.begin(); assocIter != seriesNoteMap.end(); ++assocIter, ++itemId) { const AnnoNoteID noteID = assocIter->annoNoteID(); const seconds_t absSecs = assocIter->tstepSecs(); const bool isOn (absSecs == scrollSpinAbsSecs); const QPixmap* annoIcon; if (assocIter->isNoteCollected()) { annoIcon = NoteQtUtils::annoTogCollIconForNoteId (noteID, isOn); } else { annoIcon = NoteQtUtils::annoTogIconForNoteId (noteID, isOn); } const QString itemTxt = mgr->annoNoteText (noteID); // std::cout << mname << " [" << itemId << "] " << absSecs << std::endl; // Since this QAction is parented by the QMenu into which it will // be placed, the QAction will automatically be deleted when that // QMenu is cleared. QAction* scrollAnnoAction = annoIcon ? new QAction (*annoIcon, itemTxt, _scrollAnnoPopupMenu) : new QAction (itemTxt, _scrollAnnoPopupMenu); scrollAnnoAction->setData (QVariant (itemId)); _scrollAnnoPopupMenu->addAction (scrollAnnoAction); _scrollAnnoPopupMenuAbsSecs [itemId] = absSecs; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::scrollAnnoPopupMenu_actionTriggered (QAction* trigAction) { static const char (*mname) ("SlotQtDlg::scrollAnnoPopupMenu_actionTriggered"); if (trigAction == NULL) return; //--------------------------->> bool idOk (false); const int id = trigAction->data().toInt (&idOk); const int itemCnt = _scrollAnnoPopupMenuAbsSecs.size(); if (!idOk) return; if (id < 0) return; if (id >= itemCnt) return; //---------------------->> const seconds_t absSecs = _scrollAnnoPopupMenuAbsSecs [id]; const Date_Time when (absSecs); scrollToDate (when); // std::cout << mname << " [" << id << "] " << absSecs << std::endl; const int keyModifiers (RwQtUtils::keyModifierState (this)); const bool shiftKey ((keyModifiers & Qt::ShiftButton) != 0); if (shiftKey) { DateTimeQtSpinner::sendNavNotify (when); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::linkedSlotsPopupMenu_aboutToShow() { static const char (*mname) ("SlotQtDlg::linkedSlotsPopupMenu_aboutToShow"); if (_linkedSlotsPopupMenu == NULL) return; //-------------------------------------->> const LinkedSlotsPopupMenu::OpCode op (LinkedSlotsPopupMenu::OP_OPEN_SLOT); if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time when (*_scrollDateSpinner->getDateTime()); _linkedSlotsPopupMenu->processAboutToShow (op, _slot, when); } else { _linkedSlotsPopupMenu->processAboutToShow (op, _slot); } } //----------------------------------------------------------------------------- // Virtual from BaseRWDlg // Set the DateSpinner; causes scroll to indicated timestep //----------------------------------------------------------------------------- void SlotQtDlg::scrollToDate (const Date_Time& when) { static const char (*mname) ("SlotQtDlg::scrollToDate"); // std::cout << mname << ": " << when.userTimeDate() << std::endl; if (_seriesMode) { if (_scrollDateSpinner != NULL) { _scrollDateSpinner->setDateTime (when); } if (_slotDataTable != NULL) { _slotDataTable->scrollToDate (when); } setScrollAnnoPushButtonIcon (when); } } //----------------------------------------------------------------------------- // Virtual from BaseRWDlg // Return the value of the dialog box's navigation DateTimeSpinner, // if it has one. Otherwise, return the default Date_Time. //----------------------------------------------------------------------------- Date_Time SlotQtDlg::getDateTime() const { if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time when (*_scrollDateSpinner->getDateTime()); return (when); } static const Date_Time nullWhen; return (nullWhen); } //----------------------------------------------------------------------------- // Virtual from BaseRWDlg // Redraw the dialog box widgets. //----------------------------------------------------------------------------- void SlotQtDlg::guiUpdate() { update(); if (_slotDataTable != NULL) { _slotDataTable->updateContents(); } } //----------------------------------------------------------------------------- // Virtual from BaseRWDlg //----------------------------------------------------------------------------- void SlotQtDlg::notifyAppFontChanged() { static const char (*mname) ("SlotQtDlg::notifyAppFontChanged"); // std::cout << mname << std::endl; if (_slotDataTable_timeColMode) { _slotDataTable_timeColMode->notifyAppFontChanged(); } if (_slotDataTable_slotColMode) { _slotDataTable_slotColMode->notifyAppFontChanged(); } if (_slotDataTable) { // _slotDataTable->notifyAppFontChanged(); _slotDataTable->growColsToData_handler(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showColSumRow() const { const bool doShow = _showColSumRowAction && _showColSumRowAction->isChecked(); return (doShow); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showPriorities() const { const bool doShow = _showPrioritiesAction && _showPrioritiesAction->isChecked(); return (doShow); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showNotesColumn() const { const bool doShow = _showNotesColAction && _showNotesColAction->isChecked(); return (doShow); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showDuplicateCountColumn() const { if (_dispCompressPanel) { SlotQtDlg* mutableThis = const_cast (this); mutableThis->_seriesDisplayCompressSpec = _dispCompressPanel->compressionSpec(); } const DisplayCompress::Op op = _seriesDisplayCompressSpec.op(); const bool opNeedsDupCol = ( (op == DisplayCompress::DISP_COMPR_OP_HIDE_DUPS) || (op == DisplayCompress::DISP_COMPR_OP_HIDE_DUP_FLAGS) || (op == DisplayCompress::DISP_COMPR_OP_HIDE_DUP_PRIOS) ); const bool doShow = _seriesDisplayCompressSpec.panelShown() && opNeedsDupCol; return (doShow); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showSubslotsSupported (bool* defaultOnRet /*=NULL*/) const { // By default, internally indicate "Show Subslots" toggle ON, // even if the toggle is not to be shown. It's more conservative // to allow subslots (or slot columns) to be shown, by default. // if (defaultOnRet) { *defaultOnRet = true; } // tentative if (_shipGoingDown) return (false); //------------------------------->> // Currently, subslots are shown only for Open Slot Dialog mode if (_slot == NULL) return (false); //------------------------------>> // Note: The "Show Subslots" (or "Show Slot Columns") Toggle Button // will initially be supported for only MultiSlots -- and not for // AggSeriesSlots -- all columns should unconditionally be shown for // those. const int colCnt = SlotGUIUtils::getNumCols (_slot); const bool supportShowSubslotsTog = (_isMultiSlot && (colCnt > 1)); if (_isMultiSlot) { // For a MultiSlot, a column count of: // 0: Should not occur. // 1: Indicates no links. // 2: Indicates one link. Showing the single linked column of that // subslot is not necessary, as the data for that subslot is // edited directly through the top-level MultiSlot. if (defaultOnRet) { *defaultOnRet = (colCnt > 2); } } return (supportShowSubslotsTog); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool SlotQtDlg::showSubslots() const { const bool supportShowSubslotsTog = showSubslotsSupported(); if (supportShowSubslotsTog && _showSubslotsCheckBox) { const bool cboxOn = _showSubslotsCheckBox->isChecked(); return (cboxOn); //------------>> } return (false); // Don't showSubslots. } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- const DisplayCompressSpec& SlotQtDlg::dispCompressSpec() // read panel { if (_dispCompressPanel) { _seriesDisplayCompressSpec = _dispCompressPanel->compressionSpec(); } return (_seriesDisplayCompressSpec); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::schedRefreshDisplayCompression() const { static const char (*mname) ("SlotQtDlg::schedRefreshDisplayCompression"); // std::cout << mname << std::endl; if (_shipGoingDown) return; //----------------------->> if (_dispCompressPanel) { _dispCompressPanel->scheduleRecomputeNeeded(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::getObjAcctSummaryDlg (SimObj* obj) { // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _acctSumDlgList.begin(); dlgIter != _acctSumDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (obj == dlg->getSimObj())) { // Ignore dead instances if (dlg->_acctSlotSum != NULL) { return (dlg); //--------->> } } } // Dialog matching SimObj not found return (NULL); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::openObjAcctSummaryDlg (SimObj* obj) { if (obj == NULL) return (NULL); //--------------------------->> SlotQtDlg* dlg = getObjAcctSummaryDlg (obj); if (dlg == NULL) { dlg = new SlotQtDlg (obj); } dlg->showNormal(); dlg->raise(); dlg->setActiveWindow(); return (dlg); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteObjAcctSummaryDlg (SimObj* obj) // NULL=all { std::list delAcctSumDlgList; const bool delAll (obj == NULL); // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _acctSumDlgList.begin(); dlgIter != _acctSumDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (delAll || (obj == dlg->getSimObj()))) delAcctSumDlgList.push_back (dlg); } // Delete the collected dialogs for (dlgIter = delAcctSumDlgList.begin(); dlgIter != delAcctSumDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { dlg->setShipGoingDown(); _acctSumDlgList.remove (dlg); dlg->setAttribute (Qt::WA_DeleteOnClose, true); dlg->close(); } } delAcctSumDlgList.clear(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteAllObjAcctSummaryDlgs() { deleteObjAcctSummaryDlg (NULL); // delete All } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::guiUpdateObjAcctSummaryDlgs (bool appFontChanged /*=false*/) { std::list::const_iterator dlgIter; for (dlgIter = _acctSumDlgList.begin(); dlgIter != _acctSumDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { if (appFontChanged) { dlg->notifyAppFontChanged(); } if (dlg->isShown()) { dlg->guiUpdate(); } } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::getEditAcctDlg (Account* acct) { // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _editAcctDlgList.begin(); dlgIter != _editAcctDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (acct == dlg->getAccount())) { return (dlg); //--------->> } } // Dialog matching Account not found return (NULL); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::openEditAcctDlg (Account* acct) { if (acct == NULL) return (NULL); //---------------------------->> SlotQtDlg* dlg = getEditAcctDlg (acct); if (dlg == NULL) { dlg = new SlotQtDlg (acct); } dlg->showNormal(); dlg->raise(); dlg->setActiveWindow(); return (dlg); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteEditAcctDlg (Account* acct) // NULL=all { std::list delEditAcctDlgList; const bool delAll (acct == NULL); // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _editAcctDlgList.begin(); dlgIter != _editAcctDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (delAll || (acct == dlg->getAccount()))) delEditAcctDlgList.push_back (dlg); } // Delete the collected dialogs for (dlgIter = delEditAcctDlgList.begin(); dlgIter != delEditAcctDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { dlg->setShipGoingDown(); _editAcctDlgList.remove (dlg); dlg->setAttribute (Qt::WA_DeleteOnClose, true); dlg->close(); } } delEditAcctDlgList.clear(); // Since the Account is being deleted, don't issue this update. //-- AccountMgrDlg::updateDlg (acct); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteAllEditAcctDlgs() { deleteEditAcctDlg (NULL); // delete All } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::guiUpdateEditAcctDlgs (bool appFontChanged /*=false*/) { std::list::const_iterator dlgIter; for (dlgIter = _editAcctDlgList.begin(); dlgIter != _editAcctDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { if (appFontChanged) { dlg->notifyAppFontChanged(); } if (dlg->isShown()) { dlg->guiUpdate(); } if (dlg->_account) { AccountMgrDlg::updateDlg (dlg->_account); } } } } // ************************************************* // *** Exchange Balance Dialog Box Maintenance *** // ************************************************* //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::getExchBalDlg (Exchange* exch) { // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _exchBalDlgList.begin(); dlgIter != _exchBalDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (exch == dlg->getExchange())) { return (dlg); //--------->> } } // Dialog matching Account not found return (NULL); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static SlotQtDlg* SlotQtDlg::openExchBalDlg (Exchange* exch) { if (exch == NULL) return (NULL); //---------------------------->> SlotQtDlg* dlg = getExchBalDlg (exch); if (dlg == NULL) { dlg = new SlotQtDlg (exch); } dlg->showNormal(); dlg->raise(); dlg->setActiveWindow(); return (dlg); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteExchBalDlg (Exchange* exch) // NULL=all { std::list delExchBalDlgList; const bool delAll (exch == NULL); // Collect the dialogs to be deleted std::list::const_iterator dlgIter; for (dlgIter = _exchBalDlgList.begin(); dlgIter != _exchBalDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg && (delAll || (exch == dlg->getExchange()))) delExchBalDlgList.push_back (dlg); } // Delete the collected dialogs for (dlgIter = delExchBalDlgList.begin(); dlgIter != delExchBalDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { dlg->setShipGoingDown(); _exchBalDlgList.remove (dlg); dlg->setAttribute (Qt::WA_DeleteOnClose, true); dlg->close(); } } delExchBalDlgList.clear(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::deleteAllExchBalDlgs() { deleteExchBalDlg (NULL); // delete All } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // static void SlotQtDlg::guiUpdateExchBalDlgs (bool appFontChanged /*=false*/) { std::list::const_iterator dlgIter; for (dlgIter = _exchBalDlgList.begin(); dlgIter != _exchBalDlgList.end(); ++dlgIter) { SlotQtDlg (*dlg) (*dlgIter); if (dlg) { if (appFontChanged) { dlg->notifyAppFontChanged(); } if (dlg->isShown()) { dlg->guiUpdate(); } } } } //----------------------------------------------------------------------------- // Prepare Menu for Presentation - Enable/Disable Operations //----------------------------------------------------------------------------- void SlotQtDlg::sensitizeOperations () { static const char (*mname) ("SlotQtDlg::sensitizeOperations"); // std::cout << mname << std::endl; if (_shipGoingDown) return; //----------------------->> if (!rwAssert (_slotDataTable != NULL)) return; //------------------------------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } const bool onDataObj (_simObj && _simObj->isDataObj()); const bool onSnapObj (_simObj && _simObj->isSnapShotObj()); const int slotColCnt (SlotGUIUtils::getNumCols (_slot)); const int slotColBlockCnt (SlotGUIUtils::getNumBlocks (_slot)); const bool isLinkedMulti (_isMultiSlot && (slotColCnt > 1)); const bool hasSeries (_seriesMode); // const int qTableRowCnt (_slotDataTable->numRows()); const int qTableColCnt (_slotDataTable->numCols()); // Retrieve Selection Rectangle Extrema from SlotQDlgTable int minRowInx (0); int maxRowInx (-1); int minColInx (0); int maxColInx (-1); int dataRowCnt (0); const bool properRect (_slotDataTable->cellGridSelectionIsProperRect ( minRowInx, maxRowInx, minColInx, maxColInx, dataRowCnt)); // Retrieve Cell Operation Selection List from SlotQDlgTable const SlotQDlgSelectionList& selList ( _slotDataTable->cellOpSelectionsList()); const bool appModeEditable ( SlotGUIUtils::dataEditable (_slot) || SlotGUIUtils::isEditable (_account) || SlotGUIUtils::isEditable (_exchange) || SlotGUIUtils::slotsAreEditable (_acctSlotSum)); const bool ded = // dialog editable appModeEditable; const bool ed = // editing enabled for selection. ded && _slotDataTable->selectionIncludesEditableSlots() && !_isRplExprSeriesSlot; const bool clrOk = // clearing enabled for selection. ded && _slotDataTable->selectionIsClearable(); const bool fullRows (properRect && (minColInx==0) && (maxColInx==(qTableColCnt-1))); const bool singRow (dataRowCnt == 1); const bool singCol (minColInx == maxColInx); // const bool singFullRow (fullRows && singRow); const bool singCell (singRow && singCol); const bool singValid (singCell && _slotDataTable->cellHasValidValue (minRowInx, minColInx)); const bool copyOpIsProperRect (selList.isProperRect()); // const int maxContig (selList.maxContigCellCnt()); const bool emptySel (selList.size() == 0); const bool isSply (_slot && _slot->isManagedBySupply()); const bool impExpEna (_slot || (singCol && (NULL != _slotDataTable->firstSelAggSlotColSlot()))); // *************************************** // *** Sensitize FILE MENU (_fileMenu) *** // *************************************** RwQtUtils::enableAction (_importResizeAction, impExpEna && ded); RwQtUtils::enableAction (_importFixedSizeAction, impExpEna && ded); RwQtUtils::enableAction (_exportDispPrecAction, impExpEna); RwQtUtils::enableAction (_exportModelPrecAction, impExpEna); RwQtUtils::enableAction (_importResizeSelColAction, ed && singCol); RwQtUtils::enableAction (_importFixedSizeSelColAction, ed && singCol); RwQtUtils::enableAction (_exportDispPrecSelColAction, singCol); RwQtUtils::enableAction (_exportModelPrecSelColAction, singCol); RwQtUtils::enableAction (_plotAction, true); RwQtUtils::enableAction (_showWorkspaceAction, true); RwQtUtils::enableAction (_closeWindowAction, true); sensitizeSctOperations(); // *************************************** // *** Sensitize EDIT MENU (_editMenu) *** // *************************************** const bool enaCopy (properRect); const bool enaPaste (properRect && copyOpIsProperRect && _slotDataTable->testOkPasteCellGridSelection (minRowInx, minColInx)); bool enaCut (!isLinkedMulti && enaCopy); if (_isTableSlot && !fullRows) { // Disable cut for TableSlots if not entire rows selected. enaCut = false; } const bool enaInsRow (!isLinkedMulti && ded && properRect); const bool enaAppRow (enaInsRow && !_isRplExprSeriesSlot); const bool enaInsCpy (!isLinkedMulti && ded && properRect && copyOpIsProperRect); const bool enaSetDim (onDataObj && ded && (_isTableSlot || _isAggSeriesSlot)); const bool enaBlockOps (SlotGUIUtils::supportsBlocks(_slot) && ded); const bool enaBlockDel1 (enaBlockOps && (slotColBlockCnt > 1) && ded); const bool enaBlockDel2 (enaBlockDel1 && !emptySel); const bool enaInterp (properRect && selList.okForInterpolate() && ded); RwQtUtils::enableAction (_cutAction, ed && enaCut); RwQtUtils::enableAction (_copyAction, enaCopy); RwQtUtils::enableAction (_pasteAction, ed && enaPaste); RwQtUtils::enableAction (_pasteAsInputAction, ed && enaPaste); RwQtUtils::enableAction (_exportCopyAction, enaCopy); RwQtUtils::enableAction (_importPasteAction, ed && properRect); RwQtUtils::enableAction (_importResizeAction, ed); RwQtUtils::enableAction (_importFixedSizeAction, ed); RwQtUtils::enableAction (_insertRowCopyAction, ed && enaInsCpy); RwQtUtils::enableAction (_insertRowNewAction, ed && enaInsRow); RwQtUtils::enableAction (_appendRowAction, ded && enaAppRow); RwQtUtils::enableAction (_deleteRowsAction, ed && enaCut); RwQtUtils::enableAction (_deleteRowsBelowAction, ed && enaCut); RwQtUtils::enableAction (_clearAllOutputsAction, ed && hasSeries); RwQtUtils::enableAction (_clearAction, clrOk); RwQtUtils::enableAction (_fillBelowAction, ed && singCell); RwQtUtils::enableAction (_replaceNansBelowAction, ed && singValid); RwQtUtils::enableAction (_interpolateAction, ed && enaInterp); RwQtUtils::enableAction (_adjustValuesAction, ed); RwQtUtils::enableAction (_setNumBlocksAction, ded && enaBlockOps); RwQtUtils::enableAction (_insertTableColAction, ded && singCol); RwQtUtils::enableAction (_appendBlockAction, ded && enaBlockOps); RwQtUtils::enableAction (_deleteBlockAction, ded && enaBlockDel1); RwQtUtils::enableAction (_deleteLastBlockAction, ded && enaBlockDel2); RwQtUtils::enableAction (_setDimensionsAction, ded && enaSetDim); RwQtUtils::enableAction (_setColumnValueAction, ded && singCol); RwQtUtils::enableAction (_maxSyncAction, ded && _isAggSeriesSlot); RwQtUtils::enableAction (_syncToColumn0Action, ded && _isAggSeriesSlot); // *************************************** // *** Sensitize VIEW MENU (_viewMenu) *** // *************************************** const bool enaConfig (_slot || ((_account || _exchange) && appModeEditable)); const bool enaSRange (_slot && hasSeries && !isSply); const bool enaColLab (_slot && ((onDataObj && (_isTableSlot || _isAggSeriesSlot)) || _slot->hasAttribute(Slot::UserSettableColLabelsBit))); const bool enaRowLab (_slot && !_isTableSeriesSlot && ((onDataObj && _isTableSlot) || _slot->hasAttribute(Slot::UserSettableRowLabelsBit))); RwQtUtils::enableAction (_configureAction, enaConfig); RwQtUtils::enableAction (_seriesRangeAction, enaSRange); RwQtUtils::enableAction (_columnLabelsAction, ded && enaColLab); RwQtUtils::enableAction (_rowLabelsAction, ded && enaRowLab); const bool useAcctColors (_slotDataTable->useAcctColors()); _useAcctColorsAction->setOn (useAcctColors); // *********************************************** // *** Sensitize TIMESTEP MENU (_timestepMenu) *** // *********************************************** RwQtUtils::enableAction (_setInputSelAction, ed); RwQtUtils::enableAction (_setInputAllAction, ed); RwQtUtils::enableAction (_setOutputSelAction, ed); RwQtUtils::enableAction (_setOutputAllAction, ed); RwQtUtils::enableAction (_clearSelNonInputsAction, ed); RwQtUtils::enableAction (_clearSelValuesAction, ed); RwQtUtils::enableAction (_clearAllValuesAction, clrOk); RwQtUtils::enableAction (_reverseIOAction, ed); RwQtUtils::enableAction (_reverseIOAllAction, ed); const bool allowT (SlotGUIUtils::flagIsAllowedOnSlot_Target (_slot)); const bool allowB (SlotGUIUtils::flagIsAllowedOnSlot_BestEff (_slot)); const bool allowM (SlotGUIUtils::flagIsAllowedOnSlot_MaxCap (_slot)); const bool allowU (SlotGUIUtils::flagIsAllowedOnSlot_Unit (_slot)); const bool allowD (SlotGUIUtils::flagIsAllowedOnSlot_Drift (_slot)); RwQtUtils::enableAction (_setTargetBeginAction, ed && allowT); RwQtUtils::enableAction (_setTargetAction, ed && allowT); RwQtUtils::enableAction (_setBestEfficiencyAction, ed && allowB); RwQtUtils::enableAction (_setMaxCapacityAction, ed && allowM); RwQtUtils::enableAction (_setUnitValuesFlagAction, ed && allowU); RwQtUtils::enableAction (_setDriftAction, ed && allowD); // ******************************************* // *** Sensitize ADJUST MENU (_adjustMenu) *** // ******************************************* // subsequent processing occurs in sensitizeAdjustOperations(). _adjustMenuSensitizeNeeded = true; // ****************************************** // *** Sensitize Periodic Slot Operations *** // ****************************************** bool pSlotEna_SetRowDate (false); bool pSlotEna_AddRow (false); bool pSlotEna_DupRow (false); bool pSlotEna_DelRows (false); bool pSlotEna_AddColumn (false); bool pSlotEna_DupColumn (false); bool pSlotEna_DelColumn (false); PeriodicSlot* pslot = dynamic_cast (_slot); if (pslot != NULL) { TimeLine* rowMap = pslot->getRowMap(); if (rowMap && !rowMap->isRegularInterval()) { // Irregular Interval: Enable Row Operations pSlotEna_SetRowDate = ed && singRow; pSlotEna_AddRow = ed; pSlotEna_DupRow = ed && singRow; pSlotEna_DelRows = ed && (dataRowCnt > 0); } const bool colsMutable = (pslot->isColumnGuiEditingEnabled()) || onDataObj; const int pslotColCnt = pslot->numColumns(); pSlotEna_AddColumn = ed && colsMutable; pSlotEna_DupColumn = ed && colsMutable && singCol; pSlotEna_DelColumn = ed && colsMutable && singCol && (pslotColCnt > 1); } RwQtUtils::enableAction (_perioSlot_SetRowDate, pSlotEna_SetRowDate); RwQtUtils::enableAction (_perioSlot_AddRow, pSlotEna_AddRow); RwQtUtils::enableAction (_perioSlot_DupRow, pSlotEna_DupRow); RwQtUtils::enableAction (_perioSlot_DelRows, pSlotEna_DelRows); RwQtUtils::enableAction (_perioSlot_AddColumn, pSlotEna_AddColumn); RwQtUtils::enableAction (_perioSlot_DupColumn, pSlotEna_DupColumn); RwQtUtils::enableAction (_perioSlot_DelColumn, pSlotEna_DelColumn); // ************************************** // *** Update Description Panel State *** // ************************************** updateDescriptBoxVisibility(); // ******************************** // *** Sensitize Other Controls *** // ******************************** const bool isTimeColMode (_acctSlotSum && _acctSlotSum->colMode() == AcctSlotSummary::COL_MODE_TIME); _displayCompressPushButton->setShown (hasSeries && !isTimeColMode); _showDispCompAction->setEnabled (hasSeries && !isTimeColMode); sensitizePartialDateTimeApply(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sensitizeSctOperations() { static const char* mname ("SlotQtDlg::sensitizeSctOperations"); if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } int shownSctCnt (0); SctDialog *dummyDlg; dummyDlg = SctManagerInst->getFirstShownSctDialog (&shownSctCnt); RwQtUtils::enableAction (_addToNewSctAction, true); RwQtUtils::enableAction (_addToOpenSctAction, (shownSctCnt == 1)); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sensitizePartialDateTimeApply() { static const char* mname ("SlotQtDlg::sensitizePartialDateTimeApply"); if (_partialDateTimeEditor && _partialDateTimeEditor->isShown()) { if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } // Retrieve Cell Operation Selection List from SlotQDlgTable const SlotQDlgSelectionList& selList ( _slotDataTable->cellOpSelectionsList()); int solValCnt (0); double solVal (INVALIDVALUE); const bool allMatch = selList.allValuesMatch (solValCnt, solVal, true); // nonInputsNaN // std::cout << mname << " ValsMatch? " << (allMatch ? "Yes" : "No") // << ", cnt " << solValCnt << ", val " << solVal // << std::endl; _partialDateTimeEditor-> setApplyTargetValue (allMatch ? solVal : INVALIDVALUE); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sensitizeAdjustOperations() { static const char (*mname) ("SlotQtDlg::sensitizeAdjustOperations"); if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } // Retrieve Selection Rectangle Extrema from SlotQDlgTable int minRowInx (0); int maxRowInx (-1); int minColInx (0); int maxColInx (-1); int dataRowCnt (0); const bool properRect (_slotDataTable->cellGridSelectionIsProperRect ( minRowInx, maxRowInx, minColInx, maxColInx, dataRowCnt)); properRect; // to silence compiler warning // const int numCols (_slotDataTable->numCols()); const int numRows (_slotDataTable->numRows()); const bool singCol (minColInx == maxColInx); const int atLeastTwoShownCols ( RwQt3Utils::shownColCountAtLeast (_slotDataTable, 2)); // ******************************************* // *** Sensitize ADJUST MENU (_adjustMenu) *** // ******************************************* bool colsEqualRefCol (false); // All columns match reference column bool colsFitOrExceedData (false); // All columns fit or exceed content bool colsFitData (false); // All columns match content width bool colsFitHead (false); // All columns fit header widths bool colsFitAll (false); // All columns match header and data _slotDataTable->assessColFitStatus (minColInx, // refCol (numRows <= 2000), // full computation colsEqualRefCol, colsFitOrExceedData, colsFitData, colsFitHead, colsFitAll); // std::cout << mname << " assessColFitStatus (" << minColInx << "): \n" // << " ... colsEqualRefCol: " << colsEqualRefCol << std::endl // << " ... colsFitOrExceedData: " << colsFitOrExceedData << std::endl // << " ... colsFitData: " << colsFitData << std::endl // << " ... colsFitHead: " << colsFitHead << std::endl // << " ... colsFitAll: " << colsFitAll << std::endl; bool setColWidthsEna (atLeastTwoShownCols && singCol && !colsEqualRefCol); const bool growColsToDataEna (!colsFitOrExceedData); const bool fitColsToDataEna (!colsFitData); const bool fitColsToAllEna (!colsFitAll); const bool fitColsToHeadEna (!colsFitHead); RwQtUtils::enableAction (_setColWidthsAction, setColWidthsEna); RwQtUtils::enableAction (_growColsToDataAction, growColsToDataEna); RwQtUtils::enableAction (_fitColsToDataAction, fitColsToDataEna); RwQtUtils::enableAction (_fitColsToAllAction, fitColsToAllEna); RwQtUtils::enableAction (_fitColsToHeadAction, fitColsToHeadEna); // Note: Disabling QActions on Solaris doesn't seem to change icons // accordingly. So, manage the disabled state of the icon manually. // _setColWidthsAction -> setIconSet (setColWidthsEna ? RwQPixmap16::sizeColsCurEna() : RwQPixmap16::sizeColsCurDis()); _growColsToDataAction -> setIconSet (growColsToDataEna ? RwQPixmap16::growColsDataEna() : RwQPixmap16::growColsDataDis()); _fitColsToDataAction -> setIconSet (fitColsToDataEna ? RwQPixmap16::sizeColsDataEna() : RwQPixmap16::sizeColsDataDis()); _fitColsToAllAction -> setIconSet (fitColsToAllEna ? RwQPixmap16::sizeColsAllEna() : RwQPixmap16::sizeColsAllDis()); _fitColsToHeadAction -> setIconSet (fitColsToHeadEna ? RwQPixmap16::sizeColsHeadEna() : RwQPixmap16::sizeColsHeadDis()); // Done: Cancel Request. _adjustMenuSensitizeNeeded = false; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sensitizeScrollAnnoMenu() { static const char (*mname) ("SlotQtDlg::sensitizeScrollAnnoMenu"); if (!_scrollAnnoPushButton) return; //------------------------------->> if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } SeriesNoteQMultiMap seriesNoteMap; _slotDataTable->getCompositeSeriesNoteQMultiMap (seriesNoteMap); const int itemCnt = seriesNoteMap.count(); const bool showScrollAnnoPushButton = (itemCnt > 0); if (showScrollAnnoPushButton) { // Set Maximum Width of Icon Push Button. Hopefully, on Windows, // this will limit the width of the button to the icon and the // indicator. const QStyle* aps (QApplication::style()); const int butInd = aps->pixelMetric (QStyle::PM_MenuButtonIndicator); const int margin = aps->pixelMetric (QStyle::PM_ButtonMargin); const int butWidth = RwQPixmap11::annoIcon_Yello().width() + butInd + margin + margin; // std::cout << mname << " maxWidth " << butWidth << std::endl; _scrollAnnoPushButton->setMaximumWidth (butWidth); } _scrollAnnoPushButton->setShown (showScrollAnnoPushButton); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::sensitizePrioritiesRelevant (bool forceOnEna /*=false*/) { static const char (*mname) ("SlotQtDlg::sensitizePrioritiesRelevant"); if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } const bool wasOn = _showPrioritiesAction && _showPrioritiesAction->isChecked(); const RunInfo (*rinfo) (rwWorkspace->getRunInfo()); const RunType rtype = rinfo->getType(); const bool prioritiesRelevant = _seriesMode && rinfo && ( (rtype == RT_RULEBASED) || // Rulebased Simulation (rtype == RT_RULE_ACCOUNTING) || // Inline Rulebased Sim and Accounting (rtype == RT_OPT) ); // Optimization const bool doForceOff = wasOn && !prioritiesRelevant; const bool doForceOn = !wasOn && prioritiesRelevant && forceOnEna && (_appMode == SQD_APP_MODE_OPEN_SLOT); // std::cout << mname // << " runType: " << (int) rtype // << ", relevant? " << (prioritiesRelevant ? "YES" : "NO") // << (doForceOff ? ", force off" : "") // << (doForceOn ? ", force on" : "") // << std::endl; if (_showPrioritiesAction) _showPrioritiesAction->setEnabled (prioritiesRelevant); if (doForceOff) { if (_showPrioritiesAction) _showPrioritiesAction->setChecked (false); showPrioritiesHandler (false); } else if (doForceOn) { if (_showPrioritiesAction) _showPrioritiesAction->setChecked (true); showPrioritiesHandler (true); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::updateDescriptBoxVisibility() { static const char* mname ("SlotQtDlg::updateDescriptBoxVisibility"); if (_descDispBox) { const bool descShown = descriptionShown(); const bool slotHasDesc = descriptionDefined(); _descDispBox->setVisible (true); if (rwAssert (_descDispPanel != NULL)) { _descDispPanel->setVisible (descShown); } descToggles_updateRelevance(); int descDispBox_newMaxHeight (800); if (!descShown) { descDispBox_newMaxHeight = 4 + (_descToggles ? _descToggles->height() : 20); } // std::cout << mname << " _descDispBox setMaximumHeight (" // << descDispBox_newMaxHeight << ")" << std::endl; _descDispBox->setMaximumHeight (descDispBox_newMaxHeight); if (!descShown) { if (_descDispPanel) _descDispPanel->implicitAccept(); closeDescBoxSplitterSection(); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::tableSelectionChanged () { // *********************************** // *** Update Selection Status Bar *** // *********************************** static const bool doInvalidateSelection (false); refreshStatusBar (doInvalidateSelection); // [don't] // Refresh Partial Date Time Editor only if a cell selection is active. const SlotQDlgSelectionList& selList ( _slotDataTable->cellOpSelectionsList()); if (!selList.empty()) { refreshPartialDateTimeEditor(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::setScrollAnnoPushButtonIcon () { if (_scrollDateSpinner != NULL) { _scrollDateSpinner->forceInterpretText(); const Date_Time when (*_scrollDateSpinner->getDateTime()); setScrollAnnoPushButtonIcon (when); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::setScrollAnnoPushButtonIcon (const Date_Time& /*when*/) { if (_scrollAnnoPushButton != NULL) { SeriesNoteQMultiMap seriesNoteMap; _slotDataTable->getCompositeSeriesNoteQMultiMap (seriesNoteMap); _scrollDateSpinner->forceInterpretText(); const Date_Time scrollSpinDate (*_scrollDateSpinner->getDateTime()); const seconds_t scrollSpinAbsSecs (scrollSpinDate.getAbsSeconds()); const QPixmap* useAnnoIcon (NULL); QMultiMap ::iterator assocIter; for (assocIter = seriesNoteMap.begin(); assocIter != seriesNoteMap.end(); ++assocIter) { const AnnoNoteID noteID = assocIter->annoNoteID(); const seconds_t absSecs = assocIter->tstepSecs(); const QPixmap* annoIcon = NoteQtUtils::annoIconForNoteId (noteID); if (annoIcon) { useAnnoIcon = annoIcon; if (absSecs >= scrollSpinAbsSecs) break; //-------------------------------------- } } if (useAnnoIcon) { const QPixmap& annoIcon (*useAnnoIcon); _scrollAnnoPushButton->setIconSet (annoIcon); } } } //----------------------------------------------------------------------------- // Handles requests to configure the series on the slot //----------------------------------------------------------------------------- void SlotQtDlg::configSeriesHandler() { if (_slot != NULL) { openChildDlg (_slot, TimeseriesRangeEvent, false); } } //----------------------------------------------------------------------------- // Handles requests to import (resize) //----------------------------------------------------------------------------- void SlotQtDlg::importResize() { importSlot(true, //--- resize false); //--- all columns } //----------------------------------------------------------------------------- // Handles requests to import (resize) only the selected columns //----------------------------------------------------------------------------- void SlotQtDlg::importResizeSelCol() { importSlot(true, //--- resize true); //--- only selected cols } //----------------------------------------------------------------------------- // Handles requests to import (fixed) //----------------------------------------------------------------------------- void SlotQtDlg::importFixed() { importSlot(false, //--- fixed size false); //--- all columns } //----------------------------------------------------------------------------- // Handles requests to import (fixed) only the selected columns //----------------------------------------------------------------------------- void SlotQtDlg::importFixedSelCol() { importSlot(false, //--- fixed size true); //--- only selected columns } //----------------------------------------------------------------------------- // Handles requests to export (display) //----------------------------------------------------------------------------- void SlotQtDlg::exportDisplay() { exportSlot(true, //--- display precision false); //--- all columns } //----------------------------------------------------------------------------- // Handles requests to export (display) only the selected cols //----------------------------------------------------------------------------- void SlotQtDlg::exportDisplaySelCol() { exportSlot(true, //--- display precision true); //--- only selected columns } //----------------------------------------------------------------------------- // Handles requests to export (model) //----------------------------------------------------------------------------- void SlotQtDlg::exportModel() { exportSlot(false, //--- model precision false); //--- all columns } //----------------------------------------------------------------------------- // Handles requests to export (model) only the selected columns //----------------------------------------------------------------------------- void SlotQtDlg::exportModelSelCol() { exportSlot(false, //--- model precision true); //--- only selected columns } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::buildRplEvalSettingPanel() { // Build Widgets: // QFrame* _rplEvalSettingPanel; // QLabel* _rplEvalTimeTitleLabel; // QLabel* _rplEvalTimeValueLabel; // QLabel* _rplEvalRangeTitleLabel; // QLabel* _rplEvalRangeValueLabel; _rplEvalSettingPanel = new QFrame (this); _rplEvalSettingPanel->setObjectName ("_rplEvalSettingPanel"); _rplEvalSettingPanel->setFrameShape (QFrame::NoFrame); _rplEvalSettingPanel->setFrameShadow (QFrame::Plain); _rplEvalSettingPanel->setLineWidth (0); _rplEvalGrid = new QGridLayout (_rplEvalSettingPanel); _rplEvalGrid->setMargin (0); _rplEvalGrid->setObjectName ("_rplEvalGrid"); _rplEvalGrid->setContentsMargins (0,0,0,0); // left top right bottom int nextGridRow (0); // ************************************************ // *** Rpl Evaluation Settings Display Labels *** // ************************************************ _rplEvalTimeTitleLabel = new QLabel (_rplEvalSettingPanel); _rplEvalTimeValueLabel = new QLabel (_rplEvalSettingPanel); _rplEvalRangeTitleLabel = new QLabel (_rplEvalSettingPanel); _rplEvalRangeValueLabel = new QLabel (_rplEvalSettingPanel); _rplEvalTimeTitleLabel -> setObjectName ("_rplEvalTimeTitleLabel"); _rplEvalTimeValueLabel -> setObjectName ("_rplEvalTimeValueLabel"); _rplEvalRangeTitleLabel -> setObjectName ("_rplEvalRangeTitleLabel"); _rplEvalRangeValueLabel -> setObjectName ("_rplEvalRangeValueLabel"); QSizePolicy sizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch (1); sizePolicy.setVerticalStretch (0); sizePolicy.setHeightForWidth ( _rplEvalTimeValueLabel->sizePolicy ().hasHeightForWidth ()); _rplEvalTimeValueLabel->setSizePolicy (sizePolicy); sizePolicy.setHeightForWidth ( _rplEvalRangeValueLabel->sizePolicy ().hasHeightForWidth ()); _rplEvalRangeValueLabel->setSizePolicy (sizePolicy); _rplEvalGrid->addWidget (_rplEvalTimeTitleLabel, nextGridRow+0, 0, 1, 1); _rplEvalGrid->addWidget (_rplEvalTimeValueLabel, nextGridRow+0, 1, 1, 1); _rplEvalGrid->addWidget (_rplEvalRangeTitleLabel, nextGridRow+1, 0, 1, 1); _rplEvalGrid->addWidget (_rplEvalRangeValueLabel, nextGridRow+1, 1, 1, 1); _rplEvalTimeTitleLabel -> setText (tr ("Evaluation Time: ")); _rplEvalRangeTitleLabel -> setText (tr ("Evaluation Range: ")); _rplEvalTimeValueLabel -> setText (""); _rplEvalRangeValueLabel -> setText (""); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void SlotQtDlg::updateRplEvalTime() { RplExprSlotMgr::EvalTime evalTime (_slot ? _slot->getExprEvalTime() : RplExprSlotMgr::NEVER); if (_rplEvalTimeValueLabel) { const QString evalTimeStr = SlotGUIUtils::getEvalTimeString (evalTime); _rplEvalTimeValueLabel->setText (evalTimeStr); } schedResizeOptimal(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::updateRplSeriesRange() { QString rangeStr (""); SeriesSlot *seriesSlot (dynamic_cast(_slot)); if (seriesSlot) { DeltaTime step = seriesSlot->getExprStepSize(); QString stepStr = QString::number(step.time()) + " " + QString(step.unitsAsString()); if (seriesSlot->getExprSynchWithRun()) { rangeStr = "Run start to run finish (Step: " + stepStr + ")"; } else { DeltaTime step = seriesSlot->getExprStepSize(); QString stepStr = QString::number(step.time()) + " " + QString(step.unitsAsString()); const Date_Time exprStartDate = seriesSlot->getExprStartDate(); const Date_Time exprEndDate = seriesSlot->getExprEndDate(); QString startDateStr = getDateTimeString(&exprStartDate); QString endDateStr = getDateTimeString(&exprEndDate); rangeStr = startDateStr + " -- " + endDateStr + " (Step: " + stepStr + ")"; } } if (_rplEvalRangeValueLabel) { _rplEvalRangeValueLabel->setText (rangeStr); } schedResizeOptimal(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Yet another string formatting method. Maybe calls to this can be replaced // with a call to a Date_Time method. Or else this can be moved into Date_Time? QString SlotQtDlg::getDateTimeString (const Date_Time* dt) const { if (!rwAssert (dt != NULL)) return (""); const char* monthStr (""); switch (dt->get_mon()) { case 0: monthStr = "Jan"; break; case 1: monthStr = "Feb"; break; case 2: monthStr = "Mar"; break; case 3: monthStr = "Apr"; break; case 4: monthStr = "May"; break; case 5: monthStr = "Jun"; break; case 6: monthStr = "Jul"; break; case 7: monthStr = "Aug"; break; case 8: monthStr = "Sep"; break; case 9: monthStr = "Oct"; break; case 10: monthStr = "Nov"; break; case 11: monthStr = "Dec"; break; default: monthStr = "???"; break; } QString dateStr; dateStr.sprintf("%s %02d %d %02d:%02d", monthStr, dt->get_mday(), dt->get_year(), dt->get_hour(), dt->get_min()); return dateStr; } //----------------------------------------------------------------------------- //+protected // // METHOD: // void SlotQtDlg::disableModelEdit() // // PURPOSE: // Prevents the user from editing any parameters on the model. // //----------------------------------------------------------------------------- void SlotQtDlg::disableModelEdit() { static const char (*mname) ("SlotQtDlg::disableModelEdit"); // std::cout << mname << std::endl; _disableModelEditCalled = true; if (_slotNameEdit != NULL) { _slotNameEdit->setReadOnly(true); } _slotDataTable->updateModelEditStatus(); // *************************************** // *** Rpl Expression Slot Functions *** // *************************************** sensitizeOperations(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //+protected // // METHOD: // virtual void StatTableSlotDlg::createChildDlg (void *, int typeCode) // // PURPOSE: // Creates the Galaxy child dialogs //----------------------------------------------------------------------------- BaseRWDlg* SlotQtDlg::createChildDlg (void* /*assocObj*/, int typeCode) { static const char (*mname) ("SlotQtDlg::createChildDlg"); BaseRWDlg (*thisBaseRWDlg) (dynamic_cast(this)); // std::cout << mname << " [" << typeCode << "] thisBaseRWDlg: " // << (thisBaseRWDlg ? "DEFINED" : "NULL") << std::endl; if (typeCode == ConfigurationEvent) { SlotConfigQtDlg *dlg = new SlotConfigQtDlg(_slot); connect (dlg, SIGNAL (sourceSlotChangeApplied (Slot*)), this, SLOT (slotCfgChangeApplied (Slot*))); return dlg; } else if (typeCode == ConfigPeriodicSlotEvent) { PeriodicSlot* pslot = dynamic_cast (_slot); PeriodicSlotCfg *dlg = new PeriodicSlotCfg (pslot, this, "PeriodicSlotCfg", true); dlg->setListener (this); return (dlg); } else if (typeCode == TimeseriesRangeEvent) { SlotTimeseriesRangeQtDlg *dlg = new SlotTimeseriesRangeQtDlg(_slot); return dlg; } else if (typeCode == RowLabelEditorEvent) { RowColLabelEditor *dlg = new RowColLabelEditor (thisBaseRWDlg, NULL, true); // modal dlg->setSlot (_slot, true); // edit row labels return dlg; } else if (typeCode == ColumnLabelEditorEvent) { RowColLabelEditor *dlg = new RowColLabelEditor (thisBaseRWDlg, NULL, true); // modal dlg->setSlot (_slot, false); // edit column labels return dlg; } return NULL; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::childDestroyedHandler (BaseRWDlg* child, void*) { BaseRWDlg::childDestroyedHandler(child, NULL); } //----------------------------------------------------------------------------- //+protected slot // // METHOD: // void plotSlot() // // PURPOSE: // Plots the current slot. // //----------------------------------------------------------------------------- void SlotQtDlg::plotSlot() { PlotDialog *plotDialog = new PlotDialog( // As long as we have this bug with nesting BaseQtMainWin dialogs // we have to make the parent of the nested dialog be NULL, instead // of the "this" dialog. NULL); plotDialog->setPlotLayout(1,1); const int curvesPlotted = _slotDataTable->addSelectedSlotsToPlot (plotDialog); if (curvesPlotted >= 1) { BlockAllDialogs blockAllDialogs; if (_scrollDateSpinner) { Date_Time when (getDateTime()); if (when.getAbsSeconds() != 0L) { plotDialog->setDateMarker (when, true); // autoScaleFullRange } } plotDialog->show(); } else { // Drats! delete plotDialog; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::addToNewSct_activated() { static const char (*mname) ("SlotQtDlg::addToNewSct_activated"); // ******************************************************* // *** Create new SCT with SlotQDlgTable's Slot List *** // ******************************************************* SctDialog *sctDlg = new SctDialog(); sctDlg->setLocked (false); SctConfig *sctCfg = sctDlg->sctConfig(); sctCfg->setTextInSlotDividerRows (false); sctCfg->setDetailMode (SCT_DETAIL_MODE_NO_SUMMARIES); const int slotsAdded = _slotDataTable->addSlotsToSct (sctDlg, true, // addDividerFirst, false, // countOnly, false); // rebuildIfSlotsAdded // *** Show SctDialog *** sctDlg->showNormal(); sctDlg->raise(); sctDlg->setActiveWindow(); if (slotsAdded > 0) { sctDlg->rebuild(); if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time when = *_scrollDateSpinner->getDateTime(); sctDlg->setDateTimeSpinner (when, true); // scroll too } } // std::cout << mname << " Added " << slotsAdded // << " Slot(s)" << std::endl; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::addToOpenSct_activated() { static const char (*mname) ("SlotQtDlg::addToOpenSct_activated"); // ****************************************************************** // *** Add the SlotQDlgTable's Slot List to a distinct Open SCT *** // ****************************************************************** int shownSctDlgCnt (0); SctDialog *sctDlg = SctManagerInst->getFirstShownSctDialog (&shownSctDlgCnt); if (sctDlg) { sctDlg->setLocked (false); const int slotsAdded = _slotDataTable->addSlotsToSct (sctDlg, true, // addDividerFirst, false, // countOnly, false); // rebuildIfSlotsAdded // *** Show SctDialog *** sctDlg->showNormal(); sctDlg->raise(); sctDlg->setActiveWindow(); if (slotsAdded > 0) { sctDlg->rebuild(); if (_scrollDateSpinner) { _scrollDateSpinner->forceInterpretText(); const Date_Time when = *_scrollDateSpinner->getDateTime(); sctDlg->setDateTimeSpinner (when, true); // scroll too } } // std::cout << mname << " Added " << slotsAdded // << " Slot(s)" << std::endl; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showWorkspaceAction_activated() { static const char (*mname) ("SlotQtDlg::showWorkspaceAction_activated"); // std::cout << mname << std::endl; QGui::raiseWorkspace(); } //----------------------------------------------------------------------------- //+protected // // METHOD: // void exportSlot() // // PURPOSE: // Exports the data in the series slot using the specified precision. // // NOTE: // 'onlySelected' is supported only for AggSeriesSlots // //----------------------------------------------------------------------------- void SlotQtDlg::exportSlot(bool dispPrec, bool onlySelected) { const QString precisionStr = (dispPrec ? "Display" : "Model"); QString chooserPath (_importExportSlotPath); if (chooserPath.isEmpty()) chooserPath = "./"; Slot* expSlot (_slot); if (onlySelected || (expSlot == NULL)) { expSlot = _slotDataTable->firstSelAggSlotColSlot(); if (!rwAssert (expSlot != NULL)) return; //------------------------------------>> } SeriesSlot (*expSerSlot) (dynamic_cast(expSlot)); const bool supportsAltUnits (SlotGUIUtils::supportsAltUnits (expSerSlot)); const bool usesAltForFlow (SlotGUIUtils::flowIsAltUnit (expSerSlot, 0)); const bool flowOn (_unitTypeFlowPushButton->isChecked()); const bool useAltUnits (supportsAltUnits && (usesAltForFlow == flowOn)); QString captionStr (""); captionStr.sprintf ("Export Slot: %s (%s precision)", qPrintable(expSlot->getCompleteName()), precisionStr.ascii()); QString fname = Q3FileDialog::getSaveFileName( chooserPath, // initial selection directory "*", // filter this, // parent "Export Slot", // name captionStr); // caption if (fname.isEmpty()) return; //=======================>> // Save new _importExportSlotPath value. QFileInfo fInfo (fname); setChooserPath (fInfo.filePath()); QString error; cwFile file (fname); file.compressionAllowed (false); cwfpointer fp; if (file.isExtant(&error)) { QString warnMessage = fname + " already exists.\n" + "Do you want to replace it?"; if (QMessageBox::warning (this, captionStr, warnMessage, QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton) == QMessageBox::No) return; //=======================>> } { BlockAllDialogs blockDialogs; bool fileOpenOk(file.open(fp, cwFile::Write)); if (fileOpenOk) { if (onlySelected && expSerSlot) { expSerSlot->SeriesSlot::exportData ((FILE*) fp, dispPrec, // bool displayFormat = true false, // bool exportFlags = false useAltUnits); // bool altUnits = false } else { expSlot->exportData ((FILE*) fp, dispPrec, // bool displayFormat = true false, // bool exportFlags = false useAltUnits); // bool altUnits = false } file.close(fp); } else { QMessageBox::warning (this, captionStr, file.lastError()); } } } //----------------------------------------------------------------------------- //+protected // // METHOD: // void importSlot() // // PURPOSE: // Exports the data in the series slot using the specified precision. // // NOTE: // 'onlySelected' is supported only for AggSeriesSlots // //----------------------------------------------------------------------------- void SlotQtDlg::importSlot (bool doResizeSlot, bool onlySelected) { const QString sizeStr = (doResizeSlot ? "Resize" : "Fixed Size"); QString chooserPath (_importExportSlotPath); if (chooserPath.isEmpty()) chooserPath = "./"; Slot *impSlot (_slot); if (onlySelected || (impSlot == NULL)) { impSlot = _slotDataTable->firstSelAggSlotColSlot(); if (!rwAssert (impSlot != NULL)) return; //------------------------------------>> } // Use the displayed Slot for units used in the import operation // (including the determination of whether or not ALT units are to be used). // However, when assigning values to Slots, sometimes some other Slot // must receive the values, e.g. when assigning values to an Account // MultiSlot, the linked Supply Slot needs to be the target Slot. Slot (*unitRefSlot) (impSlot); SeriesSlot (*impSerSlot) (SlotGUIUtils::getSeriesSlotToEdit (impSlot, 0)); const bool supportsAltUnits (SlotGUIUtils::supportsAltUnits (unitRefSlot)); const bool usesAltForFlow (SlotGUIUtils::flowIsAltUnit (unitRefSlot, 0)); const bool flowOn (_unitTypeFlowPushButton->isChecked()); const bool useAltUnits (supportsAltUnits && (usesAltForFlow == flowOn)); QString captionStr (""); captionStr.sprintf ("Import Slot: %s (%s)", qPrintable(impSlot->getCompleteName()), sizeStr.ascii()); QString fname = Q3FileDialog::getOpenFileName( chooserPath, // initial selection directory "*", // filter this, // parent "Import Slot", // name captionStr); // caption if (fname.isEmpty()) return; //=======================>> // Save new _importExportSlotPath value. QFileInfo fInfo (fname); setChooserPath (fInfo.filePath()); QString error; cwFile file (fname); file.compressionAllowed (false); cwfpointer fp; if (!file.isExtant(&error)) { QString warnMessage = fname + " cannot be opened."; QMessageBox::warning (this, captionStr, warnMessage); importSlot(doResizeSlot, onlySelected); return; //=======================>> } { BlockAllDialogs blockDialogs; bool fileOpenOk(file.open(fp, cwFile::Read)); if (fileOpenOk) { if (impSerSlot != NULL) { if (onlySelected) { // Prevent call to AggSeriesSlot method (if impSerSlot // happens to be an AggSeriesSlot). Call as a SeriesSlot. // impSerSlot->SeriesSlot::importData ((FILE*) fp, doResizeSlot, false, // bool importFlags = false ValueState::INPUT, NULL, useAltUnits, // bool altUnits = false unitRefSlot); // const Slot *cfgSlot = NULL } else // (not onlySelected) { impSerSlot->importData ((FILE*) fp, doResizeSlot, false, // bool importFlags = false ValueState::INPUT, NULL, useAltUnits, // bool altUnits = false unitRefSlot); // const Slot *cfgSlot = NULL } impSerSlot->setAllValues(); } else // (impSerSlot == NULL) { // Support for non-SeriesSlots, e.g. TableSlots. impSlot->importData ((FILE*) fp, doResizeSlot, false, // bool importFlags = false ValueState::INPUT, NULL, useAltUnits, // bool altUnits = false unitRefSlot); // const Slot *cfgSlot = NULL } file.close(fp); } else { QMessageBox::warning (this, captionStr, file.lastError()); } } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // DescriptDisplayPanel Interface, virtual from DescriptDisplayPanel_Listener QString SlotQtDlg::descriptDispPanel_GetSavedText (DescriptDisplayPanel*) { QString savedText (""); if (_slot) { const QString descText (_slot->getUserDesc()); savedText = descText; } return (savedText); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // DescriptDisplayPanel Interface, virtual from DescriptDisplayPanel_Listener void SlotQtDlg::descriptDispPanel_ApplyNewText (DescriptDisplayPanel*, const QString& newText) { if (_slot) { _slot->setUserDesc (newText); } descToggles_updateRelevance(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // DescriptDisplayPanel Interface, virtual from DescriptDisplayPanel_Listener void SlotQtDlg::descriptDispPanel_GetPrintable (DescriptDisplayPanel*, QString& docTitle, QString& docText) { if (_slot) { static const QString nullPrefix (""); DescriptDisplayPanel::getSlotPrintText (_slot, nullPrefix, docTitle, docText); } } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // DescriptDisplayPanel Interface, virtual from DescriptDisplayPanel_Listener void SlotQtDlg::descriptDispPanel_HideRequested (DescriptDisplayPanel*) { if (_descTogglesIndex_desc >= 0) { _descToggles->setToggleOn (_descTogglesIndex_desc, false); } descToggles_updateRelevance(); updateDescriptBoxVisibility(); _slotDataTable = _timeColMode ? _slotDataTable_timeColMode : _slotDataTable_slotColMode; _slotDataTableStack->raiseWidget (_slotDataTable); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- // private virtual from PeriodicSlotCfgListener void SlotQtDlg::periodSlotCfgOk (PeriodicSlotCfg*) { _slotDataTable->recomputeCellLayout (0); _slotDataTable->refreshTableSlotRows(); _slotDataTable->refreshColumnLabels(); _slotDataTable->refreshMainEditCellData(); refreshColMapEntityName(); refreshPeriodicSlotBottomWidgets(); } // private virtual from PeriodicSlotCfgListener void SlotQtDlg::periodSlotCfgApply (PeriodicSlotCfg*) { _slotDataTable->recomputeCellLayout (0); _slotDataTable->refreshTableSlotRows(); _slotDataTable->refreshColumnLabels(); _slotDataTable->refreshMainEditCellData(); refreshColMapEntityName(); refreshPeriodicSlotBottomWidgets(); } // private virtual from PeriodicSlotCfgListener void SlotQtDlg::periodSlotCfgReset (PeriodicSlotCfg*) { _slotDataTable->recomputeCellLayout (0); _slotDataTable->refreshTableSlotRows(); _slotDataTable->refreshColumnLabels(); _slotDataTable->refreshMainEditCellData(); refreshColMapEntityName(); refreshPeriodicSlotBottomWidgets(); } // private virtual from PeriodicSlotCfgListener void SlotQtDlg::periodSlotCfgCancel (PeriodicSlotCfg*) { _slotDataTable->recomputeCellLayout (0); _slotDataTable->refreshTableSlotRows(); _slotDataTable->refreshColumnLabels(); _slotDataTable->refreshMainEditCellData(); refreshColMapEntityName(); refreshPeriodicSlotBottomWidgets(); } //----------------------------------------------------------------------------- //+protected slot // // METHOD: // void nameTextChanged() // // PURPOSE: // Updates the slot's name from the contents of the name text field. // //----------------------------------------------------------------------------- void SlotQtDlg::nameTextChanged() { if (!rwAssert(_slot != NULL)) return; if (_slotNameEdit == NULL) return; //--------------------------------->> const QString slotNameEditText (_slotNameEdit->text()); const QString slotNameText (_slot->getName()); if (slotNameEditText != slotNameText) { QString errMsg (""); const bool setNameErr (_slot->setName (slotNameEditText, errMsg)); if (setNameErr) { // Error QMessageBox::warning (this, QString("Slot Rename Error"), errMsg); } refreshObjectName(); } } //----------------------------------------------------------------------------- //+protected slot // // METHOD: // void slotCfgChangeApplied (Slot*) // // PURPOSE: // Called when a Slot Config change occurs to the Source Slot which // for which there is not SimLib callback. // //----------------------------------------------------------------------------- void SlotQtDlg::slotCfgChangeApplied (Slot* slot) { static const char (*mname) ("SlotQtDlg::slotCfgChangeApplied"); unsigned int changeSN (0); if (SlotGUIUtils::slotEqualsOrContainsSlot (_slot, slot)) { // std::cout << mname << std::endl; _slotDataTable->refreshMainEditCellData(); _slotDataTable->checkColLayout (changeSN); _slotDataTable->refreshColumnLabels(); refreshBottomOptionsFrame(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showEmptySlotsCheckBox_toggled (bool on) { static const char (*mname) ("SlotQtDlg::showEmptySlotsCheckBox_toggled"); // std::cout << mname << (on ? " ON" : " OFF") << std::endl; if (_shipGoingDown) return; //----------------------->> if (rwAssert (_showEmptySlotsCheckBox != NULL)) { const bool checkBoxChecked = _showEmptySlotsCheckBox->isChecked(); // std::cout << mname << (checkBoxChecked ? " CHECKED" : " UNCHECKED") // << std::endl; rwAssert (on == checkBoxChecked); } if (_acctSlotSum) { _acctSlotSum->setShowEmptySlots (on); } if (_slotDataTable) { _slotDataTable->setShowEmptySlots (on); _slotDataTable->refreshShowHideSlotItems(); schedRefreshDisplayCompression(); _slotDataTable->growColsToData_handler(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showSubslotsCheckBox_toggled (bool /*on*/) { static const char (*mname) ("SlotQtDlg::showSubslotsCheckBox_toggled"); // std::cout << mname << " (" << (on ? "ON" : "off") << ")" << std::endl; // Prevent re-entry static bool methodActive (false); if (!methodActive) { methodActive = true; refreshBottomOptionsFrame(); _slotDataTable->checkColLayout (0); // no changeSN (serial number). methodActive = false; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::showSuppliesCheckBox_toggled (bool on) { static const char (*mname) ("SlotQtDlg::showSuppliesCheckBox_toggled"); // std::cout << mname << (on ? " ON" : " OFF") << std::endl; rwAssert (_showSuppliesCheckBox != NULL); if (_acctSlotSum) { _acctSlotSum->setShowSupplies (on); } if (_slotDataTable) { _slotDataTable->setShowSupplies (on); _slotDataTable->refreshShownSupplies(); _slotDataTable->growColsToData_handler(); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // slot void SlotQtDlg::displayCompressSpec_changed (const DisplayCompressSpec& spec) { static const char (*mname) ("SlotQtDlg::displayCompressSpec_changed"); if (_shipGoingDown) return; //----------------------->> if (spec != _seriesDisplayCompressSpec) { // std::cout << mname << ": " << spec.str() <setDisplayCompressSpec (spec); } schedRefreshDisplayCompression(); sensitizeOperations(); } } // slot void SlotQtDlg::displayCompressRecomp_needed (const DisplayCompressSpec& spec) { static const char (*mname) ("SlotQtDlg::displayCompressRecomp_needed"); // std::cout << mname << ": " << spec.str() <refreshDisplayCompression(); schedResizeOptimal(); } sensitizeOperations(); } void SlotQtDlg::setShowExpression(bool showExpr) { if (_rplFrame) { _rplFrame->setShown(showExpr); _rplToggles->setShown(showExpr); // We don't allow edits of the frame when it's not shown. if (_rplExprMenu) { _rplExprMenu->updateEditActions(); } if (showExpr) { _rplFrame->reformat(); } } } void SlotQtDlg::printRplExpression() { static const char (*mname) ("SlotQtDlg::printRplExpression"); // std::cout << mname << std::endl; if (_slot) { RplPrinter rplPrinter (RplExprSlotMgr::Instance()->getRplSet(), rplDlgMgr->getLineBreaks()); rplPrinter.print (_slot); } } void SlotQtDlg::rplEvalTimeChanged() { static const char (*mname) ("SlotQtDlg::rplEvalTimeChanged"); // std::cout << mname << std::endl; // Display this new eval time in the GUI updateRplEvalTime(); updateRplSeriesRange(); } // // If we are showing a RPL expression, and that display includes the // debug cursor (location at which debugging is currently paused), // then scroll that cursor into view within the RplFrame displaying // the expression. // void SlotQtDlg::scrollToDebugCursor() { if (_rplFrame) { _rplFrame->scrollToDebugCursor(); } } //----------------------------------------------------------------------------- //+protected // // METHOD: // virtual void simObjDeletedHandler() // // PURPOSE: // Handles deletions of the SimObj that contains the slot this dialog // edits. // //----------------------------------------------------------------------------- void SlotQtDlg::simObjDeletedHandler (SimWorkspace*, SimObj *simObj) { static const char (*mname) ("SlotQtDlg::simObjDeletedHandler"); // std::cout << mname << std::endl; if (simObj && _slot) { if (_simObj == simObj) { setShipGoingDown(); hide(); deleteCallbacks(); setAttribute (Qt::WA_DeleteOnClose, true); close(); } } } //----------------------------------------------------------------------------- // Handles name changes of the SimObj that contains the slot this dialog // edits. //----------------------------------------------------------------------------- void SlotQtDlg::simObjNamedHandler (SimObj*) { static const char (*mname) ("SlotQtDlg::simObjNamedHandler"); // std::cout << mname << std::endl; refreshObjectName(); // Gnats 4115: Object name change wasn't updating Obj Account Summary if (_appMode == SQD_APP_MODE_OBJ_ACCT_SUM) { if (_objAcctSumSel) { _objAcctSumSel->simObjNameChange(); } acctSlotSumSettingsChanged(); } } //----------------------------------------------------------------------------- // Handles name changes of the Slot that this dialog edits. //----------------------------------------------------------------------------- void SlotQtDlg::slotNamedHandler (Slot* slotPtr) { static const char (*mname) ("SlotQtDlg::slotNamedHandler"); if (CALLBACK_DEBUG) { std::cout << mname << " " << qPrintable(slotPtr->getCompleteName()) << std::endl; } refreshObjectName(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Updates the GUI text to reflect the current controller. // virtual from BaseRWDlg // void SlotQtDlg::controllerChangedHandler () { if (_rplExprMenu) { _rplExprMenu->controllerChangedHandler(); } updateRplEvalTime(); updateRplSeriesRange(); } //----------------------------------------------------------------------------- //+protected // // METHOD: // virtual void simObjIconChangedHandler() // // PURPOSE: // Handles changes of the icon that represents the SimObj that contains the // slot this dialog edits. // //----------------------------------------------------------------------------- void SlotQtDlg::simObjIconChangedHandler(SimObj *simObj) { static const char (*mname) ("SlotQtDlg::simObjIconChangedHandler"); if (SlotDataQTable::callCountsEnabled()) { SlotDataQTable::recordCall (mname); } if (CALLBACK_DEBUG) { std::cout << mname << " " << (simObj ? qPrintable(simObj->getCompleteName()) : "NULL") << std::endl; } if (_simObj && _slot) { if (_simObj == simObj) { // Set Object Icon from type of slot's Object. RwQtUtils::setQButtonIconForSimObj (_objectIconButton, simObj); } } } //----------------------------------------------------------------------------- //+protected // // METHOD: // virtual void simObjDeletedHandler() // // PURPOSE: // Handles deletions of the slot this dialog edits. // //----------------------------------------------------------------------------- void SlotQtDlg::slotDeletedHandler (SimObj* simObj, Slot *slot) { static const char (*mname) ("SlotQtDlg::slotDeletedHandler"); if (_slotDataTable) { _slotDataTable->clearApplSelection(); } if (CALLBACK_DEBUG) { std::cout << mname << " " << (simObj ? qPrintable(simObj->getCompleteName()) : "NULL") << " " << (slot ? "SLOT" : "NULL SLOT") << std::endl; } deleteSlotCallbacks (slot); if (slot == _slot) { setShipGoingDown(); hide(); deleteCallbacks(); setAttribute (Qt::WA_DeleteOnClose, true); close(); } } //----------------------------------------------------------------------------- //+protected // // METHOD: // virtual void slotChangedHandler() // // PURPOSE: // Handles changes to the slot. // //----------------------------------------------------------------------------- int SlotQtDlg::slotCallbackHandler (CallbackType cbType, CallbackData* cbData, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::slotCallbackHandler"); Slot (*slot) (NULL); int slotTinx (-1); unsigned int changeSN (0); SlotStatusChangeData *slotData (dynamic_cast(cbData)); if (slotData != NULL) { slot = slotData->slot; slotTinx = slotData->row; changeSN = slotData->changeSerialNum; } else { MultiSlotLinksChangedData *msData ( dynamic_cast(cbData)); if (msData) { // We need to use the overall _multiSlot pointer, and not the // _subSlot pointer because this is being used to match the // callback's Slot with the dialog box's Slot. slot = msData->_multiSlot; } } if (CALLBACK_DEBUG) { std::cout << mname << " [SN " << changeSN << "] " << (slot ? qPrintable(slot->getCompleteName()) : "NULL") << " [" << slotTinx << "] " << callbackTypeStr (cbType) << std::endl; } if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } switch (cbType) { case SLOT_DELETED: if (_slotDataTable) { _slotDataTable->clearApplSelection(); } // Note: This could be a Subslot (column) of our Slot deleteSlotCallbacks (slot); if (slot == _slot) { setShipGoingDown(); hide(); deleteCallbacks(); setAttribute (Qt::WA_DeleteOnClose, true); close(); } break; // // Slot data has changed // case SERIESSLOT_SERIES_VALUE_CHANGED: case SLOT_VALUE_CHANGED: case TABLESLOT_TABLE_CHANGED: case SLOT_FORMAT_CHANGED: case SLOT_PRECISION_CHANGED: case SLOT_CONVERGENCE_CHANGED: case SLOT_CONVERGENCE_TYPE_CHANGED: { schedServiceSlotDataChange(); // see deferred processing in serviceSlotDataChange(). break; } case SLOT_INPUT_CHANGED: //--- flag has been set { schedServiceSlotDataChange(); // see deferred processing in serviceSlotDataChange(). sensitizePartialDateTimeApply(); break; } case SERIESSLOT_SERIES_CHANGED: case SERIESSLOT_SERIES_CHANGED_2: { if (CALLBACK_DEBUG) { std::cout << mname << "-B [SN " << changeSN << "] " << (slot ? qPrintable(slot->getCompleteName()) : "NULL") << " [" << slotTinx << "] " << callbackTypeStr (cbType) << std::endl; } _slotDataTable->recomputeCellLayout (changeSN); checkSpinnerRange(); // This will add callbacks only for Slots (and AggSeriesSlot Columns) // which are not already registered. if (_slot) addSlotCallbacks (_slot); else if (_account) addAcctSlotCallbacks (_account); else if (_exchange) addExchSlotCallbacks (_exchange); refreshStatusBar(); updateRplSeriesRange(); break; } case TABLESLOT_SIZE_CHANGED: { _slotDataTable->recomputeCellLayout (changeSN); checkSpinnerRange(); refreshColMapEntityName(); refreshPartialDateTimeEditor(); refreshPeriodicSlotBottomWidgets(); refreshStatusBar(); break; } case TABLESLOT_COLUMN_COUNT_CHANGED: case AGGSERIES_COLUMN_COUNT_CHANGED: case MULTISLOT_LINKS_CHANGED: case SLOT_VISIBLE_CHANGED: case SLOT_ALL_CHANGED: { if ((_slot == NULL) || SlotGUIUtils::slotEqualsOrContainsSlot (_slot, slot)) { _slotDataTable->refreshMainEditCellData(); _slotDataTable->checkColLayout (changeSN); _slotDataTable->refreshColumnLabels(); refreshColMapEntityName(); refreshPartialDateTimeEditor(); refreshBottomOptionsFrame(); updateRplSeriesRange(); refreshStatusBar(); } break; } // // Slot format has changed // case SLOT_USRUNITS_CHANGED: case SLOT_DSPUNITS_CHANGED: case SLOT_UNITTYPE_CHANGED: case SLOT_SCALE_CHANGED: { if ((_slot == NULL) || SlotGUIUtils::slotEqualsOrContainsSlot (_slot, slot)) { _slotDataTable->refreshConfig (changeSN); _slotDataTable->refreshMainEditCellData(); _slotDataTable->growColsToData_handler(); refreshColMapEntityName(); refreshPartialDateTimeEditor(); refreshStatusBar(); } break; } case SLOT_NAMED: { refreshObjectName(); _slotDataTable->refreshColumnLabels(); refreshStatusBar(); break; } case TABLESLOT_COLUMN_LABEL_CHANGED: case TABLESLOT_ALL_COLUMN_LABELS_CHANGED: case TABLESLOT_COLUMN_UNITTYPE_CHANGED: case TABLESLOT_COLUMN_USRUNIT_CHANGED: case TABLESLOT_COLUMN_SCALE_CHANGED: case TABLESLOT_ALL_USRUNITS_CHANGED: { _slotDataTable->refreshColumnLabels(); refreshColMapEntityName(); refreshPartialDateTimeEditor(); refreshStatusBar(); break; } case TABLESLOT_ROW_LABEL_CHANGED: { _slotDataTable->refreshRowLabels(); refreshStatusBar(); break; } case TABLESLOT_ALL_ROW_LABELS_CHANGED: { _slotDataTable->refreshRowLabels(); refreshPeriodicSlotBottomWidgets(); refreshStatusBar(); break; } case SLOT_TSTEP_LABEL_PREFIX_CHANGED: { _slotDataTable->recomputeCellLayout (changeSN); _slotDataTable->refreshRowLabels(); refreshStatusBar(); break; } } return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::acctCallbackHandler (CallbackType cbType, CallbackData* cbData, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::acctCallbackHandler"); AccountCBData* acctDat = dynamic_cast (cbData); const Account* acct = (acctDat ? acctDat->getAccount() : NULL); AccountingCBData::CallbackSubType subType = (acctDat ? acctDat->getSubType() : AccountingCBData::no_subtype); if (CALLBACK_DEBUG) { std::cout << mname << " (" << (acct ? qPrintable(acct->getCompleteName()) : "ACCT?") << ") " << callbackTypeStr (cbType) << "; " << AccountingCBData::subTypeText (subType) << std::endl; } if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } const bool acctMatch ((acct == _account) || (acct == _slotAcct)); bool doDeletion (false); switch (cbType) { case ACCOUNT_DELETED: doDeletion = acctMatch; break; case ACCOUNT_CHANGED: if ( (subType != AccountingCBData::supply_deleted) && (subType != AccountingCBData::demand_deleted) ) { refreshObjectName(); _slotDataTable->refreshColumnLabels(); refreshStatusBar(); } break; case ACCOUNT_SLOT_VISIBLE_CHANGED: if (acct == _account) { const bool slotAdded = (subType == AccountingCBData::slot_added); // std::cout << mname << " ACCOUNT_SLOT_VISIBLE_CHANGED " // << (slotAdded ? "ADD" : "REMOVE") << std::endl; _slotDataTable->recomputeCellLayout (0, false); // not rowsToo checkSpinnerRange(); refreshStatusBar(); // Note: Probably it's not safe to remove Slot Callbacks now. // That's OK. If the Slot is actually getting deleted, that // will be taken care of with the deletion callback handling. // if (slotAdded) { addAcctSlotCallbacks (_account); } } break; } if (doDeletion) { // std::cout << mname << " Account deleted; close." << std::endl; setShipGoingDown(); hide(); deleteCallbacks(); _account = NULL; _slotAcct = NULL; setAttribute (Qt::WA_DeleteOnClose, true); close(); } return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::exchCallbackHandler (CallbackType cbType, CallbackData* cbData, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::exchCallbackHandler"); ExchangeCBData* exchDat = dynamic_cast (cbData); const Exchange* exch = (exchDat ? exchDat->getExchange() : NULL); AccountingCBData::CallbackSubType subType = (exchDat ? exchDat->getSubType() : AccountingCBData::no_subtype); if (CALLBACK_DEBUG) { std::cout << mname << " (" << (exch ? qPrintable(exch->getCompleteName()) : "ACCT?") << ") " << callbackTypeStr (cbType) << "; " << AccountingCBData::subTypeText (subType) << std::endl; } if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } bool doDeletion (false); switch (cbType) { case EXCHANGE_DELETED: doDeletion = (exch == _exchange); break; case EXCHANGE_CHANGED: refreshObjectName(); _slotDataTable->recomputeCellLayout (0, false); // not rowsToo if (_exchBalKeyTreeWidget != NULL) { _exchBalKeyTreeWidget->rebuild(); } refreshStatusBar(); break; } if (doDeletion) { // std::cout << mname << " Exchange deleted; close." << std::endl; setShipGoingDown(); hide(); deleteCallbacks(); _exchange = NULL; setAttribute (Qt::WA_DeleteOnClose, true); close(); } return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::annoCallbackHandler (CallbackType cbType, CallbackData* cbData, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::annoCallbackHandler"); AnnoCallbackData* annoCb = dynamic_cast(cbData); if (!rwAssert (annoCb != NULL)) return (1); //--------------------------------------->> // const Slot* callbackSlotRef = annoCb->_slot; // May be NULL if (CALLBACK_DEBUG) { std::cout << mname << ": " << callbackTypeStr (cbType) << std::endl; } if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } switch (cbType) { case ANNO2_GROUP_MANAGER_TERMINATED: // Reestablish AnnoMgrCallbacks deleteAnnoCallback(); addAnnoCallback(); // subsequent processing occurs in sensitizeAdjustOperations(). _adjustMenuSensitizeNeeded = true; _slotDataTable->updateContents(); break; case ANNO2_GROUP_ADDED: case ANNO2_GROUP_RENAMED: _slotDataTable->refreshAnnoColReadOnlyStatus(); refreshStatusBar(); break; case ANNO2_GROUP_MANAGER_CLEARED: case ANNO2_GROUP_DELETED: case ANNO2_GROUP_ICON_CHANGE: case ANNO2_NOTE_ADDED: case ANNO2_NOTE_DELETED: case ANNO2_NOTE_SLOT_REMOVED: case ANNO2_NOTE_SLOTS_REMOVED: case ANNO2_NOTE_SLOT_ADDED: case ANNO2_NOTE_SLOTS_ADDED: case ANNO2_NOTE_TEXT_CHANGED: // subsequent processing occurs in sensitizeAdjustOperations(). _adjustMenuSensitizeNeeded = true; _slotDataTable->refreshAnnoData(); _slotDataTable->growColsToData_handler(); _slotDataTable->refreshAnnoColReadOnlyStatus(); refreshStatusBar(); break; } sensitizeScrollAnnoMenu(); setScrollAnnoPushButtonIcon(); return (1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::runInfoCallbackHandler (CallbackType cbType, CallbackData* /* cbData */, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::runInfoCallbackHandler"); static int callCnt (0); ++callCnt; // std::cout << mname << " [#" << callCnt << "]" << std::endl; if (_shipGoingDown) return (1); //--------------------------->> if (CALLBACK_DEBUG) { std::cout << mname << ": " << callbackTypeStr (cbType) << std::endl; } if (cbType == RI_STATE_CHANGED) { if (_slotDataTable == NULL) return (1); //----------------------------------->> RunInfo (*rinfo)(rwWorkspace->getRunInfo()); RunState runState = rinfo->getState(); // diagnostics // *** diagReportRunState (runState); if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2 %3"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)) .arg ((int) runState); SlotDataQTable::recordCall (key); } switch (runState) { case PAUSED: case STOPPED: case WAITING: case FINISHED: case NOTRUNNING: case ABORTED: { initShowEmptySlotsCheckBox(); const bool doShowEmptySlots = showingEmptySlots(); _slotDataTable->setShowEmptySlots (doShowEmptySlots); _slotDataTable->refreshShowHideSlotItems(); _slotDataTable->growColsToData_handler(); schedRefreshDisplayCompression(); refreshStatusBar(); break; } } if ((runState == FINISHED) && SlotDataQTable::callCountsEnabled()) { SlotDataQTable::dumpCallCounts(); SlotDataQTable::clearCallCounts(); } } else if (cbType == RI_CONTROLLER_CHANGED) { sensitizePrioritiesRelevant (true); // force on enabled } else if (cbType == RI_DATES_CHANGED) { if (_slotDataTable) { // Pre/Post-Run Dividers may need to change _slotDataTable->recomputeCellLayout (0); // change serial number } } return (1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::rwSystemCallbackHandler (CallbackType cbType, CallbackData* /* cbData */, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::rwSystemCallbackHandler"); static int callCnt (0); ++callCnt; // std::cout << mname << " [#" << callCnt << "] " // << callbackTypeStr (cbType) << std::endl; if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } switch (cbType) { case WS_CLEARING: setShipGoingDown(); hide(); deleteCallbacks(); setAttribute (Qt::WA_DeleteOnClose, true); close(); break; } return (1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int SlotQtDlg::simWsCallbackHandler (CallbackType cbType, CallbackData* cbData, void* /* clientData */) { static const char (*mname) ("SlotQtDlg::simWsCallbackHandler"); static int callCnt (0); ++callCnt; ObjectStatusChangeData *objData = dynamic_cast(cbData); SimObj* cbObj (objData ? (dynamic_cast(objData->simObj)) : NULL); const bool objMatch (cbObj && (cbObj == _simObj)); // if (objMatch) // { // std::cout << mname << " [#" << callCnt << "] " // << callbackTypeStr (cbType) << std::endl; // } // std::cout << mname << " [#" << callCnt << "] " // << callbackTypeStr (cbType) << std::endl; if (SlotDataQTable::callCountsEnabled()) { static const QString fmt ("%1 %2"); const QString key = fmt .arg (mname) .arg (callbackTypeStr (cbType)); SlotDataQTable::recordCall (key); } switch (cbType) { case WS_OBJECT_REMOVED: { if (objMatch) { setShipGoingDown(); hide(); deleteCallbacks(); setAttribute (Qt::WA_DeleteOnClose, true); close(); } break; } case WS_COND_LOCALE_CHANGED: case WS_SHOW_NUMSEP_CHANGED: case WS_ACT_USCHEME_SWITCH: // active unit scheme switched case WS_ACT_USCHEME_EDIT: // active unit scheme edited { if (_slotDataTable) { _slotDataTable->refreshColumnLabels(); _slotDataTable->refreshMainEditCellData(); _slotDataTable->growColsToData_handler(); } refreshStatusBar(); update(); break; } } return (1); } //----------------------------------------------------------------------- //----------------------------------------------------------------------- // Notification from SlotQDlgTable::computeDisplayCompression() // public void SlotQtDlg::displayCompressRecomputed ( const DisplayCompressSpec& spec, const std::vector&, int tstepShowCnt, int tstepHideCnt) { static const char (*mname) ("SlotQtDlg::displayCompressRecomputed"); // std::cout << mname << std::endl; if (_dispCompressPanel) { _dispCompressPanel->displayCompressRecomputed ( spec, tstepShowCnt, tstepHideCnt); } if (_slotDataTable) { _slotDataTable->invalidateSelection(); _slotDataTable->reapplyApplSelection(); } refreshStatusBar (false); // don't (re-) doInvalidateSelection } //----------------------------------------------------------------------- //----------------------------------------------------------------------- // public static void SlotQtDlg::setChooserPath (const QString& newPath) { if (!newPath.isEmpty()) { _importExportSlotPath = newPath; } } // public static QString SlotQtDlg::chooserPath() { // Note: This method is intentionally NOT IN-LINED in order to avoid // likely linking / static variable initialization problems. if (_importExportSlotPath.isEmpty()) { _importExportSlotPath = "./"; } return _importExportSlotPath; // writable reference } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void SlotQtDlg::rplFrame_showCommentsChanged(bool show) { if (_rplTogglesIndex_comments >= 0) { _rplToggles->setToggleOn (_rplTogglesIndex_comments, show); } } void SlotQtDlg::rplToggles_updateRelevance() { if (_rplTogglesIndex_comments >= 0) { const bool exists = _rplFrame && _rplFrame->containsAComment(); _rplToggles->setToggleRelevant (_rplTogglesIndex_comments, exists); } } void SlotQtDlg::rplToggles_stateChanged(int toggleIndex, bool on) { if (toggleIndex == _rplTogglesIndex_comments) { if (_rplFrame) { _rplFrame->setShowComments(on); } } else { rwDebugAssert(false); } } void SlotQtDlg::descToggles_updateRelevance() { if (_descTogglesIndex_desc >= 0) { const bool exists = descriptionDefined(); _descToggles->setToggleRelevant (_descTogglesIndex_desc, exists); } } void SlotQtDlg::descToggles_stateChanged(int toggleIndex, bool on) { if (toggleIndex == _descTogglesIndex_desc) { updateDescriptBoxVisibility(); // sensitizeOperations(); if (!on) { if (_descDispPanel) _descDispPanel->implicitAccept(); closeDescBoxSplitterSection(); } else if (_descDispPanel) { _descDispPanel->giveTextEditFocus(); } } else { rwDebugAssert(false); } } //--- (end SlotQtDlg.cpp) ---