⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plotsetup.c

📁 图像处理的压缩算法
💻 C
📖 第 1 页 / 共 3 页
字号:
	{
		m_cntrlPlots.OnRemove(nRowToSel);
	}
	void OnChangeAddRowNumbers(Control cntrl)
	{
		m_cntrlCols.OnChangeAddRowNumbers();
	}
	void OnChangeErrBarOptions(Control cntrl)
	{
		m_cntrlCols.OnChangeErrBarOptions();
	}
//public:
	//---- CPY 7/30/03 PLOT_TYPE_LIST_SEL_SUPPORT
	void OnPlotTypeChange(Control cntrl)
	{
		/// ML 9/28/2003
		//if(isReadyEventHandling())
		if(isReadyEventHandling(true))
			m_cntrlPlotTypes.OnPlotTypeChange(m_cntrlCols);
	}
	//----
	void OnApplyWksDesignations(Control cntrl)
	{
		Button chkboxApplyWks = cntrl;
		if(chkboxApplyWks.Check)
			m_cntrlCols.ApplyWksColDesignations(true);
	}
	void OnBeforeMouseDownWksList(Control flxControl, short nButton, short nShift, float X, float Y, BOOL* pCancel)
	{
		if(isReadyEventHandling(true))
			m_cntrlWks.OnBeforeMouseDown(m_cntrlCols, nButton, nShift, X, Y, pCancel);
	}
	void OnWksSelChange(Control flxControl)
	{
		if(isReadyEventHandling())
		{
			//printf("m_bReady and OnWksSelChange\n");
			
			m_cntrlPlots.OnWksSelChange(m_cntrlCols);	//---- CPY 9/25/03 v7.5707 EDIT_PLOT_SHOW_HIGHLIGHT_IN_WKS_LIST
			int nPageType = m_cntrlWks.OnSelChange(m_cntrlCols);
			bool bIncludeStyleHolders = m_cntrlPlots.HasStyleHolders();
			bool bRetOK = m_cntrlPlotTypes.OnNewPageType(nPageType, bIncludeStyleHolders);
			m_cntrlPlotTypes.OnPlotTypeChange(m_cntrlCols, bRetOK);

		}
	}
	void OnCheckShowWks(Control cntrl)
	{
		showWksListGroup(isAvailDataListShown());
		repositionPanels(true, true);
	}
	void OnCheckShowPlots(Control cntrl)
	{
		if(m_bMakeNewPlot)
		{
			showPlotListGroup(isPlotListShown());
			repositionPanels();
			if(m_btnAddReplacePlot.Visible)
				enableOKbutton(false, true);
			else
				enablePlottingButton();
		}
		else
		{
			showColListGroup(isColListShown());
			repositionPanels(true, true);
		}
	}
	//// vsFlex events
	void OnButtonClickColList(Control flxControl, int nRow, int nCol)
	{
		m_cntrlCols.OnButtonClick(flxControl, nRow, nCol);
	}
	void OnAfterEditColList(Control flxControl, int nRow, int nCol)
	{
		m_cntrlCols.OnAfterEdit(flxControl, nRow, nCol);
	}
	void OnBeforeEditColList(Control cntrl, long nRow, long nCol, BOOL* pCancel)
	{
		m_cntrlCols.OnBeforeEdit(cntrl, nRow, nCol, pCancel);
	}
	void OnBeforeMouseDownColList(Control cntrl, short nButton, short nShift, float X, float Y, BOOL* pCancel)
	{
		m_cntrlCols.OnBeforeMouseDown(cntrl, nButton, nShift, X, Y, pCancel);
	}
	void OnMouseMoveColList(Control cntrl, short nButton, short nShift, float X, float Y)
	{
		m_cntrlCols.OnMouseMove(cntrl, nButton, nShift, X, Y);
	}
		
