Skip to content

Commit

Permalink
Prepared fix for issue #1005.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Nov 28, 2023
1 parent a518c77 commit d72a77f
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class OptionsDesign extends ApplicationWindow {
NButton[] btnDisableMAD3DPtr = new NButton[1];
NButton[] btnDisableMADtextPtr = new NButton[1];
NButton[] btnInvertInvertWheelZoomDirectionPtr = new NButton[1];
NButton[] btnShowAxisLabelsPtr = new NButton[1];
NButton[] btnOkPtr = new NButton[1];

final Combo[] cmbTextWinArrPtr = new Combo[1];
Expand Down Expand Up @@ -208,6 +209,11 @@ protected Control createContents(Composite parent) {
this.btnDisableMADtextPtr[0] = btnDisableMADtext;
btnDisableMADtext.setText(I18n.OPTIONS_MAD_2);
btnDisableMADtext.setSelection(userSettings.isDisableMADtext());

NButton btnShowAxisLabels = new NButton(cmpContainer, SWT.CHECK);
this.btnShowAxisLabelsPtr[0] = btnShowAxisLabels;
btnShowAxisLabels.setText(I18n.KEYBOARD_SHOW_AXIS_LABELS);
btnShowAxisLabels.setSelection(userSettings.isShowingAxisLabels());

{
Label lblSeparator = new Label(cmpContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
Expand Down Expand Up @@ -412,6 +418,7 @@ protected Control createContents(Composite parent) {
btnInvertInvertWheelZoomDirection.setText(I18n.KEYBOARD_INVERT_WHEEL_ZOOM_DIRECTION);
btnInvertInvertWheelZoomDirection.setSelection(userSettings.isInvertingWheelZoomDirection());


{
Label lblSeparator = new Label(cmpContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
lblSeparator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
Expand Down
14 changes: 14 additions & 0 deletions src/org/nschmidt/ldparteditor/dialog/options/OptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
import org.nschmidt.ldparteditor.enumtype.Colour;
import org.nschmidt.ldparteditor.enumtype.LDConfig;
import org.nschmidt.ldparteditor.enumtype.MyLanguage;
import org.nschmidt.ldparteditor.enumtype.Threshold;
Expand All @@ -38,6 +39,7 @@ public OptionsDialog(Shell parentShell) {
super(parentShell);
}

@SuppressWarnings("java:S2696")
public void run() {
final OptionsDialog me = this;
this.setBlockOnOpen(true);
Expand All @@ -58,6 +60,18 @@ public void run() {
widgetUtil(btnDisableMAD3DPtr[0]).addSelectionListener(e -> WorkbenchManager.getUserSettingState().setDisableMAD3D(btnDisableMAD3DPtr[0].getSelection()));
widgetUtil(btnDisableMADtextPtr[0]).addSelectionListener(e -> WorkbenchManager.getUserSettingState().setDisableMADtext(btnDisableMADtextPtr[0].getSelection()));
widgetUtil(btnInvertInvertWheelZoomDirectionPtr[0]).addSelectionListener(e -> WorkbenchManager.getUserSettingState().setInvertingWheelZoomDirection(btnInvertInvertWheelZoomDirectionPtr[0].getSelection()));
widgetUtil(btnShowAxisLabelsPtr[0]).addSelectionListener(e -> {
WorkbenchManager.getUserSettingState().setShowingAxisLabels(btnShowAxisLabelsPtr[0].getSelection());
if (WorkbenchManager.getUserSettingState().isShowingAxisLabels()) {
Colour.textColourR = 1.0f;
Colour.textColourG = 0.75f;
Colour.textColourB = 0.80f;
} else {
Colour.textColourR = 0f;
Colour.textColourG = 0f;
Colour.textColourB = 0f;
}
});

widgetUtil(btnBrowseLdrawPathPtr[0]).addSelectionListener(e -> {
DirectoryDialog dlg = new DirectoryDialog(getShell());
Expand Down
1 change: 1 addition & 0 deletions src/org/nschmidt/ldparteditor/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ private static void adjust() { // Calculate line offset
public static final String KEYBOARD_SELECT_TOUCHING = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SHIFT = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SHORTKEY = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SHOW_AXIS_LABELS = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SHOW_GRID = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SHOW_RULER = KEYBOARD.getString(getProperty());
public static final String KEYBOARD_SPLIT = KEYBOARD.getString(getProperty());
Expand Down
1 change: 1 addition & 0 deletions src/org/nschmidt/ldparteditor/i18n/Keyboard.properties
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ SELECT_OPTION_WITH_SAME_COLOURS = Toggles Colour Sensitive Selection \
SELECT_TOUCHING = Select Touching
SHIFT = Shift
SHORTKEY = Shortkey
SHOW_AXIS_LABELS = Show Axis Labels
SHOW_GRID = Toggle Grid
SHOW_RULER = Toggle Ruler
SPLIT = Split Selected Edge
Expand Down
2 changes: 1 addition & 1 deletion src/org/nschmidt/ldparteditor/opengl/OpenGLRenderer20.java
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ else if (zoom > 1.0E-2)
new Arrow(Colour.zAxisColourR, Colour.zAxisColourG, Colour.zAxisColourB, 0f, 0f, l, cone_height, cone_width, line_width).drawGL20(0f, 0f, 0f, .01f);
GL11.glPopMatrix();

if (true || userSettings.isShowingAxisLabels()) {
if (userSettings.isShowingAxisLabels()) {
final float l20th = l / 20f;
GL11.glPushMatrix();
final Vector4f xAxis = new Vector4f(l20th, 0f, 0f, 1f);
Expand Down
34 changes: 34 additions & 0 deletions src/org/nschmidt/ldparteditor/opengl/OpenGLRenderer33.java
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,40 @@ else if (zoom > 1.0E-2)
new Arrow(Colour.yAxisColourR, Colour.yAxisColourG, Colour.yAxisColourB, 0f, l, 0f, cone_height, cone_width, line_width).drawGL33rgb(stack, 0f, 0f, 0f, .01f);
new Arrow(Colour.zAxisColourR, Colour.zAxisColourG, Colour.zAxisColourB, 0f, 0f, l, cone_height, cone_width, line_width).drawGL33rgb(stack, 0f, 0f, 0f, .01f);
stack.glPopMatrix();

if (userSettings.isShowingAxisLabels()) {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
final float l20th = l / 20f;

final Vector4f xAxis = new Vector4f(l20th, 0f, 0f, 1f);
final Vector4f yAxis = new Vector4f(0f, l20th, 0f, 1f);
final Vector4f zAxis = new Vector4f(0f, 0f, l20th, 1f);

Matrix4f.transform(c3d.getRotation(), xAxis, xAxis);
Matrix4f.transform(c3d.getRotation(), yAxis, yAxis);
Matrix4f.transform(c3d.getRotation(), zAxis, zAxis);

PGData3.beginDrawTextGL33(shaderProgram2D);
stack.setShader(shaderProgram2D);
stack.glLoadIdentity();
stack.glTranslatef(ox - viewportWidth, viewportHeight - oy, 0f);
for (PGData3 tri : View.X) {
tri.drawTextGL33(xAxis.x, xAxis.y, viewportOriginAxis[0].z);
}

for (PGData3 tri : View.Y) {
tri.drawTextGL33(yAxis.x, yAxis.y, viewportOriginAxis[0].z);
}

for (PGData3 tri : View.Z) {
tri.drawTextGL33(zAxis.x, zAxis.y, viewportOriginAxis[0].z);
}
PGData3.endDrawTextGL33(shaderProgram2);
stack.setShader(shaderProgram2);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
GL11.glDisable(GL11.GL_DEPTH_TEST);
if (c3d.isShowingLabels() && c3d.isClassicPerspective()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void drawScene(float mouseX, float mouseY) {
new Arrow(Colour.zAxisColourR, Colour.zAxisColourG, Colour.zAxisColourB, 0f, 0f, .5f,.00015f, .00004f, 2f).drawGL20(0f, 0f, 0f, .01f);
GL11.glPopMatrix();

if (true || userSettings.isShowingAxisLabels()) {
if (userSettings.isShowingAxisLabels()) {
final float l20th = .025f;
GL11.glPushMatrix();
final Vector4f xAxis = new Vector4f(-l20th, 0f, 0f, 1f);
Expand Down

0 comments on commit d72a77f

Please sign in to comment.