File: DIFRKMTY\S_INTERN.CPP

    1 //##############################################################################
    2 //                                                                            //
    3 // S_INTERN.CPP                                                               //
    4 //                                                                            //
    5 // Subsystem: Diffraktometrie/ Reflektometrie                                 //
    6 //            intern genutzte Fenster für Continious-, Step- und DynamicStepScan//
    7 // Benutzung durch andere Subsysteme erforderlich: NEIN                       //
    8 //                                                                            //
    9 //##############################################################################
   10 //! Kommentierung und Aenderungen B. Buss, 2000/2001, HUB IfI
   11 
   12 #include "internls\evrythng.h" // GermanVersion
   13 #include "winresrc\rc_def.h"   // Ressourcen-IDs
   14 #include "help\help_def.h"     // Help-IDs
   15 #pragma hdrstop
   16 
   17 #include "difrkmty\s_intern.h" // SCHNITTSTELLE für diese Datei
   18 #include "difrkmty\s_extern.h" // TScanWindow
   19 
   20 //--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||--//--||--\\--||--
   21 
   22 //#############################################################################
   23 // globale Typen und Konstanten
   24 //#############################################################################
   25 
   26 const UINT _MAXTIMEDIGITS= 1;
   27 const UINT _MAXCOUNTSDIGITS= 1;
   28 const UINT _THETASTARTDIGITS= 3; // war vorher nicht näher spezifiert
   29 const UINT _INTENSITYDIGITS= 0;
   30 const UINT _FACTORDIGITS= 2;
   31 const UINT _STATICDIGITS= 0;
   32 
   33 //#############################################################################
   34 // sprachspezifische Konstanten
   35 //#############################################################################
   36 
   37 #ifdef GermanVersion
   38         char szMessageDlg[]= "Meldung";
   39         char szMsgFailureDlg[]= "Fehler";
   40         char szMsgLine130[]= "Die Parameter Bereichsgröße und Meßzeit\nverursachen eine ungültige Geschwindigkeit!";
   41         char szMsgLine131[]= "Die Parameter Bereichsgröße, Startpunkt und Endpunkt\nverursachen eine ungültige Meßpunkteanzahl!";
   42         char szMsgLine132[]= "Durch die Einbeziehung des Beschleunigungs- bzw.\nBremsweges (%s) kommt es zu ungültigen Motorpositionen!";
   43 
   44         char szMsgLine400[]= "Kein Monitor";
   45         char szMsgLine401[]= "Min muss kleiner Max sein!\n\nMin und Max wurden ausgetauscht.";
