Example #1
0
void ToolWindowEdit::OnCheckDrawRange( wxCommandEvent& event )
{
  BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
  bp->SetDrawRangeEnabled( event.IsChecked() );

  UpdateTools();
}
Example #2
0
void ToolWindowEdit::DoListenToMessage ( std::string const iMsg, void* iData, void* sender )
{
  if ( iMsg == "ContourValueChanged" )
  {
    UpdateTools();
  }
}
Example #3
0
void ToolWindowEdit::OnChoiceBrushTemplate( wxCommandEvent& event )
{
  LayerVolumeBase* layer = (LayerVolumeBase*)(void*)m_choiceTemplate->GetClientData( event.GetSelection() );
  BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
  bp->SetReferenceLayer( layer );
  UpdateTools();
}
Example #4
0
void FormEdit::OpenFile()
{
	UpdateChildZ();

	FileSelector fs;
	fs.Type(t_("Form files"), "*.form");
	fs.Type(t_("Form archives"), "*.fz");
	fs.AllFilesType();

	if (!fs.ExecuteOpen(t_("Open form...")))
		return;

	Clear();
	_File = ~fs;

	bool compression = false;
	if (Upp::GetFileName(_File).Find(".fz") >= 0)
		compression = true;

	_View.LoadAll(_File, compression);
	UpdateLayoutList();
	UpdateChildZ();

	Title((t_("Form Editor")) + String(" - ") + ::GetFileName(_File));

	_Container.Set(_View, _View.GetPageRect().GetSize());
	UpdateTools();

	ProjectSaved(true);
}
Example #5
0
void ToolWindowEdit::OnCheckSmooth( wxCommandEvent& event )
{
  for ( int i = 0; i < 3; i++ )
  {
    RenderView2D* view = ( RenderView2D* )MainWindow::GetMainWindowPointer()->GetRenderView( i );
    Contour2D* c2d = view->GetContour2D();
    c2d->SetSmooth( event.IsChecked() );
  }
  UpdateTools();
}
Example #6
0
void ToolWindowEdit::OnEditExcludeRangeHigh( wxCommandEvent& event )
{
  double value;
  if ( m_editExcludeRangeHigh->GetValue().ToDouble( &value ) )
  {
    BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
    double* range = bp->GetExcludeRange();
    bp->SetExcludeRange( range[0], value );
    UpdateTools();
  }
}
Example #7
0
void ToolWindowEdit::OnEditDrawRangeLow( wxCommandEvent& event )
{
  double value;
  if ( m_editDrawRangeLow->GetValue().ToDouble( &value ) )
  {
    BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
    double* range = bp->GetDrawRange();
    bp->SetDrawRange( value, range[1] );
    UpdateTools();
  }
}
Example #8
0
void FormEdit::DockInit()
{
	WindowButtons(false, false, true);

	DockLeft(Dockable(_LayoutList, t_("Layouts")).SizeHint(Size(200, 200)));
	DockRight(Dockable(_ItemList, t_("Items")).SizeHint(Size(250, 200)));
	DockRight(Dockable(_ItemProperties, t_("Item properties")).SizeHint(Size(250, 300)));

	if (!FileExists(ConfigFile("Layouts.bin")))
		SaveLayout(t_(" Default"));
	LoadGUILayouts(true);
	UpdateTools();
	UpdateGUILayout();
}
Example #9
0
void ToolWindowEdit::OnEditSmoothSD( wxCommandEvent& event )
{
  double value;

  if (m_editSmoothSD != NULL)
  {
    if ( m_editSmoothSD->GetValue().ToDouble( &value ) && value > 0 )
    {
      for ( int i = 0; i < 3; i++ )
      {
        RenderView2D* view = ( RenderView2D* )MainWindow::GetMainWindowPointer()->GetRenderView( i );
        Contour2D* c2d = view->GetContour2D();
        c2d->SetSmoothSD( value );
      }
      UpdateTools();
    }
  }
}
Example #10
0
void ToolWindowEdit::OnEditContourValue( wxCommandEvent& event )
{
  double value;
  if ( m_editContourValue->GetValue().ToDouble( &value ) && value > 0 )
  {
    BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
    LayerMRI* mri = (LayerMRI*)bp->GetReferenceLayer();
    for ( int i = 0; i < 3; i++ )
    {
      RenderView2D* view = ( RenderView2D* )MainWindow::GetMainWindowPointer()->GetRenderView( i );
      Contour2D* c2d = view->GetContour2D();
      if ( c2d->GetInputImage() )
        c2d->SetContourValue( value );
      else if ( mri )
      {
        c2d->SetInput( mri->GetSliceImageData( view->GetViewPlane() ), value, mri->GetSlicePosition()[i], mri->GetActiveFrame() ); 
        c2d->SetVisible( true );
      }
    }
    UpdateTools();
  }
}
Example #11
0
void ToolWindowEdit::OnActionVoxelContour( wxCommandEvent& event )
{
  MainWindow::GetMainWindowPointer()->SetAction( Interactor2DVoxelEdit::EM_Contour );
  BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();  
  LayerMRI* layer = (LayerMRI*)MainWindow::GetMainWindowPointer()->GetActiveLayer( "MRI" );
  if ( layer && layer->GetProperties()->GetColorMap() == LayerPropertiesMRI::LUT )
    layer->GetProperties()->SetShowLabelOutline( true );
  
  if ( !bp->GetReferenceLayer() )
  {
    LayerCollection* lc_mri = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
    for ( int i = 0; i < lc_mri->GetNumberOfLayers(); i++ )
    {
      LayerMRI* mri = (LayerMRI*)lc_mri->GetLayer( i );
      if ( mri->GetProperties()->GetColorMap() != LayerPropertiesMRI::LUT && mri->IsVisible() && mri != layer )
      {
        bp->SetReferenceLayer( mri );
        break;
      }
    }
  }
  UpdateTools();
}
Example #12
0
void ToolWindowEdit::OnSpinBrushTolerance( wxSpinEvent& event )
{
  BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty();
  bp->SetBrushTolerance( event.GetInt() );
  UpdateTools();
}
Example #13
0
void ToolWindowEdit::OnActionVoxelColorPicker( wxCommandEvent& event )
{
  MainWindow::GetMainWindowPointer()->SetAction( Interactor2DVoxelEdit::EM_ColorPicker );
  UpdateTools();
}
Example #14
0
void ToolWindowEdit::OnActionVoxelFill( wxCommandEvent& event )
{
  MainWindow::GetMainWindowPointer()->SetAction( Interactor2DVoxelEdit::EM_Fill );
  MainWindow::GetMainWindowPointer()->GetBrushProperty()->SetReferenceLayer( NULL );
  UpdateTools();
}
Example #15
0
void ToolWindowEdit::OnActionVoxelLivewire( wxCommandEvent& event )
{
  MainWindow::GetMainWindowPointer()->SetAction( Interactor2DVoxelEdit::EM_Livewire );
  UpdateTools();
}
Example #16
0
void ToolWindowEdit::OnActionROIFill( wxCommandEvent& event )
{
  MainWindow::GetMainWindowPointer()->SetAction( Interactor2DROIEdit::EM_Fill );
  UpdateTools();
}
Example #17
0
FormEdit::FormEdit()
{
	Title(t_("GUI Form Editor (c) Web\'n\'soft Group"));
	Sizeable().MinimizeBox().MaximizeBox();
	SetRect(GetWorkArea().CenterRect(1000, 700));

	_ToolSize = Size(HorzLayoutZoom(240), VertLayoutZoom(18));

	MultiButton::SubButton* b = &_GUILayouts.AddButton();
	b->SetImage(FormEditImg::AddGuiLayout());
	*b <<= THISBACK(AddGUILayout);
	b->Left();
	b = &_GUILayouts.AddButton();
	b->SetImage(FormEditImg::RemoveGuiLayout());
	*b <<= THISBACK(RemoveGUILayout);
	b->Left();

	b = &_GUILayouts.AddButton();
	b->Tip(t_("Lock interface..."));
	b->SetImage(FormEditImg::Locking());
	*b <<= THISBACK(ToggleLayoutLock);

	b = &_GUILayouts.AddButton();
	b->Tip(t_("Save layout"));
	b->SetImage(FormEditImg::SaveLayout());
	*b <<= THISBACK(SaveGUILayout);

	_GUILayouts.WhenAction = THISBACK(UpdateGUILayout);

	StdFontZoom();

	_ViewMode = VIEW_MODE_AS_IS;

	AddFrame(_MenuBar);
	AddFrame(TopSeparatorFrame());
	AddFrame(_ToolBar);

	Add(_CtrlContainer.SizePos());
	Add(_Container.SizePos());
	_View.Transparent();

	_Container.Set(_View, _View.GetPageRect().GetSize());

	_ItemProperties.WhenChildZ = THISBACK(UpdateChildZ);

	_View.SetContainer(_Container);
	_View.WhenUpdate = THISBACK(UpdateTools);
	_View.WhenObjectProperties = THISBACK(OpenObjectProperties);
	_View.WhenChildSelected = THISBACK(UpdateChildProperties);
	_View.WhenUpdateLayouts = THISBACK(UpdateLayoutList);
	_View.WhenChildAllPos = THISBACK(UpdateChildAllPos);
	_View.WhenChildCount = THISBACK(UpdateChildCount);
	_View.WhenUpdateTabs = THISBACK(UpdateTabCtrls);
	_View.WhenChildPos = THISBACK(UpdateChildPos);
	_View.WhenMenuBar = THISBACK(CreateToolBar);
	_View.WhenChildZ = THISBACK(UpdateChildZ);

	SetViewMode(VIEW_MODE_INFO);
	UpdateTools();

	_LayoutList.Appending().Removing().Editing().SetFrame(NullFrame());
	_LayoutList.AddColumn(t_("Name")).Edit(_LayoutNameField);
	_LayoutList.HideRow(0);
	_LayoutList.SetInfoOffset(0);
	_LayoutList.SetInfo(t_("No lays"));
	_LayoutList.NotUseKeys();
	_LayoutList.WhenNewRow = THISBACK(OnAddLayout);
	_LayoutList.WhenChangeRow = THISBACK(OnSelectLayout);
	_LayoutList.WhenUpdateRow = THISBACK(OnUpdateLayout);
	_LayoutList.WhenRemoveRow = THISBACK(OnRemoveLayout);

	_ItemList.Editing().EditMode(1).MultiSelect().SetFrame(NullFrame());
	_ItemList.AddColumn(t_("Type")).Edit(_TypeList);
	_ItemList.AddColumn(t_("Variable")).Edit(_ObjectNameField);
	_ItemList.SetInfo(t_("No items"));
	_ItemList.WhenMenuBar = THISBACK(CreateObjectMenu);
	_ItemList.WhenChangeRow = THISBACK(SelectItem);
	_ItemList.WhenLeftClick = THISBACK(SelectItem);
	_ItemList.NotUseKeys();
	_TypeList.Add("Button");
	_TypeList.Add("Label");
	_TypeList.Add("EditField");
	_TypeList.Add("EditInt");
	_TypeList.Add("DropDate");
	_TypeList.Add("TabCtrl");
	_TypeList.Add("GridCtrl");
	_TypeList.Add("ProgressBar");
	_TypeList.Add("Form");
	_TypeList.WhenAction = THISBACK(UpdateObjectType);
	_ItemList.WhenUpdateRow = THISBACK(UpdateObjectName);
	_ObjectNameField.WhenAction = THISBACK(UpdateTempObjectName);
#ifdef PLATFORM_WIN32
	_ItemList.Chameleon();
#endif

	_ItemProperties.SetFrame(NullFrame());

	NewFile();
}