private:
	void initUpDownShowButtons()
	{
		m_chkShowWks = GetItem(IDC_SELCOLS_SHOW_DATA);
		m_chkShowPlots = GetItem(IDC_SELCOLS_SHOW_PLOTS);

		vector<string>  vstrTipsUpDown;
		vstrTipsUpDown.SetSize(2);
		vstrTipsUpDown[0] = _L("Show Available Data");
		vstrTipsUpDown[1] = _L("Hide Available Data");
		m_chkShowWks.Init(2, IDB_UPDOWN_BTN, 12, vstrTipsUpDown);
			
		if(m_bMakeNewPlot)
		{
			vstrTipsUpDown[0] = _L("Show Plot List");
			vstrTipsUpDown[1] = _L("Hide Plot List");
			m_chkShowPlots.Init(2, IDB_DOWNUP_BTN, 12, vstrTipsUpDown);
		}
		else
		{
			vstrTipsUpDown[0] = _L("Show Plot Designations");
			vstrTipsUpDown[1] = _L("Hide Plot Designations");
			m_chkShowPlots.Init(2, IDB_UPDOWN_BTN, 12, vstrTipsUpDown);
		}
	}
	BOOL	updateGUIOnEditReplace(BOOL bEdit)  // bEdit is TRUE OnEdit and FALSE on Replace/Cancel
	{
		if (bEdit)
			m_btnAddReplacePlot.Text = _L("Replace");
		else
		{
			m_btnAddReplacePlot.Text = _L("Add");
			// need to tell other controls
			m_cntrlPlotTypes.OnEndEditPlot();
		}
		return TRUE;
	}
	bool isInEditMode() 
	{
		if(m_btnAddReplacePlot)
		{
			if(m_btnAddReplacePlot.Visible && m_btnAddReplacePlot.Enable && m_cntrlCols.IsInEditMode())
				return true;
		}
		return false;
	}
	BOOL doAddOrReplace(BOOL bReplace = FALSE)
	{
		HOUR_GLASS //PROFILE_HRGLASS
		
		Tree	trDPList;
		/// RVD 9/3/2003 QA70-5078 v7.0682 PLOT_RANGE_APPLY
		//if(m_cntrlCols.GetDataPlots(trDPList))
		if(m_cntrlCols.GetDataPlots(trDPList, false, m_cntrlPlots.GetView()))
		/// end PLOT_RANGE_APPLY
		{
			if (bReplace)
				return m_cntrlPlots.AddDataPlots(trDPList, bReplace);
			else
			{
				vector<uint>		vnPlotIDs;
				if ( m_cntrlPlotTypes.GetPlotTypes(vnPlotIDs) )
				{
					enableOKbutton(true);
					return m_cntrlPlots.AddDataPlots(trDPList, vnPlotIDs);
				}
			}
		}
		return FALSE;
	}
	
	void showWksListGroup(bool bShow)
	{
		ShowControls(s_nWksListCntrlIDs, bShow);
//		if(!m_chkShowPlots.Visible) // Layer Contents must be show, that means we must connect the other two together
//			showColListGroup(bShow);
	}
	void showPlotListGroup(bool bShow)
	{
		uint nNewPlotCntrlIDs[] = {IDC_SELCOLS_PLOTS_LABEL, IDC_SELCOLS_PLOTS,  0};
		uint nLayerContentsCntrlIDs[] = {IDC_SELCOLS_SHOW_COLS, IDC_SELCOLS_PLOTS_LABEL, IDC_SELCOLS_PLOTS,  0};
		if(m_bMakeNewPlot)
			ShowControls(nNewPlotCntrlIDs, bShow);
		else
			ShowControls(nLayerContentsCntrlIDs, bShow);
			
		showLayerContentsEditButtons();
	}
	// col plot designation box is always show, but the plot type list may be not
	void showColListGroup(bool bShow)
	{
		if(m_bMakeNewPlot)
			ShowControls(s_nColListCntrlIDs, bShow);
		else
		{
			if(!bShow && m_chkShowWks.Check)
			{
				m_chkShowWks.Check = false;
				showWksListGroup(false);
			}
			ShowControls(&s_nColListCntrlIDs[OFFSET_COL_LIST_LAYER_CONTENTS], bShow);
			//---- CPY 10/26/03 AUTO_SEL_LAST_ACTIVE_WKS_MATRIX 
			if(bShow && !isInEditMode())
				checkStartEdit(false);
			//---- end AUTO_SEL_LAST_ACTIVE_WKS_MATRIX
		}
		showLayerContentsEditButtons();
	}
	// LayerContents buttons should be shown only if both ColList and PlotList are both visible
	void showLayerContentsEditButtons()
	{
		bool bShow = (m_cntrlCols.IsVisible() && m_cntrlPlots.IsVisible())? true:false;
		ShowControls(s_nCntrlButtons, bShow);
	}
	string getCurrentPlotType()
	{
		DWORD dwAuxTypeInfo;
		int nPlotType = GetCurrentPlotID(dwAuxTypeInfo);//Project.GetPlotTypeInfo(GetCurrentPlotID(), dwAuxTypeInfo, dwAuxPlotInfo, strColPattern);
		return GetPlotTypeName(nPlotType, dwAuxTypeInfo); // need to convert to text later from internal
	}
	//virtual 
	BYTE GetPanelsOrientation()
	{
		return PANEL_ORIENT_VERTICAL;
	}
	//virtual
	void repositionPanels(bool bResizeDlg = true, bool bMoveDlgUpDown = false, RECT *pDlgRect = NULL)
	{
		SetMoveRepaint(false);

		int cx = pDlgRect ? (pDlgRect->right - pDlgRect->left) : GetDlgExtent(false);
		int ny = positionWksListGroup(0, cx);
		ny = positionColListGroup(ny, cx);
		ny = positionPlotListGroup(ny, cx);
		ny = positionShowChecksAndOKCancel(ny, cx);
		if(bResizeDlg)
		{
			int ndy = ny - GetDlgExtent();
			ny += GetControlGap();
			RECT rWnd;
			m_wndDlg.GetWindowRect(&rWnd);
			if(bMoveDlgUpDown)
				rWnd.top -= ndy;
			else
				rWnd.bottom += ndy;
			
			if(rWnd.top < 0)
			{
				rWnd.bottom -= rWnd.top;
				rWnd.top = 0;
			}
			/// TD 8-26-03 RESIZING
			DisableOnSize();
			/// ----TD 8-26-03 RESIZING
			/// TD 9-9-03 RPOSIZION_TO_ORIGINAL_SIZE
			if(pDlgRect)
			{
				rWnd.bottom -= rWnd.top - pDlgRect->top;
				rWnd.top = pDlgRect->top;
				rWnd.left = pDlgRect->left;
				rWnd.right = rWnd.left +cx;
			}
			/// end RPOSIZION_TO_ORIGINAL_SIZE
			m_wndDlg.MoveWindow(&rWnd);
			/// TD 8-26-03 RESIZING
			DisableOnSize(false);
			/// ----TD 8-26-03 RESIZING
			UpdateWindow();
			
			SaveDlgHeight();//--- CPY 9/6/03 v7.5686 RESIZEING_CLEAN_UP
		}
		SetMoveRepaint(true);
	}
	int positionWksListGroup(int ny, int cx)
	{
		int nx = GetControlGap();
		if(isAvailDataListShown())
		{
			//uint nCntrlIDs[] = {IDC_SELCOLS_AVAILABLE_DATA_LABEL, IDC_SELCOLS_AVAILABLE_DATA, IDC_SELCOLS_APPLY_WKS_LABEL, IDC_SELCOLS_APPLY_WKS, 0};
			int nx1 = ArrangControlsTopDown(&s_nWksListCntrlIDs[OFFSET_WKS_LIST_SUPPORT_ITEMS], nx, ny, 0);
			ny = StretchControlWide(IDC_SELCOLS_WKSTREE, nx1 + GetControlGap(), ny, cx); 
		}
		return ny;
	}
	int positionColListGroup(int ny, int cx)
	{
		int nx = GetControlGap();
		// assume always show
		//	uint nCntrlIDs[] = {IDC_SELCOLS_PLOT_TYPES, IDC_SELCOLS_X_ERR, IDC_SELCOLS_POS_NEG_ERR, IDC_SELCOLS_ADD_ROW_NUMBER, 0};
		if(ny > 0)
			ny += GetControlGap();
		int nx1 = ArrangControlsTopDown(&s_nColListCntrlIDs[OFFSET_COL_LIST_SUPPORT_ITEMS], nx, ny, 0);
		ny = StretchControlLeftRight(IDC_SELCOLS_COLS_LABEL, IDC_SELCOLS_SHOW_DATA, nx1 + GetControlGap(), ny, cx);
		PositionControl(IDC_SELCOLS_PLOT_TYPES_STYLEHOLDER, nx, ny, true, false);
		ny = StretchControlWide(IDC_SELCOLS_COLS, nx1 + GetControlGap(), ny, cx);
		//---- CPY 7/30/03
		vector<uint> vnGrids = {IDC_SELCOLS_COLS, IDC_SELCOLS_PLOT_TYPES, 0};
		MakeSameSize(vnGrids);
		//----
		return ny;
	}
	
	int positionPlotListGroup(int ny, int cx)
	{
		int nx = GetControlGap();
		if(m_cntrlPlots.IsVisible())
		{
			if(ny > 0)
				ny+= GetControlGap();
			Control cntrl = GetItem(s_nCntrlButtons[0]);
			if(cntrl.Visible)
				ny = ArrangeControlsRightLeft(s_nCntrlButtonsShowPlotList, cx, ny);
			else
			{
				/*
				RECT r1;
				cntrl.GetWindowRect(&r1);
				ny += RECT_HEIGHT(r1);
				*/
				uint nShowColList[] = {IDC_SELCOLS_SHOW_COLS, 0};
				ny = ArrangeControlsRightLeft(nShowColList, cx, ny);
			}
			ny+= GetControlGap();

			PositionControl(IDC_SELCOLS_PLOTS_LABEL, nx, ny, false);
			ny = StretchControlWide(IDC_SELCOLS_PLOTS, nx, ny, cx); 
		}
		return ny;
	}
	int positionShowChecksAndOKCancel(int ny, int cx)
	{
		uint nNoPlotListCntrlIDs[] = {IDC_SELCOLS_SHOW_PLOTS, IDCANCEL, IDOK, 0};// IDC_SELCOLS_SHOW_DATA, IDC_SELCOLS_SHOW_PLOTS, 0};
		uint nHasPlotListCntrlIDs[] = {IDC_APPLY, IDCANCEL, IDOK, 0};// IDC_SELCOLS_SHOW_DATA, IDC_SELCOLS_SHOW_PLOTS, 0};
		ny+= GetControlGap();
		if(m_cntrlPlots.IsVisible())
			return ArrangeControlsRightLeft(nHasPlotListCntrlIDs, cx, ny);
		else
			return ArrangeControlsRightLeft(nNoPlotListCntrlIDs, cx, ny);
	}
	bool isColListShown()
	{
		if(m_bMakeNewPlot)
			return true;
		
		return m_chkShowPlots.Check;
	}
	bool isPlotListShown()
	{
		if(!m_bMakeNewPlot)
			return true;
		
		return m_chkShowPlots.Check;
	}
	bool isAvailDataListShown()
	{
		return m_chkShowWks.Check;
	}
	int getAvailDataListLastChoice()
	{
		// valled after LoadCheckBoxSettings for dialog, so can skip dialog name
		return LoadSetting(STR_AVAIL_DATA_CHOICE, -1);
	}
	void saveAvailDataListLastChoice(int nSel)
	{
		SaveSetting(STR_AVAIL_DATA_CHOICE, nSel);
	}
	//virtual 
	string GetRuntimeClass()
	{
		return "PlotSetup";
	}
	void enablePlottingButton()
	{
		bool bEnable = m_cntrlCols.IsReadyAddReplacePlot();
		
		if(m_btnAddReplacePlot.Visible)
			m_btnAddReplacePlot.Enable = bEnable;
		else if (m_bMakeNewPlot)
			m_btnOK.Enable = bEnable;
	}
	void enableOKbutton(bool bEnable, bool bTestPlotExist = false)
	{
		if(!m_bMakeNewPlot)
		{
			m_btnApply.Enable = true;
			return; // only when making new plot that we need to disable OK button
		}
		//if(!m_btnAddReplacePlot.Visible)
		//	return; // if Add button invisible, then OK button was not controlled by plot list info
		
		if(bTestPlotExist)
		{
			bEnable = m_cntrlPlots.HasDataPlots();
		}
		m_btnOK.Enable = bEnable;
		m_btnApply.Enable = false;// if making new plot, can never apply
	}
	bool isReadyEventHandling(bool bCheckWaitReadyState = false)
	{
		if(bCheckWaitReadyState && STATE_WAIT_READY == m_nReadyState)
			m_nReadyState = STATE_READY;

		return STATE_READY == m_nReadyState? true:false;
	}
	//------ CPY 10/26/03 AUTO_SEL_LAST_ACTIVE_WKS_MATRIX
	// separete this out to be reused
	void checkStartEdit(bool bOnSelChange = true)
	{
		updateGUIOnEditReplace(FALSE);

		bool bEnableEdit = m_cntrlCols.IsVisible() && m_cntrlPlots.IsEditAllowed();
		if(bOnSelChange)
			m_cntrlPlots.OnSelChange(m_cntrlPlotTypes, m_cntrlCols);
		if(bEnableEdit)
		{
			m_nReadyState = STATE_NOT_READY;
			if(m_cntrlPlots.StartEdit(m_cntrlCols, m_cntrlPlotTypes, m_cntrlWks))
			{
				updateGUIOnEditReplace(TRUE);
			}
			m_nReadyState = STATE_WAIT_READY;
		}
	}
	//------ end AUTO_SEL_LAST_ACTIVE_WKS_MATRIX
