void KAIBase::DoReturn() { //KGLogPrintf(KGLOG_DEBUG, "[AI State] {%s} Turn to Return\n", m_pSelf->m_szName); SetAIInterval(1.0); m_ReturnData.nReturnFrame = g_pSO3World->m_nGameLoop + AI_RETURN_OVERTIME_FRAME; m_pSelf->Stop(); #ifdef _SERVER //清除仇恨 m_pSelf->m_ThreatList.ClearAllThreat(); //清除DEBUF //m_pSelf->m_BuffList.DeathClean(); //设置无敌 m_pSelf->m_bSystemShield = true; #endif SetAIState(aisReturn); #ifdef _SERVER TurnToIdle(); #endif //_SERVER OnReturn(); }
BOOL CCmdDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { if (pMsg->wParam == VK_RETURN) { OnReturn(); return FALSE; } else if (pMsg->wParam == 'D') { if (GetKeyState(VK_CONTROL) & 0x8000) { AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_VIEW_CMDDLG, 0); return TRUE; } } } return CDialog::PreTranslateMessage(pMsg); }
void CMainWindow::Notify( TNotifyUI &msg ) { DUI__Trace(msg.sType); if (msg.sType==_T("windowinit")) { OnInitWindow(msg); } else if (msg.sType==_T("click")) { OnClick(msg); } else if (msg.sType==_T("selectchanged")) { OnSelectChanged(msg); } else if (msg.sType==_T("itemactivate")) { OnItemActive(msg); } else if (msg.sType==_T("itemclick")) { OnItemClick(msg); } else if (msg.sType==_T("menu")) { OnMenu(msg); } else if (msg.sType==_T("killfocus")) { OnKillFocus(msg); } else if (msg.sType==_T("return")) { OnReturn(msg); } }
void KAIBase::Activate(void) { KG_PROCESS_ERROR(m_pSelf); if (m_eAIType <= aitInvalid || m_eAIType >= aitTotal) return; if (g_pSO3World->m_nGameLoop < m_nNextActiveFrame) return; m_nNextActiveFrame = g_pSO3World->m_nGameLoop + m_nAIInterval; CheckAIEvent(); // Npc可能在脚本中被删除,所以调用脚本之后要判断下 KG_PROCESS_ERROR(m_pSelf->m_pScene && m_pSelf->m_pCell && m_pSelf->m_eMoveState != cmsOnDeath); if (IS_NPC(m_pSelf->m_dwID)) { if (m_pSelf->m_bFightState) { //战斗状态中 } else { //非战斗状态中 //触发NpcDialog的Idle事件 if (m_nNextIdleActionFrame < g_pSO3World->m_nGameLoop) { //-------- AI Event:Idle --------------------------------- KTarget rTarget; rTarget.ClearTarget(); g_pSO3World->m_Settings.m_SmartDialogList.FireEvent((KNpc*)m_pSelf, ntatIdle, rTarget); //-------------------------------------------------------- m_nNextIdleActionFrame = g_pSO3World->m_nGameLoop + g_pSO3World->m_Settings.m_ConstList.nNpcIdleActionInterval; } } } switch (m_eAIState) { case aisIdle: OnIdle(); break; case aisWander: OnWander(); break; case aisPatrol: OnPartol(); break; case aisAlert: OnAlert(); break; case aisFollow: OnFollow(); break; case aisPursuit: OnPursuit(); break; case aisKeepAway: OnKeepAway(); break; case aisEscape: OnEscape(); break; case aisReturn: OnReturn(); break; case aisWait: OnWait(); break; default: KGLOG_PROCESS_ERROR(FALSE); break; } return; Exit0: return; }
JPEG2000OptionsDialog::JPEG2000OptionsDialog( const ImageOptions& o, const JPEG2000ImageOptions& t, bool isJPC ) : Dialog(), options(), jp2Options() { int labelWidth1 = Font().Width( String( "Decompression Layers:" ) + 'M' ); Lossless_RadioButton.SetText( "Lossless" ); Lossless_RadioButton.SetToolTip( "Nondestructive compression" ); Lossless_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this ); Lossy_RadioButton.SetText( "Lossy" ); Lossy_RadioButton.SetToolTip( "Destructive compression" ); Lossy_RadioButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::CompressionMode_Click, *this ); CompressionRate_NumericControl.label.SetText( "Compression Rate:" ); CompressionRate_NumericControl.label.SetMinWidth( labelWidth1 ); CompressionRate_NumericControl.slider.SetScaledMinWidth( 125 ); CompressionRate_NumericControl.slider.SetRange( 1, 999 ); CompressionRate_NumericControl.SetReal( true ); CompressionRate_NumericControl.SetRange( 0.01, 0.99 ); CompressionRate_NumericControl.SetPrecision( 2 ); CompressionRate_NumericControl.SetToolTip( "Compression factor: compressed/original size" ); UnsignedSample_CheckBox.SetText( "Unsigned Samples" ); UnsignedSample_CheckBox.SetToolTip( "Write unsigned sample values" ); Compression_Sizer.SetMargin( 6 ); Compression_Sizer.Add( Lossless_RadioButton ); Compression_Sizer.AddSpacing( 6 ); Compression_Sizer.Add( Lossy_RadioButton ); Compression_Sizer.Add( CompressionRate_NumericControl ); Compression_Sizer.AddSpacing( 8 ); Compression_Sizer.Add( UnsignedSample_CheckBox ); Compression_GroupBox.SetTitle( "Compression" ); Compression_GroupBox.SetSizer( Compression_Sizer ); Compression_GroupBox.AdjustToContents(); Compression_GroupBox.SetMinSize(); // DecompressionLayers_Label.SetText( "Decompression Layers:" ); DecompressionLayers_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); DecompressionLayers_Label.SetMinWidth( labelWidth1 ); DecompressionLayers_SpinBox.SetRange( 2, 10 ); DecompressionLayers_SpinBox.SetMinWidth( Font().Width( "000000" ) ); DecompressionLayers_Sizer.SetSpacing( 6 ); DecompressionLayers_Sizer.Add( DecompressionLayers_Label ); DecompressionLayers_Sizer.Add( DecompressionLayers_SpinBox ); DecompressionLayers_Sizer.AddStretch(); ProgressionOrder_Label.SetText( "Progression Order:" ); ProgressionOrder_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); ProgressionOrder_Label.SetMinWidth( labelWidth1 ); ProgressionOrder_ComboBox.AddItem( "LRCP: Layer-Resolution-Component-Position" ); ProgressionOrder_ComboBox.AddItem( "RLCP: Resolution-Layer-Component-Position" ); ProgressionOrder_ComboBox.AddItem( "RPCL: Resolution-Position-Component-Layer" ); ProgressionOrder_ComboBox.AddItem( "PCRL: Position-Component-Resolution-Layer" ); ProgressionOrder_ComboBox.AddItem( "CPRL: Component-Position-Resolution-Layer" ); ProgressionOrder_Sizer.SetSpacing( 6 ); ProgressionOrder_Sizer.Add( ProgressionOrder_Label ); ProgressionOrder_Sizer.Add( ProgressionOrder_ComboBox, 100 ); Progressive_Sizer.SetMargin( 6 ); Progressive_Sizer.SetSpacing( 6 ); Progressive_Sizer.Add( DecompressionLayers_Sizer ); Progressive_Sizer.Add( ProgressionOrder_Sizer ); Progressive_GroupBox.SetTitle( "Progressive Decoding" ); Progressive_GroupBox.EnableTitleCheckBox(); Progressive_GroupBox.SetSizer( Progressive_Sizer ); Progressive_GroupBox.AdjustToContents(); Progressive_GroupBox.SetMinSize(); // TileWidth_NumericEdit.label.SetText( "Tile Width:" ); TileWidth_NumericEdit.label.SetMinWidth( labelWidth1 ); TileWidth_NumericEdit.SetInteger(); TileWidth_NumericEdit.SetRange( 16, 8192 ); TileHeight_NumericEdit.label.SetText( "Tile Height:" ); TileHeight_NumericEdit.SetInteger(); TileHeight_NumericEdit.SetRange( 16, 8192 ); Tiled_Sizer.SetMargin( 6 ); Tiled_Sizer.Add( TileWidth_NumericEdit ); Tiled_Sizer.AddStretch( 25 ); Tiled_Sizer.Add( TileHeight_NumericEdit ); Tiled_Sizer.AddStretch( 75 ); Tiled_GroupBox.SetTitle( "Tiled Image" ); Tiled_GroupBox.EnableTitleCheckBox(); Tiled_GroupBox.SetSizer( Tiled_Sizer ); Tiled_GroupBox.AdjustToContents(); Tiled_GroupBox.SetMinSize(); // ICCProfile_CheckBox.SetText( "ICC Profile" ); ICCProfile_CheckBox.SetToolTip( "Embed an ICC profile" ); Resolution_CheckBox.SetText( "Resolution" ); Resolution_CheckBox.SetToolTip( "Embed image resolution information" ); EmbeddedData_Sizer.SetMargin( 6 ); EmbeddedData_Sizer.Add( ICCProfile_CheckBox ); EmbeddedData_Sizer.Add( Resolution_CheckBox ); EmbeddedData_GroupBox.SetTitle( "Embedded Data" ); EmbeddedData_GroupBox.SetSizer( EmbeddedData_Sizer ); EmbeddedData_GroupBox.AdjustToContents(); EmbeddedData_GroupBox.SetMinSize(); if ( isJPC ) EmbeddedData_GroupBox.Hide(); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&JPEG2000OptionsDialog::Button_Click, *this ); BottomSection_Sizer.SetSpacing( 8 ); BottomSection_Sizer.AddStretch(); BottomSection_Sizer.Add( OK_PushButton ); BottomSection_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 8 ); Global_Sizer.Add( Compression_GroupBox ); Global_Sizer.Add( Progressive_GroupBox ); Global_Sizer.Add( Tiled_GroupBox ); Global_Sizer.Add( EmbeddedData_GroupBox ); Global_Sizer.AddSpacing( 8 ); Global_Sizer.Add( BottomSection_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( isJPC ? "JPEG2000 Code Stream Options" : "JPEG2000 JP2 Options" ); OnReturn( (pcl::Dialog::return_event_handler)&JPEG2000OptionsDialog::Dialog_Return, *this ); options = o; jp2Options = t; Lossless_RadioButton.SetChecked( !jp2Options.lossyCompression ); Lossy_RadioButton.SetChecked( jp2Options.lossyCompression ); CompressionRate_NumericControl.Enable( jp2Options.lossyCompression ); CompressionRate_NumericControl.SetValue( jp2Options.compressionRate ); UnsignedSample_CheckBox.SetChecked( !jp2Options.signedSample ); Progressive_GroupBox.SetChecked( jp2Options.numberOfLayers > 1 ); DecompressionLayers_SpinBox.SetValue( jp2Options.numberOfLayers ); ProgressionOrder_ComboBox.SetCurrentItem( jp2Options.progressionOrder ); Tiled_GroupBox.SetChecked( jp2Options.tiledImage ); TileWidth_NumericEdit.SetValue( jp2Options.tileWidth ); TileHeight_NumericEdit.SetValue( jp2Options.tileHeight ); ICCProfile_CheckBox.SetChecked( options.embedICCProfile ); Resolution_CheckBox.SetChecked( jp2Options.resolutionData ); }
FileDataCachePreferencesDialog::FileDataCachePreferencesDialog( FileDataCache* theCache ) : Dialog(), cache( theCache ) { int labelWidth1 = Font().Width( String( "Cache duration (days):" ) + 'T' ); int ui4 = LogicalPixelsToPhysical( 4 ); // const char* persistentCacheToolTip = "<p>Use a persistent file cache to store statistical data and noise " "estimates of all integrated images. A persistent cache is kept across " "PixInsight sessions. If you disable this option, the file cache will " "still be used, but only during the current session; as soon as you exit " "the PixInsight Core application, all the cached information will be lost. " "With the persistent cache option enabled, all cache items will be stored " "and will be available the next time you run PixInsight.</p>" "<p>The cache greatly improves performance when the same images are being " "integrated several times; for example to find optimal pixel rejection " "parameters, or to check different HDR composition thresholds.</p>"; PersistentCache_CheckBox.SetText( "Persistent file cache" ); PersistentCache_CheckBox.SetToolTip( persistentCacheToolTip ); PersistentCache_CheckBox.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); PersistentCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); PersistentCache_Sizer.Add( PersistentCache_CheckBox ); PersistentCache_Sizer.AddStretch(); // const char* cacheDurationToolTip = "<p>Persistent file cache items can be automatically removed after a " "specified period without accessing the corresponding files. Enter the " "desired period in days, or specify zero to disable this <i>automatic purge</i> " "feature, so that existing file cache items will never be removed " "automatically.</p>"; CacheDuration_Label.SetText( "Cache duration (days):" ); CacheDuration_Label.SetMinWidth( labelWidth1 ); CacheDuration_Label.SetToolTip( cacheDurationToolTip ); CacheDuration_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); CacheDuration_SpinBox.SetRange( 0, 90 ); CacheDuration_SpinBox.SetMinimumValueText( "<Forever>" ); CacheDuration_SpinBox.SetToolTip( cacheDurationToolTip ); CacheDuration_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&FileDataCachePreferencesDialog::SpinBox_ValueUpdated, *this ); CacheDuration_Sizer.SetSpacing( 4 ); CacheDuration_Sizer.Add( CacheDuration_Label ); CacheDuration_Sizer.Add( CacheDuration_SpinBox ); CacheDuration_Sizer.AddStretch(); // ClearCache_PushButton.SetText( "Clear Memory Cache Now" ); ClearCache_PushButton.SetToolTip( "Click this button to remove all cache items currently stored in volatile RAM." ); ClearCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); ClearCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); ClearCache_Sizer.Add( ClearCache_PushButton, 100 ); // PurgeCache_PushButton.SetText( "Purge Persistent Cache Now" ); PurgeCache_PushButton.SetToolTip( "Click this button to remove all stored persistent cache items." ); PurgeCache_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); PurgeCache_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); PurgeCache_Sizer.Add( PurgeCache_PushButton, 100 ); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&FileDataCachePreferencesDialog::Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 ); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( PersistentCache_Sizer ); Global_Sizer.Add( CacheDuration_Sizer ); Global_Sizer.Add( ClearCache_Sizer ); Global_Sizer.Add( PurgeCache_Sizer ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); // SetWindowTitle( cache->CacheName() + " Preferences" ); OnReturn( (pcl::Dialog::return_event_handler)&FileDataCachePreferencesDialog::Dialog_Return, *this ); cacheEnabled = cache->IsEnabled(); cacheDuration = cache->Duration(); Update(); }
HistogramAutoClipSetupDialog::HistogramAutoClipSetupDialog() : Dialog() { pcl::Font fnt = Font(); int labelWidth = fnt.Width( String( '0', 10 ) ); m_shadowsAutoClipping = TheHistogramTransformationInterface->m_shadowsAutoClipping; m_highlightsAutoClipping = TheHistogramTransformationInterface->m_highlightsAutoClipping; ShadowsAmount_NumericControl.label.SetText( "Shadows:" ); ShadowsAmount_NumericControl.label.SetFixedWidth( labelWidth ); ShadowsAmount_NumericControl.slider.SetScaledFixedWidth( 250 ); ShadowsAmount_NumericControl.slider.SetRange( 0, 200 ); ShadowsAmount_NumericControl.SetReal(); ShadowsAmount_NumericControl.SetRange( 0.0, 100.0 ); ShadowsAmount_NumericControl.SetPrecision( 3 ); ShadowsAmount_NumericControl.SetToolTip( "Shadows auto clipping amount" ); ShadowsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this ); HighlightsAmount_NumericControl.label.SetText( "Highlights:" ); HighlightsAmount_NumericControl.label.SetFixedWidth( labelWidth ); HighlightsAmount_NumericControl.slider.SetScaledFixedWidth( 250 ); HighlightsAmount_NumericControl.slider.SetRange( 0, 200 ); HighlightsAmount_NumericControl.SetReal(); HighlightsAmount_NumericControl.SetRange( 0.0, 100.0 ); HighlightsAmount_NumericControl.SetPrecision( 3 ); HighlightsAmount_NumericControl.SetToolTip( "Highlights auto clipping amount" ); HighlightsAmount_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&HistogramAutoClipSetupDialog::__ClippingAmount_ValueUpdated, *this ); ClippingParameters_Sizer.SetMargin( 8 ); ClippingParameters_Sizer.SetSpacing( 6 ); ClippingParameters_Sizer.Add( ShadowsAmount_NumericControl ); ClippingParameters_Sizer.Add( HighlightsAmount_NumericControl ); ClippingParameters_GroupBox.SetTitle( "Clipping Amounts (Percentage of total pixels)" ); ClippingParameters_GroupBox.SetSizer( ClippingParameters_Sizer ); OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (Button::click_event_handler)&HistogramAutoClipSetupDialog::__Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( ClippingParameters_GroupBox ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( "Histogram Auto Clipping Setup" ); OnReturn( (Dialog::return_event_handler)&HistogramAutoClipSetupDialog::__Dialog_Return, *this ); ShadowsAmount_NumericControl.SetValue( 100*m_shadowsAutoClipping ); HighlightsAmount_NumericControl.SetValue( 100*m_highlightsAutoClipping ); Update(); }
DynamicCropPreferencesDialog::DynamicCropPreferencesDialog() : Dialog() { savedColor = fillColor; pcl::Font fnt = Font(); int buttonWidth = fnt.Width( String( "Cancel" ) + String( 'M', 4 ) ); Black_RadioButton.SetText( "Black" ); Black_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); White_RadioButton.SetText( "White" ); White_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Alpha_Label.SetText( "Alpha Blend:" ); Alpha_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); Alpha_Slider.SetRange( 0, 255 ); Alpha_Slider.SetStepSize( 10 ); Alpha_Slider.SetTickFrequency( 10 ); Alpha_Slider.SetTickStyle( TickStyle::NoTicks ); Alpha_Slider.SetScaledMinWidth( 265 ); Alpha_Slider.OnValueUpdated( (Slider::value_event_handler)&DynamicCropPreferencesDialog::Slider_ValueUpdated, *this ); FillColor_Sizer.SetMargin( 8 ); FillColor_Sizer.SetSpacing( 6 ); FillColor_Sizer.Add( Black_RadioButton ); FillColor_Sizer.Add( White_RadioButton ); FillColor_Sizer.AddSpacing( 10 ); FillColor_Sizer.Add( Alpha_Label ); FillColor_Sizer.Add( Alpha_Slider ); FillColor_GroupBox.SetTitle( "Fill Color" ); FillColor_GroupBox.SetSizer( FillColor_Sizer ); OK_PushButton.SetText( "OK" ); OK_PushButton.SetMinWidth( buttonWidth ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetMinWidth( buttonWidth ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this ); Buttons_Sizer.SetSpacing( 8 ); Buttons_Sizer.AddStretch(); Buttons_Sizer.Add( OK_PushButton ); Buttons_Sizer.Add( Cancel_PushButton ); Global_Sizer.SetMargin( 8 ); Global_Sizer.SetSpacing( 6 ); Global_Sizer.Add( FillColor_GroupBox ); Global_Sizer.AddSpacing( 4 ); Global_Sizer.Add( Buttons_Sizer ); SetSizer( Global_Sizer ); AdjustToContents(); SetFixedSize(); SetWindowTitle( "DynamicCrop Interface Preferences" ); OnReturn( (pcl::Dialog::return_event_handler)&DynamicCropPreferencesDialog::Dialog_Return, *this ); Black_RadioButton.SetChecked( Red( fillColor ) == 0 ); White_RadioButton.SetChecked( Red( fillColor ) != 0 ); Alpha_Slider.SetValue( Alpha( fillColor ) ); Update(); }
//-------------------------------------------------------------------------------- long CTreeView::OnNotify( NotificationMessageHeader* pHdr ) { _WINQ_FCONTEXT( "CTreeView::OnNotify" ); long lResult = 0; if( pHdr != 0 ) { switch ( pHdr->m_uiCode ) { case NM_CLICK: { lResult = static_cast< long >( OnClick( pHdr ) ? 0 : 1 ); } break; case NM_CUSTOMDRAW: { lResult = OnCustomDraw( reinterpret_cast< NMTVCUSTOMDRAW* >( pHdr ) ); } break; case NM_DBLCLK: { lResult = static_cast< long >( OnDblClick( pHdr ) ? 0 : 1 ); } break; case NM_KILLFOCUS: { OnKillFocus( pHdr ); } break; case NM_RCLICK: { lResult = static_cast< long >( OnRClick( pHdr ) ? 0 : 1 ); } break; case NM_RDBLCLK: { lResult = static_cast< long >( OnRDblClick( pHdr ) ? 0 : 1 ); } break; case NM_RETURN: { lResult = static_cast< long >( OnReturn( pHdr ) ? 0 : 1 ); } break; #if ( _WIN32_IE >= 0x0400 ) case NM_SETCURSOR: { lResult = static_cast< long >( OnSetCursor( reinterpret_cast< NMMOUSE* >( pHdr ) ) ? 0 : 1 ); } break; #endif//( _WIN32_IE >= 0x0400 ) case NM_SETFOCUS: { OnSetFocus( pHdr ); } break; #if ( _WIN32_IE >= 0x0600 ) case TVN_ASYNCDRAW: { OnAsyncDraw( reinterpret_cast< NMTVASYNCDRAW* >( pHdr ) ); } break; #endif//( _WIN32_IE >= 0x0600 ) case TVN_BEGINDRAG: { OnBeginDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; case TVN_BEGINLABELEDIT: { lResult = static_cast< long >( OnBeginLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 0 : 1 ); } break; case TVN_BEGINRDRAG: { OnBeginRDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; case TVN_DELETEITEM: { OnDeleteItem( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; case TVN_ENDLABELEDIT: { lResult = static_cast< long >( OnEndLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 1 : 0 ); } break; case TVN_GETDISPINFO: { OnGetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ); } break; #if ( _WIN32_IE >= 0x0400 ) case TVN_GETINFOTIP: { OnGetInfoTip( reinterpret_cast< NMTVGETINFOTIP* >( pHdr ) ); } break; #endif//( _WIN32_IE >= 0x0400 ) #if ( _WIN32_IE > 0x0600 ) case TVN_ITEMCHANGED: { lResult = static_cast< long >( OnItemChanged( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 ); } break; case TVN_ITEMCHANGING: { lResult = static_cast< long >( OnItemChanging( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 ); } break; #endif//( _WIN32_IE > 0x0600 ) case TVN_ITEMEXPANDED: { OnItemExpanded( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; case TVN_ITEMEXPANDING: { lResult = static_cast< long >( OnItemExpanding( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 ); } break; case TVN_KEYDOWN: { lResult = static_cast< long >( OnKeyDown( reinterpret_cast< NMTVKEYDOWN* >( pHdr ) ) ? 0 : 1 ); } break; case TVN_SELCHANGED: { OnSelChanged( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; case TVN_SELCHANGING: { lResult = static_cast< long >( OnSelChanging( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 ); } break; case TVN_SETDISPINFO: { OnSetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ); } break; #if ( _WIN32_IE >= 0x0400 ) case TVN_SINGLEEXPAND: { lResult = OnSingleExpand( reinterpret_cast< NMTREEVIEW* >( pHdr ) ); } break; #endif//( _WIN32_IE >= 0x0400 ) default: { lResult = OnUnknownNotification( pHdr ); } break; } } return lResult; }
TIFFRangeOptionsDialog::TIFFRangeOptionsDialog( const TIFFFormat::OutOfRangePolicyOptions& options, int bitsPerSample, double minSampleValue, double maxSampleValue ) : Dialog(), outOfRange( options ) { if ( maxSampleValue < minSampleValue ) Swap( minSampleValue, maxSampleValue ); TIFFFormat::OutOfRangePolicyOptions o = TIFFFormat::DefaultOutOfRangePolicyOptions(); int labelWidth = Font().Width( String( "If out of range:" ) + 'M' ); // Info_Label.EnableWordWrapping(); Info_Label.EnableRichText(); Info_Label.SetText( "<p>This TIFF file stores a " + String( bitsPerSample ) + "-bit floating point image.<br>" "Its extreme pixel sample values are:</p>" "<p style=\"white-space:pre;\"><pre>" + String().Format( "Minimum: %+.15g", minSampleValue ) + "<br>" + String().Format( "Maximum: %+.15g", maxSampleValue ) + "</pre></p>" "<p>Please specify a range of values to correctly interpret existing pixel values in this image. " "The lower and upper range bounds below correspond to the limits of the available dynamic range in the " "context of this TIFF image. PixInsight will use these limits to scale pixel values to the normalized " "[0,1] range, where zero represents black and one represents white.</p>" ); // LowerRange_NumericEdit.label.SetText( "Lower Range:" ); LowerRange_NumericEdit.label.SetFixedWidth( labelWidth ); LowerRange_NumericEdit.SetReal( true ); LowerRange_NumericEdit.SetRange( -DBL_MAX, +DBL_MAX ); LowerRange_NumericEdit.SetPrecision( 15 ); LowerRange_NumericEdit.EnableScientificNotation(); LowerRange_NumericEdit.SetScientificNotationTriggerExponent( 5 ); LowerRange_NumericEdit.sizer.AddStretch(); LowerRange_NumericEdit.SetToolTip( "<p>Lower range of input floating point pixel samples.</p>" ); LowerRange_NumericEdit.SetValue( o.lowerRange ); UpperRange_NumericEdit.label.SetText( "Upper Range:" ); UpperRange_NumericEdit.label.SetFixedWidth( labelWidth ); UpperRange_NumericEdit.SetReal( true ); UpperRange_NumericEdit.SetRange( -DBL_MAX, +DBL_MAX ); UpperRange_NumericEdit.SetPrecision( 15 ); UpperRange_NumericEdit.EnableScientificNotation(); UpperRange_NumericEdit.SetScientificNotationTriggerExponent( 5 ); UpperRange_NumericEdit.sizer.AddStretch(); UpperRange_NumericEdit.SetToolTip( "<p>Upper range of input floating point pixel samples.</p>" ); UpperRange_NumericEdit.SetValue( o.upperRange ); ReadRescaleMode_Label.SetText( "If out-of-range:" ); ReadRescaleMode_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter ); ReadRescaleMode_Label.SetMinWidth( labelWidth ); ReadRescaleMode_ComboBox.AddItem( "Rescale image to the specified range" ); ReadRescaleMode_ComboBox.AddItem( "Truncate all out-of-range values" ); ReadRescaleMode_ComboBox.SetToolTip( "<p>This parameter tells how to fix input pixel samples whose values " "exceed the specified input range.</p>" ); ReadRescaleMode_ComboBox.SetCurrentItem( outOfRange.outOfRangeFixMode ); ReadRescaleMode_Sizer.SetSpacing( 4 ); ReadRescaleMode_Sizer.Add( ReadRescaleMode_Label ); ReadRescaleMode_Sizer.Add( ReadRescaleMode_ComboBox, 100 ); ReadRange_Sizer.SetMargin( 6 ); ReadRange_Sizer.SetSpacing( 4 ); ReadRange_Sizer.Add( LowerRange_NumericEdit ); ReadRange_Sizer.Add( UpperRange_NumericEdit ); ReadRange_Sizer.Add( ReadRescaleMode_Sizer ); ReadRange_GroupBox.SetTitle( "Floating Point Input Range" ); ReadRange_GroupBox.SetSizer( ReadRange_Sizer ); // OK_PushButton.SetText( "OK" ); OK_PushButton.SetDefault(); OK_PushButton.SetCursor( StdCursor::Checkmark ); OK_PushButton.OnClick( (pcl::Button::click_event_handler)&TIFFRangeOptionsDialog::Button_Click, *this ); Cancel_PushButton.SetText( "Cancel" ); Cancel_PushButton.SetCursor( StdCursor::Crossmark ); Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&TIFFRangeOptionsDialog::Button_Click, *this ); BottomSection_Sizer.SetSpacing( 8 ); BottomSection_Sizer.AddStretch(); BottomSection_Sizer.Add( OK_PushButton ); BottomSection_Sizer.Add( Cancel_PushButton ); // Global_Sizer.SetMargin( 8 ); Global_Sizer.Add( Info_Label ); Global_Sizer.AddSpacing( 12 ); Global_Sizer.Add( ReadRange_GroupBox ); Global_Sizer.AddSpacing( 12 ); Global_Sizer.Add( BottomSection_Sizer ); SetSizer( Global_Sizer ); SetWindowTitle( "TIFF Floating Point Range Options" ); OnShow( (Control::event_handler)&TIFFRangeOptionsDialog::Control_Show, *this ); OnReturn( (Dialog::return_event_handler)&TIFFRangeOptionsDialog::Dialog_Return, *this ); }