46 #else 47 char szMessageDlg[]= "Message"; 48 char szMsgFailureDlg[]= "Failure"; 49 char szMsgLine130[]= "The Parameters Areasize and Time\ncauses an invalid Velocity!"; 50 char szMsgLine131[]= "The Parameters Areasize, Startpoint and Endpoint\ncauses an invalid Pointnumber!"; 51 char szMsgLine132[]= "the inclusion of the acceleration or\nbraking distance (%s) causes invalid motorpositions!"; 52 53 char szMsgLine400[]= "No Monitor"; 54 char szMsgLine401[]= "Min should be smaller than Max!\n\nMin and Max were exchanged against each other.";
55 #endif 56 57 //############################################################################## 58 // TSetupStepScanDlg 59 //############################################################################## 60 61 TSetupStepScanDlg::TSetupStepScanDlg( TScanWindow* aScan ) : TModalDlg( "SCANPARAMETERS", GetMainInstance() ), Scan(0), hScanTypeList(0) 62 { 63 // ! neu (11.03.2004) Kullmann+Reinecker: alle Memberattribute initialisiert 64 Scan= aScan; //! Parameter von Scanfenster uebernehmen 65 dArgumentMin= Scan->dArgumentMin; 66 dArgumentMax= Scan->dArgumentMax; 67 dArgumentWidth= Scan->dArgumentWidth; 68 dwMaxCounts= Scan->dwMaxCounts; 69 fMaxTime= Scan->fMaxTime; 70 bSaveOnReady= Scan->bSaveOnReady; 71 /* if ( Scan->eScanType == ContinuousScan ) 72 Scan->eScanType= StandardScan;*/ 73 eScanType= Scan->eScanType; 74 bSaveContinuous= Scan->bSaveContinuous; 75 strcpy( szPath, Scan->szDataPath ); 76 d2ThetaStart= Scan->d2ThetaStart; 77 // 21.04.2004 eSaveFormat= Scan->eSaveFormat; 78 }; 79 //***************************************************************************** 80 81 //! setzt Defaultwerte in Dialogbox 82 //! Rueckkehrcode immer true 83 BOOL TSetupStepScanDlg::Dlg_OnInit( HWND, HWND hwndCtl, LPARAM lParam ) 84 { 85 //! Handles der Comboboxen uebergeben + uebergeben der akt. Motor, Detekt., 86 //! Monit. 87 hScanTypeList= GetDlgItem( GetHandle(), id_ChooseScanType ); 88 //! eintragen der Comboboxauswahlelemente fuer Scantyp, Detektor und 89 //! Scanachse vorauswahl der aktiven geraete 90 ComboBox_AddString( hScanTypeList, "Standard" ); 91 //! Omega2Thetamodus nur bei exist. Theta erlauben 92 if (mlIsAxisValid(Theta)) 93 ComboBox_AddString( hScanTypeList, "Omega-2Theta" ); 94 95 HWND hDetectorList= GetDlgItem( GetHandle(), id_ChooseDetector ); 96 TDetectorManager::DetectorManager().FillDetectorComboBox(hDetectorList, 0); 97 ComboBox_SelectString( hDetectorList, 0, Scan->Detector->GetCharacteristic() ); 98 99 //! aufnehmen aller verfuegbaren Detektoren in Combobox 100 HWND hMonitorList= GetDlgItem( GetHandle(), id_ChooseMonitor ); 101 102 ComboBox_AddString( hMonitorList, szMsgLine400 ); 103 TDetectorManager::DetectorManager().FillDetectorComboBox( hMonitorList); 104 105 if (Scan->Monitor != 0) 106 ComboBox_SelectString( hMonitorList, 0 , Scan->Monitor->GetCharacteristic() ); 107 else 108 ComboBox_SelectString( hMonitorList, 0 , szMsgLine400 ); 109 110 HWND hMotorList= GetDlgItem( GetHandle(), id_ChooseMotor ); 111 for (int i=0; i < mlGetAxisNumber(); i++ ) 112 { 113 mlSetAxis( i ); 114 ComboBox_AddString( hMotorList, mGetAxisName() ); 115 } 116 mlSetAxis( Scan->nMotor ); 117 ComboBox_SelectString( hMotorList, 0, mGetAxisName() ); 118 119 //! Aenderung Dynamische Schrittweite 120 //! aktivieren von Checkbutton und Einstellungsbox fuer Dyn. Schrittweite 121 //! abhaengig von Param. 122 CheckDlgButton( GetHandle(), id_DynamicActive, Scan->bDynamicStepWidth ); 123 CtrlSetEnabled(cm_DynamicSetup, Scan->bDynamicStepWidth ); 124 125 //! setzt dialoginhalte 126 CheckDlgButton( GetHandle(), id_SaveOnReady, Scan->bSaveOnReady ); 127 CheckDlgButton( GetHandle(), id_SaveContinuous, Scan->bSaveContinuous ); 128 129 //! wahrscheinlich ueberfluessig 130 SetFocus( GetDlgItem( GetHandle(), id_ChooseMotor ) ); 131 //! wenn ScanTyp Omega2Theta dann Motorcombobox ausgrauen sonst nicht 132 switch ( eScanType ) 133 { 134 case stStandardScan: 135 ComboBox_SelectString( hScanTypeList, 0, "Standard" ); 136 CtrlSetEnabled(id_ChooseMotor, TRUE ); 137 CtrlSetEnabled(id_2Theta, FALSE ); 138 break; 139 140 case stOmega2ThetaScan: 141 ComboBox_SelectString( hScanTypeList, 0, "Omega-2Theta" ); 142 CtrlSetEnabled(id_ChooseMotor, FALSE ); 143 break; 144 } 145 146 // HotKey's für Hilfe 147 LoadHotKeys( LoadAccelerators(GetMainInstance(), MAKEINTRESOURCE(ACC_SetupStepScanDlg)) ); // Accelerator aus Ressourcen laden 148 149 //! bewirkt Aufruf von Dlg_OnCommand mit Kommando cm_ParamSet 150 FORWARD_WM_COMMAND( GetHandle(), cm_ParamSet, hwndCtl, 0, SendMessage ); 151 //! Focus auf OK-Button der Box 152 CtrlSetFocus( IDOK ); 153 return TRUE; 154 }; 155 //***************************************************************************** 156 157 //! behandelt alle Kommandos in der Dialogbox 158 void TSetupStepScanDlg::Dlg_OnCommand( HWND, int id, HWND hwndCtl, 159 UINT codeNotify ) 160 { 161 //! Aenderung Dynamische Schrittweite 162 TModalDlg * dlg; 163 164 //! abhaengig von dialogelement bzw. Kommando 165 switch ( id ) 166 { 167 case cm_Help: 168 WinHelp(GetHandle(), GetHelpFile(), HELP_CONTEXT, Help_SetupStepScanDlg); 169 break; 170 171 //! initialisierung ?(siehe Fehler) 172 case cm_ParamSet: 173 OnParamSet(); 174 OnChooseScanType(codeNotify); 175 break; 176 177 //! auswahl von Scan-Typ-Combobox erfolgt 178 case id_ChooseScanType: 179 OnChooseScanType(codeNotify); 180 break; 181 182 //! Scan-Achsen-Combobox ausgewaehlt 183 case id_ChooseMotor: 184 OnChooseMotor(codeNotify); 185 break; 186 187 //! Detektor-combobox ausgewaehlt 188 case id_ChooseDetector: 189 OnChooseDetector(codeNotify); 190 break; 191 192 //! Monitor-ComboBox ausgewaehlt 193 case id_ChooseMonitor: 194 OnChooseMonitor(codeNotify); 195 break; 196 197 //! FIX Fehler 71 198 case id_SaveContinuous: 199 CheckDlgButton(GetHandle(), id_SaveOnReady, FALSE); 200 break; 201 202 case id_SaveOnReady: 203 CheckDlgButton(GetHandle(), id_SaveContinuous, FALSE); 204 break; 205 206 //! Aenderung Dynamische Schrittweite 207 //! Start der Dialogbox 'Einstellungen Dyn. Schrittweite' bei Auswahl des 208 //! Einstellungs-Button 209 case cm_DynamicSetup: 210 dlg= ( TSetupDynamicStepDlg * ) new TSetupDynamicStepDlg( Scan ); 211 if ( dlg ) dlg->ExecuteDialog( GetHandle() ); 212 _FREEOBJ(dlg); 213 break; 214 215 //! Aenderung Dynamische Schrittweite 216 //! bei Auswahl der Aktivieren-Checkbox automatisches Oeffnen der 217 //! Einstellungsbox fuer dyn. Schrittweite 218 case id_DynamicActive: 219 OnDynamicActive(); 220 break; 221 222 //! hier werden IDOK,IDCANCEL und IDABBORT behandelt 223 default: 224 TModalDlg::Dlg_OnCommand( GetHandle(), id, hwndCtl, codeNotify ); 225 } 226 }; 227 //***************************************************************************** 228 229 void TSetupStepScanDlg::OnChooseScanType(UINT codeNotify) 230 { 231 //! scheinbar ueberfluessig (getestet) 232 switch ( eScanType ) 233 { 234 case stStandardScan: 235 SendMessage( hScanTypeList, WM_SETTEXT, 0, ( LPARAM ) "Standard" ); 236 break; 237 238 case stOmega2ThetaScan: 239 SendMessage( hScanTypeList, WM_SETTEXT, 0, ( LPARAM ) "Omega-2Theta" ); 240 break; 241 } 242 243 //! test ob aenderung in Combobox 244 if ( codeNotify == CBN_SELCHANGE ) 245 { 246 //! wenn ja => was wurde ausgewaehlt 247 switch ( ComboBox_GetCurSel( hScanTypeList ) ) 248 { 249 case 0: // stStandardScan 250 eScanType= stStandardScan; 251 ComboBox_SelectString( hScanTypeList, 0, "Standard" ); 252 CtrlSetEnabled(id_ChooseMotor, TRUE ); 253 CtrlSetEnabled(id_2Theta, FALSE ); 254 break; 255 256 case 1: // stOmega2ThetaScan 257 eScanType= stOmega2ThetaScan; 258 //! test ob auch omega und theta motoren vorhanden 259 if ( !mlIsAxisValid( Omega ) || !mlIsAxisValid( Theta ) ) 260 { 261 //! nicht vorhanden => standard-scan setzen + abbruch 262 eScanType= stStandardScan; 263 ComboBox_SelectString( hScanTypeList, 0, "Standard" ); 264 break; 265 } 266 //! motoren vorhanden => omega-motor setzen + omega2theta-scan 267 //! setzen + Scan-Achsen-combobox sperren 268 Scan->nMotor= mlGetIdByName( Omega ); 269 mlSetAxis( Scan->nMotor ); 270 ComboBox_SelectString( hScanTypeList, 0, "Omega-2Theta" ); 271 CtrlSetEnabled(id_ChooseMotor, FALSE ); 272 CtrlSetEnabled(id_2Theta, TRUE ); 273 break; 274 } 275 } 276 } 277 //***************************************************************************** 278 279 void TSetupStepScanDlg::OnParamSet() 280 { 281 //! setzen der zum Motor gehoerigen Einheit 282 CtrlSetText( id_Unit, mGetUnitName() ); 283 284 //! alt // Bereich sollte den Motor nicht beeinflussen 285 //! test auf korrekte Bezieh. zwischen Min und Max 286 //! eintragen von korrekten Werten in Dialogbox 287 CtrlSetDouble(id_AngleWidth, Scan->dArgumentWidth, mGetDigits()+1, _DECIMAL); 288 289 if ( Scan->dArgumentMax >= mGetValue( MaxDistanceRel ) ) 290 Scan->dArgumentMax= mGetValue( MaxDistanceRel ) - mGetValue( MinWidth ); 291 CtrlSetDouble(id_AngleMax, Scan->dArgumentMax, mGetDigits(), _DECIMAL); 292 293 if ( Scan->dArgumentMin <= mGetValue(MinDistanceRel) ) 294 Scan->dArgumentMin= mGetValue(MinDistanceRel) + mGetValue( MinWidth ); 295 CtrlSetDouble(id_AngleMin, Scan->dArgumentMin, mGetDigits(), _DECIMAL); 296 297 CtrlSetText( id_Catalog, ( LPSTR ) Scan->szDataPath ); 298 ComboBox_SelectString( GetDlgItem(GetHandle(), id_ChooseMotor), 0, mGetAxisName() ); 299 ComboBox_SelectString( GetDlgItem(GetHandle(), id_ChooseDetector), 0, Scan->Detector->GetCharacteristic() ); 300 301 HWND hMonitorList= GetDlgItem( GetHandle(), id_ChooseMonitor ); 302 303 if (Scan->Monitor != 0) 304 ComboBox_SelectString( hMonitorList, 0 , Scan->Monitor->GetCharacteristic() ); 305 else 306 ComboBox_SelectString( hMonitorList, 0 , szMsgLine400 ); 307 308 //! FIX Fehler 8 309 CtrlSetDouble( id_MaxTime, Scan->fMaxTime, _MAXTIMEDIGITS, _DECIMAL ); 310 CtrlSetDouble(id_MaxCounts, Scan->dwMaxCounts, _MAXCOUNTSDIGITS, _DECIMAL); 311 //! neu 2Theta 312 CtrlSetDouble(id_2Theta, d2ThetaStart, _THETASTARTDIGITS, _DECIMAL); 313 } 314 //***************************************************************************** 315 316 void TSetupStepScanDlg::OnChooseMotor(UINT codeNotify) 317 { 318 //! test ob aenderung in combobox 319 if ( codeNotify == CBN_SELCHANGE) 320 { 321 //! ja => setzen des Motors 322 int idx= ComboBox_GetCurSel( GetDlgItem(GetHandle(), id_ChooseMotor) ); 323 324 if ( idx == CB_ERR ) 325 return; 326 327 if ( Scan->nMotor != idx ) 328 { 329 mlSetAxis( idx ); 330 Scan->nMotor= mlGetAxis(); 331 } 332 //! FIX Fehler 9 333 FORWARD_WM_COMMAND(GetHandle(), cm_ParamSet, 0, 0, PostMessage ); 334 } 335 } 336 //***************************************************************************** 337 338 void TSetupStepScanDlg::OnChooseDetector(UINT codeNotify) 339 { 340 if ( codeNotify == CBN_SELCHANGE ) 341 { 342 int idx= ComboBox_GetCurSel( GetDlgItem(GetHandle(), id_ChooseDetector) ); 343 344 if (idx == CB_ERR) 345 return; 346 347 Scan->Detector= TDetectorManager::DetectorManager().GetDetector( idx, 0 ); 348 } 349 } 350 //***************************************************************************** 351 352 void TSetupStepScanDlg::OnChooseMonitor(UINT codeNotify) 353 { 354 if ( codeNotify == CBN_SELCHANGE ) 355 { 356 int idx= ComboBox_GetCurSel( GetDlgItem(GetHandle(), id_ChooseMonitor) ) - 1; 357 358 if (idx == CB_ERR) 359 return; 360 361 Scan->Monitor= TDetectorManager::DetectorManager().GetDetector( idx ); 362 } 363 } 364 //***************************************************************************** 365 366 void TSetupStepScanDlg::OnDynamicActive() 367 { 368 if ( IsDlgButtonChecked( GetHandle(), id_DynamicActive ) ) 369 { 370 CtrlSetEnabled(cm_DynamicSetup, TRUE ); 371 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) cm_DynamicSetup, 0 ); 372 } 373 else 374 CtrlSetEnabled(cm_DynamicSetup, FALSE ); 375 } 376 //***************************************************************************** 377 378 BOOL TSetupStepScanDlg::CanClose( void ) 379 { 380 BOOL bFailure= FALSE; 381 float valueF; 382 long valueL; 383 BOOL bValid= TRUE; 384 385 //! uebernehmen der Einstellungen Staendig sichern und Bei Beenden speichern 386 Scan->bSaveContinuous= IsDlgButtonChecked( GetHandle(), id_SaveContinuous ); 387 Scan->bSaveOnReady= IsDlgButtonChecked( GetHandle(), id_SaveOnReady ); 388 389 //! Aenderung Dynamische Schrittweite 390 //! uebernehmen der Einstellungen Dyn. Schrittweite aktivieren 391 Scan->bDynamicStepWidth= IsDlgButtonChecked( GetHandle(), id_DynamicActive ); 392 393 //! liest Schrittweite aus Dialogbox und uebernimmt diesen wenn Wert <> 0 394 //! sonst Box wird nicht geschlossen (Fehler) 395 valueF= CtrlGetDouble( id_AngleWidth, mGetDigits()+1, _DECIMAL, bValid); 396 //! FIX Fehler 8 397 if (!bValid) bFailure= TRUE; 398 else if ( mGetValue( MinWidth )<=valueF ) 399 Scan->dArgumentWidth= valueF; 400 else { 401 MessageBeep(0); 402 CtrlSetFocus(id_AngleWidth); 403 bFailure= TRUE; 404 } 405 406 //! liest Wert fuer Maximumwinkel und testet ob dieser kleiner ist als der 407 //! max. erlaubte(fuer akt. Motor) wenn kleiner uebernehmen sonst uebernehmen 408 //! von max. erlaubten Winkel - 1* Schrittweite + schreiben in die Box (Box 409 //! wird nicht geschlossen) 410 valueF= CtrlGetDouble( id_AngleMax, mGetDigits(), _DECIMAL, bValid); 411 if (!bValid) bFailure= TRUE; 412 else if ( valueF<=mGetValue(MaxDistanceRel) ) 413 Scan->dArgumentMax= max( mGetValue(MinDistanceRel), valueF); 414 else 415 { 416 Scan->dArgumentMax= mGetValue(MaxDistanceRel) - mGetValue(MinWidth); 417 MessageBeep(0); 418 CtrlSetFocus(id_AngleMax); 419 bFailure= TRUE; 420 } 421 422 //! liest Minimum aus Dialogbox und testet ob >= als min. erlaubter Winkel 423 //! des akt. Motors 424 valueF= CtrlGetDouble( id_AngleMin, mGetDigits(), _DECIMAL, bValid); 425 if (!bValid) bFailure= TRUE; 426 else if ( valueF>=mGetValue(MinDistanceRel) ) 427 { 428 valueF= min( mGetValue(MaxDistanceRel), valueF); 429 //! test ob min >= max dann neu setzen + box wird nicht geschlossen 430 if ( valueF >= Scan->dArgumentMax ) // deshalb erst id_AngleMax auslesen 431 { 432 Scan->dArgumentMin= Scan->dArgumentMax; 433 Scan->dArgumentMax= valueF; 434 MessageBox(szMsgLine401, szMessageDlg, MBINFO); 435 CtrlSetFocus(id_AngleMax); 436 bFailure= TRUE; 437 } else Scan->dArgumentMin= valueF; 438 } 439 else 440 { 441 //! sonst Dialogelement auf motormin+10*Motorschrittweite setzen + Box wird 442 //! nicht geschlossen 443 Scan->dArgumentMin= mGetValue(MinDistanceRel) + 10.0 * mGetValue( MinWidth ); 444 MessageBeep(0); 445 CtrlSetFocus(id_AngleMin); 446 bFailure= TRUE; 447 } 448 449 //! liest die Zeit (Beschraenkung) aus Dialogbox und schliesst Box nur wenn 450 //! Wert <>0 (Fehler) 451 valueF= CtrlGetDouble( id_MaxTime, _MAXTIMEDIGITS, _DECIMAL, bValid ); 452 //! FIX Fehler 8 453 if (!bValid) bFailure= TRUE; 454 else if ( valueF>0.0 ) 455 Scan->fMaxTime= valueF; 456 else { 457 Scan->fMaxTime= 0.1f; 458 CtrlSetDouble( id_MaxTime, Scan->fMaxTime, _MAXTIMEDIGITS, _DECIMAL ); 459 MessageBeep(0); 460 CtrlSetFocus(id_MaxTime); 461 bFailure= TRUE; 462 } 463 464 //! liest die Impulse (Beschraenkung) aus Dialogbox und schliesst Box nur 465 //! wenn Wert<>0 (Fehler) 466 valueL= CtrlGetDouble(id_MaxCounts, _MAXCOUNTSDIGITS, _DECIMAL, bValid); 467 //! FIX Fehler 8 468 if (!bValid) bFailure= TRUE; 469 else if ( valueL>0 ) 470 Scan->dwMaxCounts= valueL; 471 else { 472 MessageBeep(0); 473 CtrlSetFocus(id_MaxCounts); 474 bFailure= TRUE; 475 } 476 //! liest Sicherungs-Verzeichnis aus Dialogbox und testet ob Verzeichnis 477 //! exist. durch anlegen der Datei 'check.tmp' wenn erfolgreich dann setzen 478 //! des Pfades sonst setzen von 'C:\\' + Box wird nicht verlassen 479 CtrlGetText( id_Catalog, ( LPSTR ) Scan->szDataPath, _MAX_PATH ); 480 if ( !PathCanWrite(Scan->szDataPath) ) { 481 strcpy( Scan->szDataPath, "c:\\" ); 482 CtrlSetFocus(id_Catalog); 483 MessageBeep(0); 484 bFailure= TRUE; 485 } 486 487 //! test ob 2Theta innerhalb von gueltigem Bereich (sowohl 1. als auch 488 //! letzter 2Thetawert 489 if ((!bFailure) && (eScanType == stOmega2ThetaScan)) 490 { 491 int nTheta= mlGetIdByName(Theta); 492 d2ThetaStart= CtrlGetDouble( id_2Theta, _THETASTARTDIGITS, _DECIMAL, bValid ); 493 valueF= d2ThetaStart + (Scan->dArgumentMax - Scan->dArgumentMin) * 2.0; 494 if (!bValid) bFailure= TRUE; 495 else if ( (d2ThetaStart >= mlGetValue(nTheta, MinDistanceRel)) && (valueF <= mlGetValue(nTheta, MaxDistanceRel)) ) 496 Scan->d2ThetaStart= d2ThetaStart; 497 else 498 { 499 MessageBox("Bereichsüberschreitung(Theta)", szMessageDlg, MBINFO); 500 CtrlSetFocus(id_2Theta); 501 bFailure= TRUE; 502 } 503 504 } 505 506 //! sorgt dafuer, dass bei aufgetretenen Fehlern die Box nicht verlassen wird 507 if ( bFailure ) 508 { 509 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) cm_ParamSet, 0 ); 510 return FALSE; 511 } 512 //! uebernehmen der restlichen Dialogeinstell. + Box kann geschlossen werden 513 Scan->eScanType= eScanType; 514 515 //! Achsenbeschriftung 516 strcpy(Scan->abzisse, mGetAxisName()); 517 return TRUE; 518 }; 519 520 //############################################################################## 521 // TSetupContinuousScanDlg 522 //############################################################################## 523 524 TSetupContinuousScanDlg::TSetupContinuousScanDlg( TScanWindow *aScan ) : TModalDlg( "CONTINUOUSSCAN", GetMainInstance() ), Scan(0), hDetectorList(0), hMotorList(0) 525 { 526 // ! neu (11.03.2004) Kullmann+Reinecker: alle Memberattribute initialisiert 527 Scan= aScan; //! Parameter von Scanfenster uebernehmen (Fehler) 528 // 11.03.2004 nMotor= Scan->nMotor; 529 // 11.03.2004 Detector= Scan->Detector; 530 dArgumentMin= Scan->dArgumentMin; 531 dArgumentMax= Scan->dArgumentMax; 532 dArgumentWidth= Scan->dArgumentWidth; 533 dSpeed= Scan->dSpeed; 534 nCollectionAmount= Scan->nCollectionAmount; 535 fMaxTime= Scan->fMaxTime; 536 bSaveOnReady= Scan->bSaveOnReady; 537 538 Scan->bSaveContinuous= FALSE; 539 }; 540 //***************************************************************************** 541 542 BOOL TSetupContinuousScanDlg::Dlg_OnInit( HWND, HWND hwndCtl, LPARAM lParam ) 543 { 544 //! Min und max event. auf gueltige werte setzen 545 if ( dArgumentMax >= mGetValue( MaxDistanceRel ) ) 546 dArgumentMax= mGetValue( MaxDistanceRel ) - mGetValue( MinWidth ); 547 if ( dArgumentMin <= mGetValue( MinDistanceRel ) ) 548 dArgumentMin= mGetValue( MinDistanceRel ) + mGetValue( MinWidth ); 549 //! Speicheroptionen in dialog eintragen 550 CheckDlgButton( GetHandle(), id_SaveOnReady, bSaveOnReady ); 551 CtrlSetText( id_Path, Scan->szDataPath ); 552 553 //! eintragen der Comboboxauswahlelemente fuer Detektor und Scanachse 554 //! vorauswahl der aktiven geraete 555 hDetectorList= GetDlgItem( GetHandle(), id_ChooseDetector ); 556 TDetectorManager::DetectorManager().FillDetectorComboBox(hDetectorList, 0); 557 ComboBox_SelectString( hDetectorList, 0, Scan->Detector->GetCharacteristic() ); 558 559 //! Handles der Comboboxen uebergeben 560 hMotorList= GetDlgItem( GetHandle(), id_ChooseMotor ); 561 for (int i=0; i<mlGetAxisNumber(); i++) 562 { 563 mlSetAxis( i ); 564 ComboBox_AddString( hMotorList, mGetAxisName() ); 565 } 566 mlSetAxis( Scan->nMotor ); 567 ComboBox_SelectString( hMotorList, 0, mGetAxisName() ); 568 569 // HotKey's für Hilfe 570 LoadHotKeys( LoadAccelerators(GetMainInstance(), MAKEINTRESOURCE(ACC_SetupContinuousScanDlg)) ); // Accelerator aus Ressourcen laden 571 572 //! eintragen der Messzeit in Dialogbox 573 //! bewirkt Aufruf von Dlg_OnCommand mit Kommando cm_ParamSet 574 FORWARD_WM_COMMAND( GetHandle(), IDRESET, hwndCtl, 0, SendMessage ); 575 // OK fokussieren 576 CtrlSetFocus(IDOK); 577 return TRUE; 578 }; 579 //***************************************************************************** 580 581 void TSetupContinuousScanDlg::Dlg_OnCommand( HWND, int id, HWND hwndCtl, 582 UINT codeNotify ) 583 { 584 int idx; 585 BOOL bValid= TRUE; 586 587 //! abhaengig von dialogelement bzw. Kommando 588 switch ( id ) 589 { 590 case cm_Help: 591 WinHelp(GetHandle(), GetHelpFile(), HELP_CONTEXT, Help_SetupContinuousScanDlg); 592 break; 593 594 //! zur initialisierung und bei aenderungen in Comboboxen aufgerufen 595 case IDRESET: 596 //! eintragen der Messzeit in Dialogbox 597 CtrlSetDouble( id_MaxTime, fMaxTime, _MAXTIMEDIGITS, _DECIMAL ); 598 //! Bereichsgroesse 599 CtrlSetDouble(id_StepWidth, dArgumentWidth, mGetDigits()+1, _DECIMAL); 600 //! Endpunkt 601 CtrlSetDouble(id_AngleMax, dArgumentMax, mGetDigits(), _DECIMAL); 602 //! Startpunkt 603 CtrlSetDouble(id_AngleMin, dArgumentMin, mGetDigits(), _DECIMAL); 604 //Fehler? Kullmann+Reinecker: Hier fehlt sicherlich ein break! 605 606 //! Geschwindigkeit, messbereiche, einheit ... aktualisieren 607 //! (event. vorher berechnen) 608 case cm_SetupParameters: 609 case cm_ParamSet: 610 dArgumentMin= CtrlGetDouble( id_AngleMin, mGetDigits(), _DECIMAL, bValid); 611 if (!bValid) return; 612 dArgumentMax= CtrlGetDouble( id_AngleMax, mGetDigits(), _DECIMAL, bValid); 613 if (!bValid) return; 614 615 //! Messpunkte 616 dArgumentWidth= CtrlGetDouble( id_StepWidth, mGetDigits()+1, _DECIMAL, bValid); 617 if (!bValid) return; 618 else if ( dArgumentWidth!=0.0 ) 619 { 620 nCollectionAmount= ( dArgumentMax - dArgumentMin ) / 621 dArgumentWidth; 622 CtrlSetLong(id_NumberSteps, nCollectionAmount); 623 } else { 624 MessageBeep(0); 625 CtrlSetFocus(id_StepWidth); 626 return; 627 } 628 629 //! Geschwindigkeit 630 fMaxTime= CtrlGetDouble( id_MaxTime, _MAXTIMEDIGITS, _DECIMAL, bValid ); 631 if (!bValid) return; 632 else if ( fMaxTime!=0.0) 633 { 634 dSpeed= dArgumentWidth / fMaxTime; 635 CtrlSetDouble(id_Velocity, dSpeed, mGetDigits(), _DECIMAL); 636 } else { 637 MessageBeep(0); 638 CtrlSetFocus(id_MaxTime); 639 return; 640 } 641 642 //! Motor/Detektor 643 ComboBox_SelectString( hMotorList, 0, mGetAxisName() ); 644 ComboBox_SelectString( hDetectorList, 0, Scan->Detector->GetCharacteristic() ); 645 //! Einheit 646 CtrlSetText( id_Unit, mGetUnitName() ); 647 //Fehler? Kullmann+Reinecker: Hier fehlt sicherlich ein break! 648 649 //! Scan-Achsen-Combobox ausgewaehlt 650 case id_ChooseMotor: 651 //! test ob aenderung in combobox 652 if ( codeNotify==CBN_SELCHANGE ) 653 { 654 idx= ComboBox_GetCurSel( hMotorList ); 655 if ( idx != CB_ERR && Scan->nMotor != idx ) 656 { 657 mlSetAxis( idx ); 658 Scan->nMotor= mlGetAxis(); 659 FORWARD_WM_COMMAND( GetHandle(), cm_ParamSet, 0, 0, PostMessage ); 660 } 661 } 662 break; 663 664 //! Detektor-combobox ausgewaehlt 665 case id_ChooseDetector: 666 //! test ob aenderung in combobox 667 if ( codeNotify == CBN_SELCHANGE ) 668 { 669 idx= ComboBox_GetCurSel( hDetectorList ); 670 671 if ( idx == CB_ERR ) 672 break; 673 674 TDetector* newDetector= TDetectorManager::DetectorManager().GetDetector( idx, 0 ); 675 676 //! ja => setzen des Detektors 677 //! und senden cm_ParamSet (hier nicht sinnvoll) <- Reinecker: "Und wer soll sonst die Parameter setzen?" 678 if ( Scan->Detector != newDetector ) 679 { 680 Scan->Detector= newDetector; 681 PostMessage( GetHandle(), WM_COMMAND, cm_ParamSet, 0 ); 682 } 683 } 684 break; 685 686 //! hier werden IDOK, IDCANCEL und IDABBORT behandelt 687 default: 688 TModalDlg::Dlg_OnCommand( GetHandle(), id, hwndCtl, codeNotify ); 689 } 690 }; 691 //***************************************************************************** 692 693 BOOL TSetupContinuousScanDlg::CanClose( void ) 694 { 695 char buf[ MaxString ]; 696 float valueF; 697 BOOL bFailure= FALSE; 698 double dAccelerationDistance= 0.0; 699 BOOL bValid= TRUE; 700 701 mlSetAxis(Scan->nMotor); 702 //! Speicher-Optionen 703 bSaveOnReady= IsDlgButtonChecked( GetHandle(), id_SaveOnReady ); 704 CtrlGetText(id_Path, ( LPSTR ) Scan->szDataPath, _MAX_PATH ); 705 if ( !PathCanWrite(Scan->szDataPath) ) { 706 strcpy( Scan->szDataPath, "c:\\" ); 707 CtrlSetFocus(id_Catalog); 708 MessageBeep(0); 709 bFailure= TRUE; 710 } 711 //! Messpunkte 712 nCollectionAmount= CtrlGetLong(id_NumberSteps, bValid); 713 if (!bValid) bFailure= TRUE; 714 else if ( 0 >= nCollectionAmount ) 715 { 716 MessageBox(szMsgLine131, szMsgFailureDlg, MBINFO); 717 CtrlSetFocus(id_NumberSteps); 718 bFailure= TRUE; 719 } 720 //! Messzeit 721 valueF= CtrlGetDouble( id_MaxTime, _MAXTIMEDIGITS, _DECIMAL, bValid); 722 if (!bValid) bFailure= TRUE; 723 else if ( 0.0 < valueF ) 724 fMaxTime= valueF; 725 else 726 { 727 fMaxTime= 0.1f; 728 CtrlSetDouble( id_MaxTime, fMaxTime, _MAXTIMEDIGITS, _DECIMAL ); 729 MessageBeep(0); 730 CtrlSetFocus(id_MaxTime); 731 bFailure= TRUE; 732 } 733 734 //! Geschwindigkeit 735 valueF= dArgumentWidth / fMaxTime; 736 if (!bFailure) 737 if ( ( mGetValue( MaxSpeed ) >= valueF ) && (valueF > 0.0)) 738 dSpeed= valueF; 739 else 740 { 741 MessageBox(szMsgLine130, szMsgFailureDlg, MBINFO); 742 bFailure= TRUE; 743 } 744 745 if (!bFailure) 746 { 747 //! Beschleunigungs- bzw. Bremsweg berechnen 748 valueF= (float)mGetValue( Acceleration ); 749 //! vorerst auskommentiert, da die ini-datei-param. nicht stimmen 750 //! dAccelerationDistance= 0.5 * (dSpeed * dSpeed) / valueF; 751 } 752 753 //! Bereichsgroesse 754 valueF= CtrlGetDouble( id_StepWidth, mGetDigits()+1, _DECIMAL, bValid); 755 if (!bValid) bFailure= TRUE; 756 else if ( mGetValue( MinWidth ) <= valueF ) 757 dArgumentWidth= valueF; 758 else 759 { 760 dArgumentWidth= mGetValue( MinWidth ); 761 MessageBeep(0); 762 CtrlSetFocus(id_StepWidth); 763 bFailure= TRUE; 764 } 765 766 767 //! Endpunkt + Bremsweg 768 valueF= CtrlGetDouble( id_AngleMax, mGetDigits(), _DECIMAL, bValid) + dAccelerationDistance; 769 if (!bValid) bFailure= TRUE; 770 else if ( (valueF <= mGetValue(MaxDistanceRel)) && (valueF >= (mGetValue(MinDistanceRel) + mGetValue( MinWidth))) ) 771 dArgumentMax= max( mGetValue(MinDistanceRel), valueF - dAccelerationDistance); 772 else 773 { 774 dArgumentMax= mGetValue(MaxDistanceRel) - mGetValue( MinWidth ) - 775 dAccelerationDistance; 776 char buf2[MaxString]; //! neu cont 777 sprintf(buf2, mGetDF(), dAccelerationDistance); 778 sprintf(buf, szMsgLine132, buf2); 779 MessageBox(buf, szMsgFailureDlg, MBINFO); 780 CtrlSetFocus(id_AngleMax); 781 bFailure= TRUE; 782 } 783 784 //! Startpunkt - beschleunigungsweg 785 valueF= CtrlGetDouble( id_AngleMin, mGetDigits(), _DECIMAL, bValid) + dAccelerationDistance; //! neu cont 786 if (!bValid) bFailure= TRUE; 787 else if ( (valueF >= mGetValue(MinDistanceRel)) && (valueF <= mGetValue(MaxDistanceRel)) ) 788 { 789 valueF= min( mGetValue(MaxDistanceRel), valueF); 790 //! test ob min >= max dann neu setzen + box wird nicht geschlossen 791 if ( valueF >= dArgumentMax ) // deshalb erst id_AngleMax auslesen 792 { 793 dArgumentMin= dArgumentMax; 794 dArgumentMax= valueF; 795 MessageBox(szMsgLine401, szMessageDlg, MBINFO); 796 CtrlSetFocus(id_AngleMin); 797 bFailure= TRUE; 798 } else dArgumentMin= valueF; 799 } 800 else 801 { 802 char buf2[MaxString]; 803 dArgumentMin= mGetValue(MinDistanceRel) + dAccelerationDistance; 804 sprintf(buf2, mGetDF(), dAccelerationDistance); //! neu cont 805 sprintf(buf, szMsgLine132, buf2); 806 MessageBox(buf, szMsgFailureDlg, MBINFO); 807 CtrlSetFocus(id_AngleMin); 808 bFailure= TRUE; 809 } 810 //! Messpunkte 811 nCollectionAmount= ( dArgumentMax - dArgumentMin ) / 812 dArgumentWidth + 1; 813 814 if ( bFailure ) 815 { 816 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) IDRESET, 0 ); 817 return FALSE; 818 } 819 //! wenn keine Fehler 820 if (!bFailure) 821 { 822 //! Parameter uebernehmen 823 Scan->dArgumentMin= dArgumentMin; 824 Scan->dArgumentMax= dArgumentMax; 825 Scan->dArgumentWidth= dArgumentWidth; 826 Scan->dSpeed= dSpeed; 827 Scan->nCollectionAmount= nCollectionAmount; 828 Scan->fMaxTime= fMaxTime; 829 Scan->bSaveOnReady= bSaveOnReady; 830 //! Scantyp 831 Scan->eScanType= stContinuousScan; 832 //! Achsenbeschriftung 833 strcpy(Scan->abzisse, mGetAxisName()); 834 } 835 return TRUE; 836 }; 837 838 //############################################################################## 839 // TSetupDynamicStepDlg 840 //############################################################################## 841 842 TSetupDynamicStepDlg::TSetupDynamicStepDlg( TScanWindow* aScan ) : TModalDlg( "DYNAMICSTEPWIDTH", GetMainInstance() ), Scan(0), ScalerDummy(2*nMaxScaleIdx, 0.0) 843 { 844 // ! neu (11.03.2004) Kullmann+Reinecker: alle Memberattribute initialisiert 845 Scan= aScan; 846 }; 847 //***************************************************************************** 848 849 int TSetupDynamicStepDlg::GetStaticId(UINT aBereich) { 850 switch (aBereich) { 851 case 0: 852 return id_Static_0; 853 854 case 1: 855 return id_Static_1; 856 857 case 2: 858 return id_Static_2; 859 860 case 3: 861 return id_Static_3; 862 863 case 4: 864 return id_Static_4; 865 866 case 5: 867 return id_Static_5; 868 869 case 6: 870 return id_Static_6; 871 872 case 7: 873 return id_Static_7; 874 875 case 8: 876 return id_Static_8; 877 878 case 9: 879 return id_Static_9; 880 881 default: // unbekannter Bereich 882 return -1; 883 } 884 } 885 //***************************************************************************** 886 887 int TSetupDynamicStepDlg::GetFactorId(UINT aBereich) { 888 switch (aBereich) { 889 case 0: 890 return id_Factor_0; 891 892 case 1: 893 return id_Factor_1; 894 895 case 2: 896 return id_Factor_2; 897 898 case 3: 899 return id_Factor_3; 900 901 case 4: 902 return id_Factor_4; 903 904 case 5: 905 return id_Factor_5; 906 907 case 6: 908 return id_Factor_6; 909 910 case 7: 911 return id_Factor_7; 912 913 case 8: 914 return id_Factor_8; 915 916 case 9: 917 return id_Factor_9; 918 919 default: // unbekannter Bereich 920 return -1; 921 } 922 } 923 //***************************************************************************** 924 925 int TSetupDynamicStepDlg::GetIntensityId(UINT aBereich) { 926 switch (aBereich) { 927 case 0: 928 return id_Intensity_0; 929 930 case 1: 931 return id_Intensity_1; 932 933 case 2: 934 return id_Intensity_2; 935 936 case 3: 937 return id_Intensity_3; 938 939 case 4: 940 return id_Intensity_4; 941 942 case 5: 943 return id_Intensity_5; 944 945 case 6: 946 return id_Intensity_6; 947 948 case 7: 949 return id_Intensity_7; 950 951 case 8: 952 return id_Intensity_8; 953 954 case 9: 955 return id_Intensity_9; 956 957 default: // unbekannter Bereich 958 return -1; 959 } 960 } 961 //***************************************************************************** 962 963 //! setzt Defaultwerte der Dialogbox bei Aufruf der Box 964 //! Rueckkehrcode immer true 965 BOOL TSetupDynamicStepDlg::Dlg_OnInit(HWND, HWND hwndCtl, LPARAM lParam) 966 { 967 // HotKey's für Hilfe 968 LoadHotKeys( LoadAccelerators(GetMainInstance(), MAKEINTRESOURCE(ACC_SetupDynamicStepDlg)) ); // Accelerator aus Ressourcen laden 969 970 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) IDRESET, 0 ); 971 //! Focus auf OK-Button der Box 972 CtrlSetFocus( IDOK ); 973 return TRUE; 974 }; 975 //***************************************************************************** 976 977 //! behandelt alle kommandos der Dialogbox 978 void TSetupDynamicStepDlg::Dlg_OnCommand(HWND, int id, HWND hwndCtl, UINT codeNotify) 979 { 980 int idx; 981 982 switch ( id ) 983 { 984 case cm_Help: 985 WinHelp(GetHandle(), GetHelpFile(), HELP_CONTEXT, Help_SetupDynamicStepDlg); 986 break; 987 988 case cm_ParamSet: //! Kommando cm_ParamSet 989 //! Eintragen der Dialogbox-Elemente 990 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 991 { 992 CtrlSetDouble(GetIntensityId(idx), ScalerDummy[idx], _INTENSITYDIGITS, _DECIMAL); 993 CtrlSetDouble(GetFactorId(idx), ScalerDummy[idx + nMaxScaleIdx], _FACTORDIGITS, _DECIMAL); 994 } 995 CtrlSetDouble(GetStaticId(0), 0, _STATICDIGITS, _DECIMAL); 996 for ( idx= 1; idx < nMaxScaleIdx; idx++ ) 997 { 998 CtrlSetDouble(GetStaticId(idx), ScalerDummy[idx - 1] + 1, _STATICDIGITS, _DECIMAL); 999 } 1000 break; 1001 1002 case IDRESET: //! Kommando IDRESET 1003 //! Uebernahme der Ursprungswerte in die Arbeits-Variablen + Kommando 1004 //! cm_ParamSet senden 1005 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 1006 { 1007 ScalerDummy[idx]= Scan->Scaler[idx]; 1008 ScalerDummy[idx + nMaxScaleIdx]= Scan->Scaler[idx + nMaxScaleIdx]; 1009 } 1010 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) cm_ParamSet, 0 ); 1011 break; 1012 1013 default: //! behandelt IDOK, IDCANCEL 1014 TModalDlg::Dlg_OnCommand( GetHandle(), id, hwndCtl, codeNotify ); 1015 } 1016 }; 1017 //***************************************************************************** 1018 1019 //! realisiert test der Dialogboxinhalte auf ihre konsistenz vor verlassen 1020 //! der Dialogbox (durch OK-Button) 1021 //! Rueckkehrcode False wenn die Dlg.box nicht geschlossen werden kann 1022 //! (Werte inkonsistent) sonst true 1023 BOOL TSetupDynamicStepDlg::CanClose() 1024 { 1025 int idx= 0; 1026 float fMaxIntensity= 0.0; 1027 BOOL retval= TRUE; 1028 BOOL bValid= TRUE; 1029 1030 //! Auslesen der Dialogbox-Elemente 1031 for ( idx; idx < nMaxScaleIdx; idx++ ) 1032 { 1033 ScalerDummy[ idx ]= CtrlGetDouble(GetIntensityId(idx), _INTENSITYDIGITS, _DECIMAL, bValid); 1034 if (!bValid) retval= FALSE; 1035 ScalerDummy[ idx + nMaxScaleIdx ]= CtrlGetDouble( GetFactorId(idx), _FACTORDIGITS, _DECIMAL, bValid); 1036 if (!bValid) retval= FALSE; 1037 } 1038 1039 //! Bestimmung der maximal vorkommenden Intensitaet 1040 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 1041 if ( ScalerDummy[ idx ] > fMaxIntensity ) 1042 fMaxIntensity= ScalerDummy[ idx ]; 1043 1044 //! inkorrekte Intensitaeten bestimmen 1045 //! Faktor auf 1 und Intensitaet auf Maximalen Wert +1 setzen 1046 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 1047 if ( ScalerDummy[ idx ] <= 0 ) 1048 { 1049 ScalerDummy[ idx ]= ++fMaxIntensity; 1050 ScalerDummy[ idx + nMaxScaleIdx ]= 1.0; 1051 retval= FALSE; 1052 } 1053 1054 // Sortieren der Intensitaeten 1055 float dummy; 1056 for ( idx= 0; idx < nMaxScaleIdx - 1; idx++ ) 1057 for ( int idy= idx + 1; idy < nMaxScaleIdx; idy++ ) 1058 { 1059 if ( ScalerDummy[ idx ] > ScalerDummy[ idy ] ) 1060 { 1061 dummy= ScalerDummy[ idx ]; 1062 ScalerDummy[ idx ]= ScalerDummy[ idy ]; 1063 ScalerDummy[ idy ]= dummy; 1064 dummy= ScalerDummy[ idx + nMaxScaleIdx ]; 1065 ScalerDummy[ idx + nMaxScaleIdx ]= ScalerDummy[ idy + nMaxScaleIdx ]; 1066 ScalerDummy[ idy + nMaxScaleIdx ]= dummy; 1067 retval= FALSE; 1068 } 1069 } 1070 1071 //! Behandlung doppelt vorkommender Intensitaeten 1072 //! Faktor auf 1 und Intensitaet auf Maximalen Wert +1 setzen 1073 for ( idx= 1; idx < nMaxScaleIdx; idx++ ) 1074 { 1075 if ( ScalerDummy[ idx - 1 ] == ScalerDummy[ idx ] ) 1076 { 1077 ScalerDummy[ idx ]= ++fMaxIntensity; 1078 ScalerDummy[ idx + nMaxScaleIdx ]= 1.0; 1079 retval= FALSE; 1080 } 1081 } 1082 1083 // erneutes Sortieren der Intensitaeten 1084 for ( idx= 0; idx < nMaxScaleIdx - 1; idx++ ) 1085 for ( int idy= idx + 1; idy < nMaxScaleIdx; idy++ ) 1086 { 1087 if ( ScalerDummy[ idx ] > ScalerDummy[ idy ] ) 1088 { 1089 dummy= ScalerDummy[ idx ]; 1090 ScalerDummy[ idx ]= ScalerDummy[ idy ]; 1091 ScalerDummy[ idy ]= dummy; 1092 dummy= ScalerDummy[ idx + nMaxScaleIdx ]; 1093 ScalerDummy[ idx + nMaxScaleIdx ]= ScalerDummy[ idy + nMaxScaleIdx ]; 1094 ScalerDummy[ idy + nMaxScaleIdx ]= dummy; 1095 } 1096 } 1097 1098 //! Test auf korrekte Faktor-Werte 1099 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 1100 if ( ScalerDummy[ idx + nMaxScaleIdx ] <= 0 ) 1101 { 1102 ScalerDummy[ idx + nMaxScaleIdx ]= 1; 1103 retval= FALSE; 1104 } 1105 1106 //! bei Fehler: Korrektur und Dialog bleibt geoeffnet 1107 if ( !retval ) 1108 PostMessage( GetHandle(), WM_COMMAND, ( WPARAM ) cm_ParamSet, 0 ); 1109 else 1110 for ( idx= 0; idx < nMaxScaleIdx; idx++ ) 1111 { 1112 Scan->Scaler[idx]= ScalerDummy[idx]; 1113 Scan->Scaler[idx + nMaxScaleIdx]= ScalerDummy[idx + nMaxScaleIdx]; 1114 } 1115 return retval; 1116 }; 1117