Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
sarah.grebing
ProofScriptParser
Commits
b64e83ad
Commit
b64e83ad
authored
Dec 11, 2018
by
Lulu Luong
Browse files
View Settings implemented
parent
b005da8a
Pipeline
#34872
passed with stages
in 2 minutes and 17 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.java
View file @
b64e83ad
...
@@ -151,6 +151,8 @@ public class DebuggerMain implements Initializable {
...
@@ -151,6 +151,8 @@ public class DebuggerMain implements Initializable {
@FXML
@FXML
private
CheckMenuItem
miScriptTree
;
private
CheckMenuItem
miScriptTree
;
@FXML
@FXML
private
CheckMenuItem
miViewSettings
;
@FXML
private
ToggleButton
btnInteractiveMode
;
private
ToggleButton
btnInteractiveMode
;
@FXML
@FXML
...
@@ -177,6 +179,8 @@ public class DebuggerMain implements Initializable {
...
@@ -177,6 +179,8 @@ public class DebuggerMain implements Initializable {
private
InteractiveModeController
interactiveModeController
;
private
InteractiveModeController
interactiveModeController
;
private
ScriptExecutionController
scriptExecutionController
;
private
ScriptExecutionController
scriptExecutionController
;
private
ViewSettings
viewSettings
;
@FXML
@FXML
private
Menu
examplesMenu
;
private
Menu
examplesMenu
;
private
Timer
interpreterThreadTimer
;
private
Timer
interpreterThreadTimer
;
...
@@ -410,6 +414,8 @@ public class DebuggerMain implements Initializable {
...
@@ -410,6 +414,8 @@ public class DebuggerMain implements Initializable {
savePointController
=
new
SavePointController
(
this
);
savePointController
=
new
SavePointController
(
this
);
viewSettings
=
new
ViewSettings
(
this
);
}
}
/**
/**
...
@@ -1376,6 +1382,16 @@ public class DebuggerMain implements Initializable {
...
@@ -1376,6 +1382,16 @@ public class DebuggerMain implements Initializable {
stage
.
show
();
stage
.
show
();
}
}
@FXML
public
void
showViewSettings
(
ActionEvent
actionEvent
)
{
Stage
stage
=
new
Stage
();
stage
.
setTitle
(
"View Settings"
);
Scene
scene
=
(
viewSettings
.
getScene
()
==
null
)
?
new
Scene
(
viewSettings
)
:
viewSettings
.
getScene
();
stage
.
setScene
(
scene
);
stage
.
show
();
}
public
DockNode
getJavaAreaDock
()
{
public
DockNode
getJavaAreaDock
()
{
return
javaAreaDock
;
return
javaAreaDock
;
}
}
...
...
ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ViewSettings.java
View file @
b64e83ad
package
edu.kit.iti.formal.psdbg.gui.controls
;
package
edu.kit.iti.formal.psdbg.gui.controls
;
import
edu.kit.iti.formal.psdbg.gui.controller.DebuggerMain
;
import
edu.kit.iti.formal.psdbg.gui.controller.DebuggerMain
;
import
javafx.event.ActionEvent
;
import
javafx.event.EventHandler
;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXML
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.TextField
;
import
javafx.scene.layout.BorderPane
;
import
javafx.scene.layout.BorderPane
;
import
java.util.Set
;
/**
* View to change font sizes
*
* @author An.Luong
*/
public
class
ViewSettings
extends
BorderPane
{
public
class
ViewSettings
extends
BorderPane
{
/*
TODO: Changeable View
- ScriptArea
- Contextmenu
- Sequentview
- JavaCode
*/
@FXML
@FXML
private
TextField
scriptAreaSize
;
private
TextField
scriptAreaSize
;
...
@@ -38,7 +40,114 @@ public class ViewSettings extends BorderPane {
...
@@ -38,7 +40,114 @@ public class ViewSettings extends BorderPane {
@FXML
@FXML
private
Button
reset
;
private
Button
reset
;
private
DebuggerMain
dm
;
final
private
float
OLD_SCRIPTSIZE
=
16
;
// -fx-font-size: 16pt;
final
private
float
OLD_CONTEXTMENUSIZE
=
12
;
final
private
float
OLD_SEQUENTSIZE
=
21
;
final
private
float
OLD_JAVACODESIZE
=
16
;
public
ViewSettings
(
DebuggerMain
dm
)
{
public
ViewSettings
(
DebuggerMain
dm
)
{
Utils
.
createWithFXML
(
this
);
this
.
dm
=
dm
;
scriptAreaSize
.
setText
(
Float
.
toString
(
OLD_SCRIPTSIZE
));
contextAreaSize
.
setText
(
Float
.
toString
(
OLD_CONTEXTMENUSIZE
));
sequentSize
.
setText
(
Float
.
toString
(
OLD_SEQUENTSIZE
));
javaCodeSize
.
setText
(
Float
.
toString
(
OLD_JAVACODESIZE
));
// add action listeners
apply
.
setOnAction
(
new
EventHandler
<
ActionEvent
>()
{
@Override
public
void
handle
(
ActionEvent
e
)
{
applyChanges
();
}
});
reset
.
setOnAction
(
new
EventHandler
<
ActionEvent
>()
{
@Override
public
void
handle
(
ActionEvent
e
)
{
resetChanges
();
}
});
}
private
void
applyChanges
()
{
float
allSizes_f
;
float
scriptAreaSize_f
;
float
contextAreaSize_f
;
float
sequentSize_f
;
float
javaCodeSize_f
;
if
(
allSizes
.
getText
().
equals
(
""
))
{
try
{
scriptAreaSize_f
=
Float
.
parseFloat
(
scriptAreaSize
.
getText
());
contextAreaSize_f
=
Float
.
parseFloat
(
contextAreaSize
.
getText
());
sequentSize_f
=
Float
.
parseFloat
(
sequentSize
.
getText
());
javaCodeSize_f
=
Float
.
parseFloat
(
javaCodeSize
.
getText
());
}
catch
(
NumberFormatException
e
)
{
Utils
.
showInfoDialog
(
"Not a float"
,
"Not a float"
,
"At least one entry is not a float. \n "
+
"Hint: Decimal points are declared with '.' ."
);
return
;
}
setFontSizes
(
scriptAreaSize_f
,
contextAreaSize_f
,
sequentSize_f
,
javaCodeSize_f
);
}
else
{
try
{
allSizes_f
=
Float
.
parseFloat
(
allSizes
.
getText
());
}
catch
(
NumberFormatException
e
)
{
Utils
.
showInfoDialog
(
"Not a float"
,
"Not a float"
,
"Entry in 'All font sizes' is not a float. \n "
+
"Hint: Decimal points are declared with '.' ."
);
return
;
}
scriptAreaSize
.
setText
(
allSizes_f
+
""
);
contextAreaSize
.
setText
(
allSizes_f
+
""
);
sequentSize
.
setText
(
allSizes_f
+
""
);
javaCodeSize
.
setText
(
allSizes_f
+
""
);
setFontSizes
(
allSizes_f
,
allSizes_f
,
allSizes_f
,
allSizes_f
);
}
/*TODO:
what if flaot = 4.5654234 or 1230
*/
}
private
void
setFontSizes
(
float
scriptarea_f
,
float
contextmenu_f
,
float
sequent_f
,
float
javacode_f
)
{
final
String
SETFONT_START
=
"-fx-font-size: "
;
final
String
SETFONT_END
=
" pt;"
;
// Set font size for open script areas
Set
<
ScriptArea
>
scriptareas
=
dm
.
getScriptController
().
getOpenScripts
().
keySet
();
if
(
scriptareas
.
size
()
!=
0
)
{
scriptareas
.
forEach
(
k
->
k
.
setStyle
(
SETFONT_START
+
scriptarea_f
+
SETFONT_END
));
}
// Set font size for the context menu
if
(
dm
.
getInspectionViewsController
().
getActiveInspectionViewTab
()
!=
null
)
{
dm
.
getInspectionViewsController
().
getActiveInspectionViewTab
().
setStyle
(
SETFONT_START
+
contextmenu_f
+
SETFONT_END
);
}
// Set font size for the sequent
if
(
dm
.
getInspectionViewsController
().
getActiveInspectionViewTab
().
getSequentView
()
!=
null
)
{
dm
.
getInspectionViewsController
().
getActiveInspectionViewTab
().
getSequentView
().
setStyle
(
SETFONT_START
+
sequent_f
+
SETFONT_END
);
}
// Set font size for the java code
if
(
dm
.
getJavaAreaDock
().
getContents
()
!=
null
)
{
dm
.
getJavaAreaDock
().
getContents
().
setStyle
(
SETFONT_START
+
javacode_f
+
SETFONT_END
);
}
}
private
void
resetChanges
()
{
allSizes
.
setText
(
""
);
scriptAreaSize
.
setText
(
Float
.
toString
(
OLD_SCRIPTSIZE
));
contextAreaSize
.
setText
(
Float
.
toString
(
OLD_CONTEXTMENUSIZE
));
sequentSize
.
setText
(
Float
.
toString
(
OLD_SEQUENTSIZE
));
javaCodeSize
.
setText
(
Float
.
toString
(
OLD_JAVACODESIZE
));
}
}
}
}
ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controller/DebuggerMain.fxml
View file @
b64e83ad
...
@@ -208,7 +208,10 @@
...
@@ -208,7 +208,10 @@
<MaterialDesignIconView
glyphName=
"STACKEXCHANGE"
size=
"24.0"
/>
<MaterialDesignIconView
glyphName=
"STACKEXCHANGE"
size=
"24.0"
/>
</graphic>
</graphic>
</CheckMenuItem>
</CheckMenuItem>
</items>
<CheckMenuItem
fx:id=
"miViewSettings"
onAction=
"#showViewSettings"
text=
"View Settings"
/>
</items>
</Menu>
</Menu>
<Menu
fx:id=
"examplesMenu"
text=
"_Examples"
>
<Menu
fx:id=
"examplesMenu"
text=
"_Examples"
>
<items>
<items>
...
...
ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controls/ViewSettings.fxml
View file @
b64e83ad
...
@@ -2,8 +2,52 @@
...
@@ -2,8 +2,52 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<fx:root
type=
"javafx.scene.layout.BorderPane"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:id=
"rootPane"
<fx:root
type=
"javafx.scene.layout.BorderPane"
xmlns:fx=
"http://javafx.com/fxml/1"
fx:id=
"rootPane"
xmlns=
"http://javafx.com/javafx/8.0.112"
>
xmlns=
"http://javafx.com/javafx/8.0.112
"
>
<center>
<GridPane
alignment=
"center"
hgap=
"10"
vgap=
"10"
>
<padding>
<Insets
top=
"25"
right=
"25"
bottom=
"25"
left=
"25"
/>
</padding>
<Text
text=
"All font sizes:"
style=
"-fx-font-weight: bold;"
GridPane.columnIndex=
"0"
GridPane.rowIndex=
"0"
></Text>
<TextField
fx:id=
"allSizes"
GridPane.columnIndex=
"1"
GridPane.rowIndex=
"0"
></TextField>
<Text
text=
"Edit font size"
style=
"-fx-font-weight: bold;"
GridPane.rowIndex=
"2"
></Text>
<Text
text=
"Script Area:"
GridPane.columnIndex=
"0"
GridPane.rowIndex=
"3"
></Text>
<TextField
fx:id=
"scriptAreaSize"
GridPane.columnIndex=
"1"
GridPane.rowIndex=
"3"
></TextField>
<Text
text=
"Context Area:"
GridPane.columnIndex=
"0"
GridPane.rowIndex=
"4"
></Text>
<TextField
fx:id=
"contextAreaSize"
GridPane.columnIndex=
"1"
GridPane.rowIndex=
"4"
></TextField>
<Text
text=
"Sequent:"
GridPane.columnIndex=
"0"
GridPane.rowIndex=
"5"
></Text>
<TextField
fx:id=
"sequentSize"
GridPane.columnIndex=
"1"
GridPane.rowIndex=
"5"
></TextField>
<Text
text=
"Java Code:"
GridPane.columnIndex=
"0"
GridPane.rowIndex=
"6"
></Text>
<TextField
fx:id=
"javaCodeSize"
GridPane.columnIndex=
"1"
GridPane.rowIndex=
"6"
></TextField>
</GridPane>
</center>
<bottom>
<BorderPane>
<padding>
<Insets
top=
"5"
right=
"25"
bottom=
"15"
left=
"25"
/>
</padding>
<left>
<Button
fx:id=
"reset"
text=
"Reset"
></Button>
</left>
<right>
<Button
fx:id=
"apply"
text=
"Apply"
></Button>
</right>
</BorderPane>
</bottom>
</fx:root>
</fx:root>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment