Сворачивание левой панели графов файла

This commit is contained in:
2024-03-17 01:55:10 +03:00
parent 4e611e4333
commit 2a2000147c
15 changed files with 216 additions and 83 deletions

View File

@@ -66,14 +66,13 @@ public class FileForm implements FileWindow, FormWithSplitters {
private TreeForm arraysForm;
//-
private SPFEditor Body = null; //времянка? не очень красиво.
FileMenuBar menuBar = null;
//-
public FileForm(DBProjectFile file_in) {
LoadSplitters();
//--
MessageWarning.filterValue = "";
MessageError.filterValue = "";
MessageNote.filterValue="";
MessageNote.filterValue = "";
//-
file = file_in;
file.father.db.notes.mountUI(notesPanel);
@@ -90,13 +89,17 @@ public class FileForm implements FileWindow, FormWithSplitters {
ShowGCOVLog();
ShowAllAnalyses();
Body.addCaretListener(ce -> ShowCaretInfo());
editorPanel.add(menuBar = new FileMenuBar(Body), BorderLayout.NORTH);
editorPanel.add(UI.fileMenuBar = new FileMenuBar(Body), BorderLayout.NORTH);
ShowCaretInfo();
Body.requestFocus();
RefreshTabsNames();
menuBar.sToGo.addChangeListener(e -> Body.gotoLine((Integer) menuBar.sToGo.getValue()));
UI.fileMenuBar.sToGo.addChangeListener(e -> Body.gotoLine((Integer) UI.fileMenuBar.sToGo.getValue()));
ShowProperties();
Pass_2021.passes.get(PassCode_2021.Save).setControlsEnabled(false);
//-
UI.fileMenuBar.LeftECButton.Switch(Global.properties.collapseFileGraphs);
if (Global.properties.collapseFileGraphs)
CollapseGraphs();
}
@Override
public void ShowLanguage() {
@@ -116,11 +119,11 @@ public class FileForm implements FileWindow, FormWithSplitters {
Body.setSyntaxEditingStyle(file.languageName.getStyleKey());
Body.setCodeFoldingEnabled(true);
Body.switching_language = false;
menuBar.ShowLanguage();
UI.fileMenuBar.ShowLanguage();
}
@Override
public void ShowType() {
menuBar.ShowType();
UI.fileMenuBar.ShowType();
}
@Override
public void ShowStyle() {
@@ -143,7 +146,7 @@ public class FileForm implements FileWindow, FormWithSplitters {
}
}
Body.switching_language = false;
menuBar.ShowStyle();
UI.fileMenuBar.ShowStyle();
}
@Override
public SPFEditorInterface getEditor() {
@@ -295,12 +298,12 @@ public class FileForm implements FileWindow, FormWithSplitters {
int new_current_line = Body.getCurrentLine();
boolean line_changed = (new_current_line != current_file_line);
current_file_line = new_current_line;
menuBar.sToGo.setModel(new SpinnerNumberModel(current_file_line,
UI.fileMenuBar.sToGo.setModel(new SpinnerNumberModel(current_file_line,
1, Body.getLineCount(), 1
));
//-
menuBar.ShowLinesCount();
menuBar.CurrentSymbolLabel.setText(String.valueOf(Body.getCurrentSymbol()));
UI.fileMenuBar.ShowLinesCount();
UI.fileMenuBar.CurrentSymbolLabel.setText(String.valueOf(Body.getCurrentSymbol()));
//если выделяем строку из графа, то тоже надо отключиьт события.
//чтобы по ней не начался поиск.
if (events_on && line_changed) {
@@ -359,4 +362,32 @@ public class FileForm implements FileWindow, FormWithSplitters {
public JPanel getContent() {
return content;
}
//--
@Override
public void CollapseGraphs() {
UI.Clear(graphsBackground);
SC12.setDividerLocation(0);
SC12.setDividerSize(0);
graphsBackground.revalidate();
graphsBackground.repaint();
}
@Override
public void ExpandGraphs() {
UI.Clear(graphsBackground);
graphsBackground.add(graphsTabs);
SC12.setDividerLocation(200);
SC12.setDividerSize(3);
graphsBackground.revalidate();
graphsBackground.repaint();
}
@Override
public void SwitchGraphs() {
if (Global.properties.collapseFileGraphs)
ExpandGraphs();
else
CollapseGraphs();
Global.properties.collapseFileGraphs =!Global.properties.collapseFileGraphs;
Global.properties.Update();
UI.fileMenuBar.LeftECButton.Switch(Global.properties.collapseFileGraphs);
}
}