Пример #1
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   int  nProd = 0;
   char Title[200];
   HWND hwndProducts   = GetDlgItem(hwnd, IDC_PRODUCTS);
   HWND hwndTables     = GetDlgItem(hwnd, IDC_TABLES);
   HWND hwndtableall   = GetDlgItem(hwnd, IDC_TABLE_ALL);
   HWND hwndproductall = GetDlgItem(hwnd, IDC_PRODUCT_ALL);
   
   LPRECONCILER lpmod = (LPRECONCILER)lParam;
   
   ZEROINIT (Title);

   if (!AllocDlgProp(hwnd, lpmod))
      return FALSE;
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RECONCILER));
   
   //Fill the windows title bar
   GetWindowText(hwnd,Title,GetWindowTextLength(hwnd)+1);
   x_strcat(Title, " ");
   x_strcat(Title, GetVirtNodeName ( GetCurMdiNodeHandle ()));
   x_strcat(Title, "::");
   x_strcat(Title,lpmod->DBName);

   SetWindowText(hwnd,Title);

   if (!OccupyDbnumberControl(hwnd)
    || !OccupyCddsControl(hwnd))
   {
     ASSERT(NULL);
     EndDialog(hwnd, FALSE);
     return TRUE;
   }
	
   InitialiseEditControls(hwnd);
   EnableDisableOKButton (hwnd);
   richCenterDialog(hwnd);
   return TRUE;
}
Пример #2
0
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	switch (id)
	{
		case IDOK:
			EndDialog(hwnd, 1);
			break;

		case IDCANCEL:
			EndDialog(hwnd, 0);
			break;

		case IDC_TYPE_TABLE:
		case IDC_TYPE_INDEX:
			if (codeNotify == BN_CLICKED) {

				SetProp(hwnd, szErrorProp, (HANDLE)ERROR_NOSHOW);

				Adjust4FillFactors(hwnd);
				InitialiseSpinControls (hwnd);
				LimitNumericEditControls(hwnd);


				DoCalculation(hwnd);

				SetProp(hwnd, szErrorProp, (HANDLE)ERROR_SHOW);
			}
			break;

		case IDC_CLEAR:
			InitialiseSpinControls(hwnd);
			InitialiseEditControls(hwnd);
			UpdateControls(hwnd,TRUE);
			Adjust4FillFactors(hwnd);
			bUserChangeEdit = FALSE;
			break;

		case IDC_PAGESIZE:
			switch (codeNotify)
			{
				case CBN_SELCHANGE:

				// Inhibit error messages while we are updating since
				// the EN_CHANGE message causes all the edit controls to be
				// verified for this structure type,  even the controls that
				// have not been reinitialised yet.

				SetProp(hwnd, szErrorProp, (HANDLE)ERROR_NOSHOW);

				Adjust4FillFactors(hwnd);
				InitialiseSpinControls (hwnd);
				LimitNumericEditControls(hwnd);


				DoCalculation(hwnd);

				SetProp(hwnd, szErrorProp, (HANDLE)ERROR_SHOW);
				break;
			}
		break;

		case IDC_STRUCTURE:
			switch (codeNotify)
			{
				case CBN_SELCHANGE:

					// Inhibit error messages while we are updating since
					// the EN_CHANGE message causes all the edit controls to be
					// verified for this structure type,  even the controls that
					// have not been reinitialised yet.

					SetProp(hwnd, szErrorProp, (HANDLE)ERROR_NOSHOW);

					InitialiseSpinControls(hwnd);
					ResetWithDefaultEditCtrl(hwnd);
					//InitialiseEditControls(hwnd);
					UpdateControls(hwnd,FALSE);
					DoCalculation(hwnd);

					SetProp(hwnd, szErrorProp, (HANDLE)ERROR_SHOW);
					break;

				case CBN_KILLFOCUS:
				{
					// We must verify the edit controls on exiting the
					// structure field since we dont do any checking when
					// it gets the focus,  therefore an edit control could
					// be invalid.

					VerifyAllNumericEditControls(hwnd, TRUE, TRUE);
					break;
				}
			}
			break;

		case IDC_ROWS:
		case IDC_ROWWIDTH:
		case IDC_UNIQUEKEYS:
		case IDC_KEYWIDTH:
		case IDC_DATA:
		case IDC_INDEX:
		case IDC_LEAF:
		{
			switch (codeNotify)
			{
				case EN_CHANGE:
				{
					int nCount;
					BOOL bShowError = (GetProp(hwnd, szErrorProp) == (HANDLE)ERROR_NOSHOW) ? FALSE : TRUE;

					if (id == IDC_DATA
					 || id == IDC_INDEX
					 || id == IDC_LEAF
					 || id == IDC_ROWWIDTH)
					{
						// Do this even on INITDIALOG
						Adjust4FillFactors(hwnd);
					}

					if (!IsWindowVisible(hwnd))
						break;

					// Test to see if the control is empty. If so then
					// set ERROR and break out.  It becomes tiresome to edit
					// if you delete all characters and an error box pops up.

					nCount = Edit_GetTextLength(hwndCtl);
					if (nCount == 0)
					{
						SetCalcError(hwnd);
						break;
					}
					if (!bInitEdit && (   id == IDC_DATA
					                   || id == IDC_INDEX
					                   || id == IDC_LEAF ))
					{
						char szBuf[20];
						INFOOFFSET infoIdx = GetSelectedStructure(hwnd);
						int nData,nIndex,nLeaf;
						GetDlgItemText (hwnd, IDC_DATA, szBuf, sizeof (szBuf));
						nData = my_atoi(szBuf);

						GetDlgItemText (hwnd, IDC_INDEX, szBuf, sizeof (szBuf));
						nIndex = my_atoi(szBuf);

						GetDlgItemText (hwnd, IDC_LEAF, szBuf, sizeof (szBuf));
						nLeaf = my_atoi(szBuf);

						if ( SaveFillFactors.FillFactors.nData != nData)
						{
							SaveFillFactors.FillFactors.nData = nData;
							SaveFillFactors.DefaultData = infoDefaults[infoIdx].fillFactors.nData;
							bUserChangeEdit = TRUE;
						}
						if ( SaveFillFactors.FillFactors.nIndex != nIndex)
							SaveFillFactors.FillFactors.nIndex = nIndex;
						if ( SaveFillFactors.FillFactors.nLeaf != nLeaf)
							SaveFillFactors.FillFactors.nLeaf = nLeaf;
					}

					if (!VerifyAllNumericEditControls(hwnd, bShowError, TRUE))
						break;

					DoCalculation(hwnd);
					break;
				}

				case EN_KILLFOCUS:
				{
					HWND hwndNew = GetFocus();
					int nNewCtl = GetDlgCtrlID(hwndNew);

					if (!IsEditControl(hwnd, hwndNew)
					 || !IsChild(hwnd, hwndNew))
						// Dont recalc on any button hits or change of structure
						// or error message displays
						break;

					if (!VerifyAllNumericEditControls(hwnd, TRUE, TRUE))
						break;

					UpdateSpinButtons(hwnd);
					DoCalculation(hwnd);
					break;
				}
			}
			break;
		}

		case IDC_SPINROWWIDTH:
		case IDC_SPINKEYWIDTH:
		case IDC_SPINROWS:
		case IDC_SPINKEYS:
		case IDC_SPINDATA:
		case IDC_SPINIDX:
		case IDC_SPINLEAF:
		{
			// Handle the spin button notifications

			switch (codeNotify)
			{
				case SN_INCBUTTONUP:
				case SN_DECBUTTONUP:
				{
					switch (id)
					{
						case IDC_SPINDATA:
						case IDC_SPINIDX:
						case IDC_SPINLEAF:
						{
							// Set for no error display so we do not get
							// errors in the row width while decreasing the
							// fillfactors and therefore lowering the row
							// width maximum.  The edit box will just adjust
							// to the new maximum without showing an error.

							SetProp(hwnd, szErrorProp, (HANDLE)ERROR_NOSHOW);
							if (id == IDC_SPINDATA)
								bUserChangeEdit = TRUE;
						}
					}

					if (ProcessSpinControl(hwndCtl, codeNotify, limits))
						DoCalculation(hwnd);

					SetProp(hwnd, szErrorProp, (HANDLE)ERROR_SHOW);
					break;
				}

				default:
					ProcessSpinControl(hwndCtl, codeNotify, limits);
			}
			break;
		}
	}
}
Пример #3
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
	HWND hwndTempDoc;
	HLOCAL hmem = LocalAlloc(LHND, sizeof(infoDefaults));
	LPSTRUCTINFO lpinfo = hmem ? LocalLock(hmem) : NULL;

	if (!lpinfo)
	{
		if (hmem)
			LocalFree(hmem);
		EndDialog(hwnd, -1);
		return TRUE;
	}

	// Since we modify infoDefaults, make a copy of it for each instance
	// of the dialog
	oldIngresVer = GetOIVers();
	SetProp(hwnd, SZINFODEF, hmem);
	_fmemcpy(lpinfo, infoDefaults, sizeof(infoDefaults));
	if (oldIngresVer >= OIVERS_30)
	{
		int i =0;
		for (i=0; i<4; i++)
		{
			lpinfo[i].nRowWidth = MAX_ROW_WIDTH_R3;
		}
	}
	LocalUnlock(hmem);

	hwndTempDoc = GetWindow(hwndMDIClient, GW_CHILD);
	if (hwndTempDoc)
	{
		if (GetOIVers()>=OIVERS_26) {
			BOOL bResult = SQLGetPageTypesPerTableTypes(GetVirtNodeName(GetCurMdiNodeHandle ()), pagetypespertabletypes);
			if (!bResult) {
				MessageWithHistoryButton(GetFocus(), ResourceString(IDS_E_CONNECTION_FAILED));
				EndDialog(hwnd, -1);
				return TRUE;
			}
			if (PAGE_TYPE_V1 != 1 || PAGE_TYPE_V2 != 2 || PAGE_TYPE_V3 != 3 || PAGE_TYPE_V4 !=4 || PAGE_TYPE_V6 != 6 || PAGE_TYPE_V7 != 7) {
				myerror(ERR_INGRESPAGES); /* the parsing of dm34 trace output (in parse.cpp) assumes V1 == 1 V2 == 2 etc... */
				EndDialog(hwnd, -1);
				return TRUE;
			}
			Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE);
		}
		if (GetOIVers()>=OIVERS_30)
			RetrieveTupLen4PageSize();
}
	else
	{
		oldIngresVer = SetOIVers(OIVERS_90); // Simulate the current Ingres version 9.0
		Button_SetCheck (GetDlgItem (hwnd, IDC_TYPE_TABLE), TRUE);
		pagetypespertabletypes [0]  = PAGE_TYPE_V1;
		pagetypespertabletypes [1]  = PAGE_TYPE_V3;
		pagetypespertabletypes [2]  = PAGE_TYPE_V3;
		pagetypespertabletypes [3]  = PAGE_TYPE_V3;
		pagetypespertabletypes [4]  = PAGE_TYPE_V3;
		pagetypespertabletypes [5]  = PAGE_TYPE_V3;
		pagetypespertabletypes [6]  = PAGE_TYPE_V1;
		pagetypespertabletypes [7]  = PAGE_TYPE_V4;
		pagetypespertabletypes [8]  = PAGE_TYPE_V4;
		pagetypespertabletypes [9]  = PAGE_TYPE_V4;
		pagetypespertabletypes [10] = PAGE_TYPE_V4;
		pagetypespertabletypes [11] = PAGE_TYPE_V4;
		if (bContinueShowMessage)
		{
			if (MSGContinueBox (ResourceString(IDS_W_CALCULATION_WITH_DEFAULT)))
				bContinueShowMessage = FALSE;
		}
	}

	// Force the catospin.dll to load
	SpinGetVersion();

	if (!OccupyStructureControl(hwnd) || !OccupyPageSizeControl(hwnd))
	{
		EndDialog(hwnd, -1);
		return TRUE;
	}
	if (GetOIVers() >= OIVERS_20)
		lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_OIV2_SPACECALC));
	else
		lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_SPACECALC));

	SubclassAllNumericEditControls(hwnd, EC_SUBCLASS);

	InitialiseSpinControls(hwnd);
	InitialiseEditControls(hwnd);
	UpdateControls(hwnd,TRUE);
	DoCalculation(hwnd);
	richCenterDialog(hwnd);
	return TRUE;
}