Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaSaBr committed Jan 20, 2017
1 parent 299cfd8 commit 0c7a88b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 13 deletions.
Binary file modified resources/ui/css/custom_ids.bss
Binary file not shown.
10 changes: 10 additions & 0 deletions resources/ui/css/custom_ids.css
Original file line number Diff line number Diff line change
Expand Up @@ -824,4 +824,14 @@
-fx-min-height: 25;
-fx-pref-height: -fx-min-height;
-fx-max-height: -fx-min-height;
}

#ImageViewEditorContainer {
-fx-alignment: center;
-fx-background-color: -fx-background-background;
}

#AudioViewEditorContainer {
-fx-alignment: center;
-fx-background-color: -fx-background-background;
}
2 changes: 1 addition & 1 deletion src/com/ss/editor/JFXApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ public void buildScene() {
this.scene = EditorFXSceneBuilder.build(requireNonNull(stage));

final EditorFXScene scene = getScene();
scene.notifyFinishBuild();

final Editor editor = Editor.getInstance();
final EditorThreadExecutor executor = EditorThreadExecutor.getInstance();
Expand Down Expand Up @@ -240,6 +239,7 @@ private void createSceneProcessor(@NotNull final EditorFXScene scene, @NotNull f
this.sceneProcessor = bind(editor, scene.getCanvas(), editor.getViewPort());
final Stage stage = getStage();
stage.focusedProperty().addListener((observable, oldValue, newValue) -> editor.setPaused(!newValue));
Platform.runLater(scene::notifyFinishBuild);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.image.ImageView;
import rlib.concurrent.util.ThreadUtils;
import rlib.logging.Logger;
import rlib.logging.LoggerManager;
import rlib.ui.util.FXUtils;
Expand Down Expand Up @@ -317,7 +318,7 @@ private void processShowEditor(@Nullable final Tab prevTab, @Nullable final Tab
final AppStateManager stateManager = EDITOR.getStateManager();
final FrameTransferSceneProcessor sceneProcessor = JFX_APPLICATION.getSceneProcessor();

EXECUTOR_MANAGER.addFXTask(() -> sceneProcessor.setEnabled(false));
boolean enabled = false;

if (prevTab != null) {

Expand All @@ -328,15 +329,24 @@ private void processShowEditor(@Nullable final Tab prevTab, @Nullable final Tab
states.forEach(stateManager::detach);
}

if (newTab == null) return;
if (newTab != null) {

final ObservableMap<Object, Object> properties = newTab.getProperties();
final FileEditor fileEditor = (FileEditor) properties.get(KEY_EDITOR);
final ObservableMap<Object, Object> properties = newTab.getProperties();
final FileEditor fileEditor = (FileEditor) properties.get(KEY_EDITOR);

final Array<EditorAppState> states = fileEditor.getStates();
states.forEach(stateManager::attach);
final Array<EditorAppState> states = fileEditor.getStates();
states.forEach(stateManager::attach);

enabled = states.size() > 0;
}

EXECUTOR_MANAGER.addFXTask(() -> sceneProcessor.setEnabled(!states.isEmpty()));
if (sceneProcessor.isEnabled() != enabled) {
final boolean result = enabled;
EXECUTOR_MANAGER.addFXTask(() -> {
ThreadUtils.sleep(100);
sceneProcessor.setEnabled(result);
});
}
}

/**
Expand Down Expand Up @@ -449,7 +459,10 @@ private void loadOpenedFiles() {

final FrameTransferSceneProcessor sceneProcessor = JFX_APPLICATION.getSceneProcessor();

EXECUTOR_MANAGER.addFXTask(() -> sceneProcessor.setEnabled(false));
EXECUTOR_MANAGER.addFXTask(() -> {
ThreadUtils.sleep(200);
sceneProcessor.setEnabled(false);
});

final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();
if (workspace == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.nio.file.Path;
import java.util.Objects;

import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
Expand Down Expand Up @@ -105,7 +104,7 @@ protected VBox createRoot() {

@Override
protected void createContent(@NotNull final VBox root) {
root.setAlignment(Pos.CENTER);
root.setId(CSSIds.AUDIO_VIEW_EDITOR_CONTAINER);

final Label durationLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_DURATION_LABEL + ":");
durationLabel.setId(CSSIds.AUDIO_VIEWER_EDITOR_PARAM_LABEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import com.ss.editor.Messages;
import com.ss.editor.manager.JavaFXImageManager;
import com.ss.editor.ui.component.editor.EditorDescription;
import com.ss.editor.ui.css.CSSIds;
import com.ss.editor.ui.event.impl.FileChangedEvent;

import org.jetbrains.annotations.NotNull;

import java.nio.file.Path;

import javafx.geometry.Pos;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
Expand Down Expand Up @@ -55,7 +55,7 @@ protected VBox createRoot() {

@Override
protected void createContent(@NotNull final VBox root) {
root.setAlignment(Pos.CENTER);
root.setId(CSSIds.IMAGE_VIEW_EDITOR_CONTAINER);

imageView = new ImageView();

Expand Down
3 changes: 3 additions & 0 deletions src/com/ss/editor/ui/css/CSSIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,7 @@ public interface CSSIds {

String ADD_USER_DATA_DIALOG_LABEL = "AddUserDataDialogLabel";
String ADD_USER_DATA_FIELD = "AddUserDataDialogField";

String IMAGE_VIEW_EDITOR_CONTAINER = "ImageViewEditorContainer";
String AUDIO_VIEW_EDITOR_CONTAINER = "AudioViewEditorContainer";
}

0 comments on commit 0c7a88b

Please sign in to comment.