private:
	//bool	m_bReady;
	int		m_nReadyState;
	
	bool	m_bMakeNewPlot;
	bool	m_bTemplateLib;
	bool	m_bAddToGraph;
	int		m_nMakeNewPlotExVal;
	int		m_nPlotIDCaller; // the id passed in when class started
	bool	m_bFromColList;		// does the tree (on OK) come from the second table?
	int		m_nWksListGroupHeight;
	int		m_nPlotListGroupHeight;
	int		m_nColListGroupHeight;
	/// TD 8-26-03 RESIZING

	//int		m_nWksTreeHt;
	//int		m_nPlotTypeHt;
	//int		m_nPlotsHt;
	//bool	m_bDoNotHandleOnSize;
	/// ----TD 8-26-03 RESIZING
private:
	TreeNode	m_trCallerPlotList; // tree from caller
	// main tables
	WksListControl		m_cntrlWks;			// AD
	ColListControl		m_cntrlCols;		// PD
	PlotListControl		m_cntrlPlots;		// DP
	
	//
	PlotTypeListControl	m_cntrlPlotTypes;	// just a list of plot types available to this dialog
	/// other controls
	//Button	m_chkShowWks;
	//Button	m_chkShowPlots;
	BitmapRadioButton	m_chkShowWks;	
	BitmapRadioButton	m_chkShowPlots;
	Control m_staticAvailDataLabel;
	Control m_staticPlotListLabel;
	//Button	m_btnEditPlot;
	//Button	m_btnReplacePlot;
	Button	m_btnAddReplacePlot;
	Control	m_btnOK;
	Control	m_btnApply;
	bool	m_bApplyWasDone;
};


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -