Пример #1
0
void StarGeneratorInterface::__Button_Clicked( Button& sender, bool checked )
{
   if ( sender == GUI->StarDatabase_ToolButton )
   {
      OpenFileDialog d;
      d.DisableMultipleSelections();
      d.SetCaption( "StarGenerator: Select Star Database File" );
      if ( d.Execute() )
      {
         instance.starDatabasePath = d.FileName();
         GUI->StarDatabase_Edit.SetText( instance.starDatabasePath );
      }
   }
   else if ( sender == GUI->OutputFile_ToolButton )
   {
      SaveFileDialog d;
      d.SetCaption( "StarGenerator: Select Output CSV File" );
      d.EnableOverwritePrompt();

      FileFilter csvFilter;
      csvFilter.SetDescription( "CSV Text Files" );
      csvFilter.AddExtension( ".csv" );
      d.Filters().Add( csvFilter );
      FileFilter allFilter;
      allFilter.SetDescription( "Any Files" );
      allFilter.AddExtension( "*" );
      d.Filters().Add( allFilter );

      if ( d.Execute() )
      {
         instance.outputFilePath = d.FileName();
         GUI->OutputFile_Edit.SetText( instance.outputFilePath );
      }
   }
   else if ( sender == GUI->DecSouth_CheckBox )
   {
      if ( checked != (instance.centerDec < 0) )
      {
         instance.centerDec = -instance.centerDec;
         UpdateDecControls();
      }
   }
   else if ( sender == GUI->Nonlinear_CheckBox )
   {
      instance.nonlinear = checked;
      UpdateControls();
   }
}
Пример #2
0
void HDRCompositionInterface::__InputImages_Click( Button& sender, bool checked )
{
   if ( sender == GUI->AddFiles_PushButton )
   {
      OpenFileDialog d;
      d.EnableMultipleSelections();
      d.LoadImageFilters();
      d.SetCaption( "HDRComposition: Select Input Images" );

      if ( d.Execute() )
      {
         size_type i0 = TreeInsertionIndex( GUI->InputImages_TreeBox );
         for ( StringList::const_iterator i = d.FileNames().Begin(); i != d.FileNames().End(); ++i )
            instance.images.Insert( instance.images.At( i0++ ), HDRCompositionInstance::ImageItem( *i ) );

         UpdateInputImagesList();
         UpdateImageSelectionButtons();
      }
   }
   else if ( sender == GUI->MoveUp_PushButton )
   {
      TreeBox::Node* node = GUI->InputImages_TreeBox.CurrentNode();
      if ( node != 0 )
      {
         int idx = GUI->InputImages_TreeBox.ChildIndex( node );
         if ( idx > 0 )
         {
            HDRCompositionInstance::ImageItem item = instance.images[idx];
            instance.images.Remove( instance.images.At( idx ) );
            instance.images.Insert( instance.images.At( idx-1 ), item );
            UpdateInputImagesList();
            GUI->InputImages_TreeBox.SetCurrentNode( GUI->InputImages_TreeBox[idx-1] );
            UpdateImageSelectionButtons();
         }
      }
   }
   else if ( sender == GUI->MoveDown_PushButton )
   {
      TreeBox::Node* node = GUI->InputImages_TreeBox.CurrentNode();
      if ( node != 0 )
      {
         int idx = GUI->InputImages_TreeBox.ChildIndex( node );
         if ( idx < int( instance.images.Length()-1 ) )
         {
            HDRCompositionInstance::ImageItem item = instance.images[idx];
            instance.images.Remove( instance.images.At( idx ) );
            instance.images.Insert( instance.images.At( idx+1 ), item );
            UpdateInputImagesList();
            GUI->InputImages_TreeBox.SetCurrentNode( GUI->InputImages_TreeBox[idx+1] );
            UpdateImageSelectionButtons();
         }
      }
   }
   else if ( sender == GUI->SelectAll_PushButton )
   {
      GUI->InputImages_TreeBox.SelectAllNodes();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->InvertSelection_PushButton )
   {
      for ( int i = 0, n = GUI->InputImages_TreeBox.NumberOfChildren(); i < n; ++i )
         GUI->InputImages_TreeBox[i]->Select( !GUI->InputImages_TreeBox[i]->IsSelected() );

      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->ToggleSelected_PushButton )
   {
      for ( int i = 0, n = GUI->InputImages_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( GUI->InputImages_TreeBox[i]->IsSelected() )
            instance.images[i].enabled = !instance.images[i].enabled;

      UpdateInputImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->RemoveSelected_PushButton )
   {
      HDRCompositionInstance::image_list newImages;
      for ( int i = 0, n = GUI->InputImages_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( !GUI->InputImages_TreeBox[i]->IsSelected() )
            newImages.Add( instance.images[i] );
      instance.images = newImages;

      UpdateInputImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->Clear_PushButton )
   {
      instance.images.Clear();
      UpdateInputImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->FullPaths_CheckBox )
   {
      UpdateInputImagesList();
      UpdateImageSelectionButtons();
   }
}
void DrizzleIntegrationInterface::__Click( Button& sender, bool checked )
{
   if ( sender == GUI->AddFiles_PushButton )
   {
      FileFilter drzFiles;
      drzFiles.SetDescription( "Drizzle Data Files" );
      drzFiles.AddExtension( ".drz" );

      OpenFileDialog d;
      d.EnableMultipleSelections();
      d.Filters().Clear();
      d.Filters().Add( drzFiles );
      d.SetCaption( "DrizzleIntegration: Select Drizzle Data Files" );
      if ( d.Execute() )
      {
         size_type i0 = TreeInsertionIndex( GUI->InputData_TreeBox );
         for ( StringList::const_iterator i = d.FileNames().Begin(); i != d.FileNames().End(); ++i )
            m_instance.p_inputData.Insert( m_instance.p_inputData.At( i0++ ), DrizzleIntegrationInstance::DataItem( *i ) );
         UpdateInputDataList();
         UpdateDataSelectionButtons();
      }
   }
   else if ( sender == GUI->SelectAll_PushButton )
   {
      GUI->InputData_TreeBox.SelectAllNodes();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->InvertSelection_PushButton )
   {
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         GUI->InputData_TreeBox[i]->Select( !GUI->InputData_TreeBox[i]->IsSelected() );
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->ToggleSelected_PushButton )
   {
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( GUI->InputData_TreeBox[i]->IsSelected() )
            m_instance.p_inputData[i].enabled = !m_instance.p_inputData[i].enabled;
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->RemoveSelected_PushButton )
   {
      DrizzleIntegrationInstance::input_data_list newImages;
      for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( !GUI->InputData_TreeBox[i]->IsSelected() )
            newImages.Add( m_instance.p_inputData[i] );
      m_instance.p_inputData = newImages;
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->Clear_PushButton )
   {
      m_instance.p_inputData.Clear();
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->FullPaths_CheckBox )
   {
      UpdateInputDataList();
      UpdateDataSelectionButtons();
   }
   else if ( sender == GUI->InputDirectory_ToolButton )
   {
      GetDirectoryDialog d;
      d.SetCaption( "DrizzleIntegration: Select Input Directory" );
      if ( d.Execute() )
         GUI->InputDirectory_Edit.SetText( m_instance.p_inputDirectory = d.Directory() );
   }
   else if ( sender == GUI->EnableRejection_CheckBox )
   {
      m_instance.p_enableRejection = checked;
   }
   else if ( sender == GUI->EnableImageWeighting_CheckBox )
   {
      m_instance.p_enableImageWeighting = checked;
   }
   else if ( sender == GUI->EnableSurfaceSplines_CheckBox )
   {
      m_instance.p_enableSurfaceSplines = checked;
   }
   else if ( sender == GUI->ClosePreviousImages_CheckBox )
   {
      m_instance.p_closePreviousImages = checked;
   }
   else if ( sender == GUI->SelectPreview_Button )
   {
      PreviewSelectionDialog d;
      if ( d.Execute() )
         if ( !d.Id().IsEmpty() )
         {
            View view = View::ViewById( d.Id() );
            if ( !view.IsNull() )
            {
               m_instance.p_roi = view.Window().PreviewRect( view.Id() );
               UpdateROIControls();
            }
         }
   }
}
void GradientsMergeMosaicInterface::__TargetImages_Click( Button& sender, bool checked )
{
   if ( sender == GUI->AddFiles_PushButton )
   {
      OpenFileDialog d;
      d.EnableMultipleSelections();
      d.LoadImageFilters();
      d.SetCaption( "GradientsMergeMosaic: Select Target Frames" );

      if ( d.Execute() )
      {
         size_type i0 = TreeInsertionIndex( GUI->TargetImages_TreeBox );
         for ( StringList::const_iterator i = d.FileNames().Begin(); i != d.FileNames().End(); ++i )
            instance.targetFrames.Insert( instance.targetFrames.At( i0++ ), GradientsMergeMosaicInstance::ImageItem( *i ) );
         UpdateTargetImagesList();
         UpdateImageSelectionButtons();
      }
   }
   else if ( sender == GUI->MoveUp_PushButton )
   {
     for (int i=0,n = GUI->TargetImages_TreeBox.NumberOfChildren(); i<n; ++i) {
       if ( GUI->TargetImages_TreeBox[i]->IsSelected() ) {
	 if(i==0) {
	   // first is selected, we cannot really do something about this
	   break;
	 } else {
	   // swap order with previous one
	   GradientsMergeMosaicInstance::ImageItem tmp=instance.targetFrames[i-1];
	   instance.targetFrames[i-1]=instance.targetFrames[i];
	   instance.targetFrames[i]=tmp;
	   GUI->TargetImages_TreeBox[i]->Select(false);
	   GUI->TargetImages_TreeBox[i-1]->Select(true);
	   UpdateTargetImageItem(i);
	   UpdateTargetImageItem(i-1);
	 }
       }
     }
     // FIXME this restores the original selection list, which is just what I dont want.
     // Added UpdateTargetImageItem() above which is slightly less efficient
     // UpdateTargetImagesList();
   }
   else if ( sender == GUI->MoveDown_PushButton )
   {
     for (int n = GUI->TargetImages_TreeBox.NumberOfChildren(),i=n-1; i>=0; --i) {
       if ( GUI->TargetImages_TreeBox[i]->IsSelected() ) {
	 if(i==n-1) {
	   // first is selected, we cannot really do something about this
	   break;
	 } else {
	   // swap order with next one
	   GradientsMergeMosaicInstance::ImageItem tmp=instance.targetFrames[i];
	   instance.targetFrames[i]=instance.targetFrames[i+1];
	   instance.targetFrames[i+1]=tmp;
	   GUI->TargetImages_TreeBox[i]->Select(false);
	   GUI->TargetImages_TreeBox[i+1]->Select(true);
	   UpdateTargetImageItem(i);
	   UpdateTargetImageItem(i+1);
	 }
       }
     }
     // FIXME this restores the original selection list, which is just what I dont want.
     // Added UpdateTargetImageItem() above which is slightly less efficient
     // UpdateTargetImagesList();
   }
   else if ( sender == GUI->SelectAll_PushButton )
   {
      GUI->TargetImages_TreeBox.SelectAllNodes();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->InvertSelection_PushButton )
   {
      for ( int i = 0, n = GUI->TargetImages_TreeBox.NumberOfChildren(); i < n; ++i )
         GUI->TargetImages_TreeBox[i]->Select( !GUI->TargetImages_TreeBox[i]->IsSelected() );
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->ToggleSelected_PushButton )
   {
      for ( int i = 0, n = GUI->TargetImages_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( GUI->TargetImages_TreeBox[i]->IsSelected() )
            instance.targetFrames[i].enabled = !instance.targetFrames[i].enabled;
      UpdateTargetImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->RemoveSelected_PushButton )
   {
      GradientsMergeMosaicInstance::image_list newTargets;
      for ( int i = 0, n = GUI->TargetImages_TreeBox.NumberOfChildren(); i < n; ++i )
         if ( !GUI->TargetImages_TreeBox[i]->IsSelected() )
            newTargets.Add( instance.targetFrames[i] );
      instance.targetFrames = newTargets;
      UpdateTargetImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->Clear_PushButton )
   {
      instance.targetFrames.Clear();
      UpdateTargetImagesList();
      UpdateImageSelectionButtons();
   }
   else if ( sender == GUI->FullPaths_CheckBox )
   {
      UpdateTargetImagesList();
      UpdateImageSelectionButtons();
   }
}