Skip to content
Snippets Groups Projects
Commit 70b3cd18 authored by helene ortiz's avatar helene ortiz
Browse files

Add 2 preference values to restore main window x and y.

parent 071addd0
No related branches found
Tags 4.3.3
No related merge requests found
4.0.61 dd/mm/2020
------
* Improvement: When "view logs" menu displays the message "you must log in to view logs!", automatically open the login popup.
* Add 2 preference values to restore main window x and y.
......
......@@ -419,6 +419,10 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
SpyManager.getInstance().savePreferences();
ConfigManager.getInstance().savePreference(ConfigManager.MAGNIFY_FACTOR_INDEX, Magnifier.getScaleIndex() + "");
ConfigManager.getInstance().savePreference(ConfigManager.X_MAIN_WINDOW, String.valueOf(MainWindowPeer.getInstance().getX()));
ConfigManager.getInstance().savePreference(ConfigManager.Y_MAIN_WINDOW, String.valueOf(MainWindowPeer.getInstance().getY()));
ConfigManager.getInstance().savePreferences();
MainWindowPeer.getInstance().onClose();
......
......@@ -383,4 +383,7 @@ public abstract class MainWindowPeer {
public abstract int getHeight();
public abstract void setTitle(String extraTitle);
public abstract int getX();
public abstract int getY();
}
\ No newline at end of file
......@@ -184,11 +184,11 @@ public class SWTMainWindowPeer extends MainWindowPeer {
title = title + " " + additionalTitle;
}
shell.setText(title);
if (RemoteControlManager.getInstance().isDisabled()) {
setTitle(ConfigManager.getInstance().getString("remoteControlIsDisabled"));
}
// Create mainComposite
mainComposite = SWTWidgetFactory.getInstance().createComposite(shell, SWT.NONE);
......@@ -272,7 +272,7 @@ public class SWTMainWindowPeer extends MainWindowPeer {
parentPluginAreaComposite.setLayout(gridLayout);
authenticationPeer = new SWTAuthenticationPeer(parentPluginAreaComposite);
// Create a menu bar
// Build menu from XML file describing menu hierarchy
// Must be done AFTER authenticationPeer instanciation !!!! (because the latter sets instrument name in session manager, which is used by MenuBuilder
......@@ -319,9 +319,9 @@ public class SWTMainWindowPeer extends MainWindowPeer {
pluginAreaData.top = new FormAttachment(0, 0);
pluginAreaData.bottom = new FormAttachment(100, 0);
parentPluginAreaComposite.setLayoutData(pluginAreaData);
addTokenWidget();
// initialise Drag and Drop manager
SWTDndManager.getSWTInstance().init(display);
......@@ -333,14 +333,14 @@ public class SWTMainWindowPeer extends MainWindowPeer {
//TokenSimulator tokenSimulator = new TokenSimulator(display);
//ChatSimulator chatSimulator = new ChatSimulator(display);
}
private void addTokenWidget() {
tokenWidget = new SWTTokenWidget(parentPluginAreaComposite);
}
public Composite getSelectionPluginsParentComposite() {
return selectionPluginsParentComposite;
......@@ -362,7 +362,18 @@ public class SWTMainWindowPeer extends MainWindowPeer {
int screenHeight = display.getBounds().height;
int screenWidth = display.getBounds().width;
shell.setLocation((screenWidth - shellWidth) / 2, (screenHeight - shellHeight) / 2);
int x = (screenWidth - shellWidth) / 2;
int y = (screenHeight - shellHeight) / 2;
String xString = ConfigManager.getInstance().getPreferenceValue(ConfigManager.X_MAIN_WINDOW);
String yString = ConfigManager.getInstance().getPreferenceValue(ConfigManager.Y_MAIN_WINDOW);
if (xString != null && yString != null) {
x = Integer.valueOf(xString);
y = Integer.valueOf(yString);
}
shell.setLocation(x, y);
shell.setRedraw(false);
shell.open();
......@@ -506,7 +517,7 @@ public class SWTMainWindowPeer extends MainWindowPeer {
changeMenuItemLabel("menu.user.admin", "menu.user.adminLogout");
enableMenuItem("menu.hardware", true);
enableMenuItem("menu.view.logger", true);
selectionArea.setBackground(SWTColorFactory.getAdministrationColor());
toolBarSelectionPluginPeer.onAdministratorLogin();
sash.setBackground(SWTColorFactory.getAdministrationColor());
......@@ -516,7 +527,7 @@ public class SWTMainWindowPeer extends MainWindowPeer {
public void onAdministratorLogout() {
// Open the logger tool to suggest the administrator to log a message describing what he has just done
//openLogger();
......@@ -534,7 +545,7 @@ public class SWTMainWindowPeer extends MainWindowPeer {
public void onMagnify(float factor) {
tokenWidget.onMagnify();
int currentWidth = shell.getBounds().width;
int currentHeight = shell.getBounds().height;
......@@ -593,13 +604,13 @@ public class SWTMainWindowPeer extends MainWindowPeer {
configurationErrorsWindow.show();
}
}
public void resetConfigurationErrors() {
configurationErrorsWindow = null;
}
@Override
public void openLogger() {
if (loggerWindow == null) { // not already opened
......@@ -631,6 +642,16 @@ public class SWTMainWindowPeer extends MainWindowPeer {
}
}
@Override
public int getX() {
return shell.getLocation().x;
}
@Override
public int getY() {
return shell.getLocation().y;
}
/*
public void openWaitingProgressionDialog() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment