Commit a04aed34 authored by ellelili2025's avatar ellelili2025 Committed by Susan Rati Lane

Hided tooltips, context menus, text selections etc when navigating from block editor. (#1940)

Fixes #1140
parent d29bd59c
...@@ -31,6 +31,7 @@ import com.google.appinventor.client.editor.EditorManager; ...@@ -31,6 +31,7 @@ import com.google.appinventor.client.editor.EditorManager;
import com.google.appinventor.client.editor.FileEditor; import com.google.appinventor.client.editor.FileEditor;
import com.google.appinventor.client.editor.youngandroid.BlocklyPanel; import com.google.appinventor.client.editor.youngandroid.BlocklyPanel;
import com.google.appinventor.client.editor.youngandroid.TutorialPanel; import com.google.appinventor.client.editor.youngandroid.TutorialPanel;
import com.google.appinventor.client.editor.youngandroid.YaBlocksEditor;
import com.google.appinventor.client.explorer.commands.ChainableCommand; import com.google.appinventor.client.explorer.commands.ChainableCommand;
import com.google.appinventor.client.explorer.commands.CommandRegistry; import com.google.appinventor.client.explorer.commands.CommandRegistry;
import com.google.appinventor.client.explorer.commands.SaveAllEditorsCommand; import com.google.appinventor.client.explorer.commands.SaveAllEditorsCommand;
...@@ -442,6 +443,7 @@ public class Ode implements EntryPoint { ...@@ -442,6 +443,7 @@ public class Ode implements EntryPoint {
public void switchToProjectsView() { public void switchToProjectsView() {
// We may need to pass the code below as a runnable to // We may need to pass the code below as a runnable to
// screenShotMaybe() so build the runnable now // screenShotMaybe() so build the runnable now
hideChaff();
hideTutorials(); hideTutorials();
Runnable next = new Runnable() { Runnable next = new Runnable() {
@Override @Override
...@@ -483,6 +485,7 @@ public class Ode implements EntryPoint { ...@@ -483,6 +485,7 @@ public class Ode implements EntryPoint {
*/ */
public void switchToTrash() { public void switchToTrash() {
hideChaff();
hideTutorials(); hideTutorials();
if (currentView != TRASHCAN){ if (currentView != TRASHCAN){
TrashProjectListBox.getTrashProjectListBox().getTrashProjectList().getSelectedProjects().clear(); TrashProjectListBox.getTrashProjectListBox().getTrashProjectList().getSelectedProjects().clear();
...@@ -508,6 +511,7 @@ public class Ode implements EntryPoint { ...@@ -508,6 +511,7 @@ public class Ode implements EntryPoint {
*/ */
public void switchToUserAdminPanel() { public void switchToUserAdminPanel() {
hideChaff();
hideTutorials(); hideTutorials();
currentView = USERADMIN; currentView = USERADMIN;
deckPanel.showWidget(userAdminTabIndex); deckPanel.showWidget(userAdminTabIndex);
...@@ -517,6 +521,7 @@ public class Ode implements EntryPoint { ...@@ -517,6 +521,7 @@ public class Ode implements EntryPoint {
* Switch to the Gallery tab * Switch to the Gallery tab
*/ */
public void switchToGalleryView() { public void switchToGalleryView() {
hideChaff();
hideTutorials(); hideTutorials();
if (!galleryInitialized) { if (!galleryInitialized) {
// Gallery initialization is deferred until now. // Gallery initialization is deferred until now.
...@@ -530,6 +535,7 @@ public class Ode implements EntryPoint { ...@@ -530,6 +535,7 @@ public class Ode implements EntryPoint {
* Switch to the Gallery App * Switch to the Gallery App
*/ */
public void switchToGalleryAppView(GalleryApp app, int editStatus) { public void switchToGalleryAppView(GalleryApp app, int editStatus) {
hideChaff();
hideTutorials(); hideTutorials();
if (!galleryInitialized) { if (!galleryInitialized) {
// Gallery initialization is deferred until now. // Gallery initialization is deferred until now.
...@@ -545,6 +551,7 @@ public class Ode implements EntryPoint { ...@@ -545,6 +551,7 @@ public class Ode implements EntryPoint {
* TODO: change string parameter * TODO: change string parameter
*/ */
public void switchToUserProfileView(String userId, int editStatus) { public void switchToUserProfileView(String userId, int editStatus) {
hideChaff();
hideTutorials(); hideTutorials();
currentView = USERPROFILE; currentView = USERPROFILE;
OdeLog.log("###########" + userId + "||||||" + editStatus); OdeLog.log("###########" + userId + "||||||" + editStatus);
...@@ -556,6 +563,7 @@ public class Ode implements EntryPoint { ...@@ -556,6 +563,7 @@ public class Ode implements EntryPoint {
* Switch to the Designer tab. Shows an error message if there is no currentFileEditor. * Switch to the Designer tab. Shows an error message if there is no currentFileEditor.
*/ */
public void switchToDesignView() { public void switchToDesignView() {
hideChaff();
// Only show designer if there is a current editor. // Only show designer if there is a current editor.
// ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT EDITOR. ***** // ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT EDITOR. *****
showTutorials(); showTutorials();
...@@ -573,6 +581,7 @@ public class Ode implements EntryPoint { ...@@ -573,6 +581,7 @@ public class Ode implements EntryPoint {
* Switch to Gallery TabPanel * Switch to Gallery TabPanel
*/ */
public void switchToPrivateUserProfileView() { public void switchToPrivateUserProfileView() {
hideChaff();
currentView = privateUserProfileIndex; currentView = privateUserProfileIndex;
deckPanel.showWidget(privateUserProfileIndex); deckPanel.showWidget(privateUserProfileIndex);
} }
...@@ -581,6 +590,7 @@ public class Ode implements EntryPoint { ...@@ -581,6 +590,7 @@ public class Ode implements EntryPoint {
* Switch to the Moderation Page tab * Switch to the Moderation Page tab
*/ */
public void switchToModerationPageView() { public void switchToModerationPageView() {
hideChaff();
hideTutorials(); hideTutorials();
if (!galleryInitialized) { if (!galleryInitialized) {
initializeGallery(); initializeGallery();
...@@ -592,6 +602,7 @@ public class Ode implements EntryPoint { ...@@ -592,6 +602,7 @@ public class Ode implements EntryPoint {
* Switch to the Debugging tab * Switch to the Debugging tab
*/ */
public void switchToDebuggingView() { public void switchToDebuggingView() {
hideChaff();
hideTutorials(); hideTutorials();
deckPanel.showWidget(debuggingTabIndex); deckPanel.showWidget(debuggingTabIndex);
...@@ -1548,7 +1559,14 @@ public class Ode implements EntryPoint { ...@@ -1548,7 +1559,14 @@ public class Ode implements EntryPoint {
return getUserAutoloadProject(); return getUserAutoloadProject();
} }
/**
* HideChaff when switching view from block to others
*/
private void hideChaff() {
if (designToolbar.getCurrentView() == DesignToolbar.View.BLOCKS) {
currentFileEditor.hideChaff();
}
}
/** /**
* Returns user dyslexic font setting. * Returns user dyslexic font setting.
* *
......
...@@ -174,4 +174,10 @@ public abstract class FileEditor extends Composite { ...@@ -174,4 +174,10 @@ public abstract class FileEditor extends Composite {
public void makeActiveWorkspace() { public void makeActiveWorkspace() {
} }
/**
* YaBlockEditor will use Blockly.hideChaff to close tooltips, context menus etc.
*/
public void hideChaff() {
}
} }
...@@ -641,6 +641,11 @@ public final class YaBlocksEditor extends FileEditor ...@@ -641,6 +641,11 @@ public final class YaBlocksEditor extends FileEditor
blocksArea.hardReset(); blocksArea.hardReset();
} }
/*
* Perform a hideChaff of Blockly
*/
public void hideChaff () {blocksArea.hideChaff();}
// Static Function. Find the associated editor for formName and // Static Function. Find the associated editor for formName and
// set its "damaged" bit. This will cause the editor manager's scheduleAutoSave // set its "damaged" bit. This will cause the editor manager's scheduleAutoSave
// method to ignore this blocks file and not save it out. // method to ignore this blocks file and not save it out.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment