package Visual_DVM_2021.UI.Main;
import Common.Global;
import Visual_DVM_2021.UI.Interface.DebugWindow;
import Visual_DVM_2021.UI.Interface.FormWithSplitters;

import javax.swing.*;
public class DebugForm implements DebugWindow, FormWithSplitters {
    private JPanel content;
    public JSplitPane SC51;
    public JSplitPane SC40;
    public JTabbedPane debugTabs;
    public JSplitPane SC41;
    public JSplitPane SC20;
    public JSplitPane SC52;
    public JSplitPane SC42;
    public JSplitPane SC43;
    public JSplitPane SC21;
    public JSplitPane SC35;
    private JPanel compilationTasksPanel;
    private JPanel makefilesPanel;
    private JPanel modulesPanel;
    private JPanel runTasksPanel;
    private JPanel runConfigurationsPanel;
    private JPanel environmentsPanel;
    private JPanel dvmParametersPanel;
    //--
    //-
    public RunTasksComparisonForm singleRunTaskMaster; // одиночные запуски
    public RunTasksComparisonForm singleRunTaskSlave;
    //
    public CompilationTasksComparisonForm singleCompilationTaskMaster; // одиночная компиляция
    public CompilationTasksComparisonForm singleCompilationTaskSlave;
    //--
    //--
    @Override
    public JPanel getContent() {
        return content;
    }
    @Override
    public void DropRunTasksComparison() {
        singleRunTaskMaster.RemoveObject();
        singleRunTaskSlave.RemoveObject();
    }
    @Override
    public void DropCompilationTasksComparison() {
        singleCompilationTaskMaster.RemoveObject();
        singleCompilationTaskSlave.RemoveObject();
    }
    @Override
    public void ShowLastCompilationTask() {
        singleCompilationTaskMaster.ApplyObject();
    }
    @Override
    public void ShowLastRunTask() {
        singleRunTaskMaster.ApplyObject();
    }
    @Override
    public void ShowCurrentRunTask() {
         //  if (singleRunTaskMaster.isActive()) singleRunTaskMaster.ShowTask();
         //  else singleRunTaskSlave.ShowTask();
    }
    @Override
    public void ShowNoCurrentRunTask() {
         // if (singleRunTaskMaster.isActive()) singleRunTaskMaster.Clear();
         // else singleRunTaskSlave.Clear();
    }
    //-
    @Override
    public void ShowAll() {
        Global.db.makefiles.ShowUI();
        Global.db.runConfigurations.ShowUI();
        Global.db.compilationTasks.ShowUI(); //их видимость зависит от текущего проекта.
        Global.db.runTasks.ShowUI();
    }
    public DebugForm(){
        LoadSplitters();
        //--
        Global.db.makefiles.mountUI(makefilesPanel);
        Global.db.modules.mountUI(modulesPanel);
        Global.db.runConfigurations.mountUI(runConfigurationsPanel);
        Global.db.environmentValues.mountUI(environmentsPanel);
        Global.db.dvmParameters.mountUI(dvmParametersPanel);
        //-
        Global.db.compilationTasks.mountUI(compilationTasksPanel);
        Global.db.runTasks.mountUI(runTasksPanel);
        //--
        singleCompilationTaskMaster = new CompilationTasksComparisonForm(singleCompilationTaskSlave = new CompilationTasksComparisonForm(null));
        singleRunTaskMaster = new RunTasksComparisonForm(singleRunTaskSlave = new RunTasksComparisonForm(null));
        //--
        //-
        SC41.setLeftComponent(singleCompilationTaskMaster.getContent());
        SC41.setRightComponent(singleCompilationTaskSlave.getContent());
        SC43.setLeftComponent(singleRunTaskMaster.getContent());
        SC43.setRightComponent(singleRunTaskSlave.getContent());
    }
}
