View Issue Details

IDProjectCategoryView StatusLast Update
0000541Cinelerra-GG[All Projects] Featurepublic2024-10-23 15:13
ReporterPhyllisSmith Assigned ToPhyllisSmith  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2020-10 
Target VersionFixed in Version 
Summary0000541: Make "Show Viewer/Compositor/Resources" a toggle under Window pulldown
DescriptionShow Overlays under the Window pulldown is a toggle and Andrew requested that Show Viewer, Show Resources, and Show Compositor also be a toggle for ease of use and consistency. Logging here so it does not get lost by being only in the email.
TagsNo tags attached.

Activities

PhyllisSmith

PhyllisSmith

2024-10-23 15:13

manager   ~0005719

It looks to be complete but I must have forgotten to close it a long time ago.
PhyllisSmith

PhyllisSmith

2020-12-06 00:42

manager   ~0004411

@Andrew-R
Finally finished testing and all is good so I checked in your mod to GIT -- but added the lines:
if( mwindow->session->current_operation == NO_OPERATION ) { ... } . It does not seem to cause any problems and I think it must solve some problem that caused a deadlock sometime in the past for "Show Overlays" window.

@Andrea_Paz
Thanks for digging up BT 66. I was wondering about why it was not documented and it was for a good reason. We should save "w" for something more important in the future as we already have multiple ways already to close the windows.
Andrea_Paz

Andrea_Paz

2020-12-05 18:23

manager   ~0004410

It was discussed in BT 0000066. It also works with "ctrl + w".
PhyllisSmith

PhyllisSmith

2020-12-05 05:15

manager   ~0004409

@Andrew-R
I would not bother adding separate Viewer window actions as I think it works as expected.
I can not believe that the "w" is not documented as a shortcut anywhere -- good discovery. Will update the docs on this find.
Still have to test this latest patch more exhaustively yet.
Andrew-R

Andrew-R

2020-12-04 17:47

reporter   ~0004408

and just realized (after reading source of vwindowgui.C!) I can bring those windows down by pressing 'w' ..... doh .....
Andrew-R

Andrew-R

2020-12-04 17:27

reporter   ~0004407

Slightly smaller patch with commented-out stuff removed....
As Phyllis noted in email - separate actions for one viewer or group of them might be useful .. But I haven't tried to code this yet.

MENU_TOGGLES-full-2.patch (5,250 bytes)
diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C
index 5735f8c9..7df780d1 100644
--- a/cinelerra-5.1/cinelerra/mainmenu.C
+++ b/cinelerra-5.1/cinelerra/mainmenu.C
@@ -1607,9 +1607,15 @@ ShowVWindow::ShowVWindow(MWindow *mwindow)
 }
 int ShowVWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_vwindow(1);
-	mwindow->gui->lock_window("ShowVWindow::handle_event");
+
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_vwindow )
+			mwindow->show_vwindow(1);
+		else
+			mwindow->hide_vwindow();
+		mwindow->gui->lock_window("ShowVWindow::handle_event");
+		set_checked(mwindow->session->show_vwindow);
+
 	return 1;
 }
 
@@ -1621,9 +1627,14 @@ ShowAWindow::ShowAWindow(MWindow *mwindow)
 }
 int ShowAWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_awindow();
-	mwindow->gui->lock_window("ShowAWindow::handle_event");
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_awindow )
+			mwindow->show_awindow();
+		else
+			mwindow->hide_awindow();
+		mwindow->gui->lock_window("ShowAWindow::handle_event");
+		set_checked(mwindow->session->show_awindow);
+
 	return 1;
 }
 
@@ -1635,9 +1646,14 @@ ShowCWindow::ShowCWindow(MWindow *mwindow)
 }
 int ShowCWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_cwindow();
-	mwindow->gui->lock_window("ShowCWindow::handle_event");
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_cwindow )
+			mwindow->show_cwindow();
+		else
+			mwindow->hide_cwindow();
+		mwindow->gui->lock_window("ShowCWindow::handle_event");
+		set_checked(mwindow->session->show_cwindow);
+
 	return 1;
 }
 
@@ -1672,9 +1688,15 @@ ShowLWindow::ShowLWindow(MWindow *mwindow)
 }
 int ShowLWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_lwindow();
-	mwindow->gui->lock_window("ShowLWindow::handle_event");
+
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_lwindow )
+			mwindow->show_lwindow();
+		else
+			mwindow->hide_lwindow();
+		mwindow->gui->lock_window("ShowLWindow::handle_event");
+		set_checked(mwindow->session->show_lwindow);
+
 	return 1;
 }
 
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index 6621d11a..a8fc1dcf 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -2997,6 +2997,26 @@ void MWindow::show_vwindow(int raise)
 	gui->mainmenu->show_vwindow->set_checked(1);
 }
 
+
+void MWindow::hide_vwindow()
+{
+	session->show_vwindow = 0;
+	int total_running = 0;
+
+	for(int j = 0; j < vwindows.size(); j++) {
+		VWindow *vwindow = vwindows[j];
+		if( !vwindow->is_running() ) continue;
+		total_running++;
+		if( !raise && !vwindow->gui->is_hidden() ) continue;
+		vwindow->gui->lock_window("MWindow::show_vwindow");
+		vwindow->gui->hide_window(0);
+		vwindow->gui->unlock_window();
+	}
+
+	gui->mainmenu->show_vwindow->set_checked(0);
+}
+
+
 void MWindow::show_awindow()
 {
 	session->show_awindow = 1;
@@ -3008,6 +3028,18 @@ void MWindow::show_awindow()
 	gui->mainmenu->show_awindow->set_checked(1);
 }
 
+void MWindow::hide_awindow()
+{
+	session->show_awindow = 0;
+
+	awindow->gui->lock_window("MWindow::show_awindow");
+	awindow->gui->hide_window();
+	awindow->gui->unlock_window();
+	gui->mainmenu->show_awindow->set_checked(0);
+}
+
+
+
 char *MWindow::get_cwindow_display()
 {
 	char *x11_host = screens < 2 || session->window_config == 0 ?
@@ -3023,6 +3055,18 @@ void MWindow::show_cwindow()
 	gui->mainmenu->show_cwindow->set_checked(1);
 }
 
+
+void MWindow::hide_cwindow()
+{
+	session->show_cwindow = 0;
+
+	cwindow->gui->lock_window("MWindow::show_cwindow");
+	cwindow->gui->hide_window();
+	cwindow->gui->unlock_window();
+	gui->mainmenu->show_cwindow->set_checked(0);
+}
+
+
 void MWindow::show_gwindow()
 {
 	session->show_gwindow = 1;
@@ -3035,6 +3079,7 @@ void MWindow::show_gwindow()
 
 	gui->mainmenu->show_gwindow->set_checked(1);
 }
+
 void MWindow::hide_gwindow()
 {
 	session->show_gwindow = 0;
@@ -3042,6 +3087,8 @@ void MWindow::hide_gwindow()
 	gwindow->gui->lock_window("MWindow::show_gwindow");
 	gwindow->gui->hide_window();
 	gwindow->gui->unlock_window();
+
+	gui->mainmenu->show_gwindow->set_checked(0);
 }
 
 void MWindow::show_lwindow()
@@ -3055,6 +3102,18 @@ void MWindow::show_lwindow()
 	gui->mainmenu->show_lwindow->set_checked(1);
 }
 
+void MWindow::hide_lwindow()
+{
+	session->show_lwindow = 0;
+
+	lwindow->gui->lock_window("MWindow::show_lwindow");
+	lwindow->gui->hide_window();
+	lwindow->gui->unlock_window();
+	gui->mainmenu->show_lwindow->set_checked(0);
+}
+
+
+
 void MWindow::restore_windows()
 {
 	gui->unlock_window();
diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h
index 6a4e2fb6..a4508e67 100644
--- a/cinelerra-5.1/cinelerra/mwindow.h
+++ b/cinelerra-5.1/cinelerra/mwindow.h
@@ -210,9 +210,13 @@ public:
 	int create_ref(Asset *asset, EDL *ref);
 // Show windows
 	void show_vwindow(int raise);
+	void hide_vwindow();
 	void show_awindow();
-	void show_lwindow();
+	void hide_awindow();
 	void show_cwindow();
+	void hide_cwindow();
+	void show_lwindow();
+	void hide_lwindow();
 	void show_gwindow();
 	void hide_gwindow();
 	void restore_windows();
Andrea_Paz

Andrea_Paz

2020-12-04 08:41

manager   ~0004406

Thank you all. Now the patch is active and the window toggles works well.
I remember an attempt to eliminate window decoration; is it possible to test it?
PhyllisSmith

PhyllisSmith

2020-12-04 00:10

manager   ~0004405

@Andrea_Paz
The patch also works for "Show Levels". About your messages:

"[paz@arch-paz cinelerra]$ patch fileffmpeg.C Interlace_aspect_images_fix.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file fileffmpeg.C"
****THIS ABOVE actually worked correctly and the second line is just a warning.

"[paz@arch-paz cinelerra]$ patch --binary fileffmpeg.C Interlace_aspect_images_fix.patch
patching file fileffmpeg.C
Hunk 0000001 FAILED at 345 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file fileffmpeg.C.rej"
****THE ABOVE did not work because you already had the patch applied and the line numbers/code no longer matched.

I have tested with multiple instances and it worked consistently without any crash or weirdness.
Also checked the code comparing it to what "gwindow" for "Show Overlays" has (that is all I am capable of doing) and found a couple of things that may need amplification and this will be written about in the email.
PhyllisSmith

PhyllisSmith

2020-12-03 17:39

manager   ~0004404

@Andrea_Paz

Andrew's patches are very convenient to use. For example for the MENU_TOGGLES-full.patch all you have to do is:

1) cd /the build directory of cinelerra
    -- this would be wherever you put cinelerra BUT above the subdirectory of cinelerra-5.1/cinelerra and that is because if you look at his patch on line 3 and line 4 he uses a/cinelerra-5.1/cinelerra and b/cinelerra-5.1/cinelerra

2) patch -p1 < /tmp/MENU_TOGGLES-full.patch
    -- assuming that you downloaded his patch file to /tmp; substitute for /tmp where you put it instead

What does this patch do? you ask. It works like "Show Overlays" under the Window pulldown works for the other windows such as Compositor, Viewer, and Resources. That is if you close those windows, they no longer show that they are checked on in the Windows pulldown and you can bring them back up by clicking on them again -- just like the Overlays window.
Andrew-R

Andrew-R

2020-12-03 15:25

reporter   ~0004403

I usually "cat /path_to_patch/patch_name | patch -p1" (or p0, depend on how exactly I made patch) them, or "git apply /path/patch_name" from within source tree .......


This patch supposed to give you ability to switch on/off various windows, like Composer window, by just clicking on menu item, so borderless windows can be closed or reopened.
Andrea_Paz

Andrea_Paz

2020-12-03 09:59

manager   ~0004402

I tried the patch but I don't see any change. Actually I don't really understand what it is for.

PS: I have problems applying patches. For yesterday's one on still images I had the following errors:

[paz@arch-paz cinelerra]$ patch fileffmpeg.C Interlace_aspect_images_fix.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file fileffmpeg.C

Tried to use --binary:

[paz@arch-paz cinelerra]$ patch --binary fileffmpeg.C Interlace_aspect_images_fix.patch
patching file fileffmpeg.C
Hunk 0000001 FAILED at 345 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file fileffmpeg.C.rej

Despite these messages the patch worked.

The patch in the_toggles menu gave the same errors (I also tried the -l and -i options):

[paz@arch-paz cinelerra]$ patch --binary mainmenu.C MENU_TOGGLES-full.patch
patching file mainmenu.C
Hunk 0000001 FAILED at 1607 (different line endings).
Hunk 0000002 FAILED at 1621 (different line endings).
Hunk 0000003 FAILED at 1635 (different line endings).
Hunk #4 FAILED at 1672 (different line endings).
4 out of 4 hunks FAILED -- saving rejects to file mainmenu.C.rej
patching file mainmenu.C
Hunk 0000001 FAILED at 2997 (different line endings).
Hunk 0000002 FAILED at 3008 (different line endings).
Hunk 0000003 FAILED at 3023 (different line endings).
Hunk #4 FAILED at 3035 (different line endings).
Hunk 0000005 FAILED at 3042 (different line endings).
Hunk 0000006 FAILED at 3055 (different line endings).
6 out of 6 hunks FAILED -- saving rejects to file mainmenu.C.rej
patching file mainmenu.C
Hunk 0000001 FAILED at 210 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file mainmenu.C.rej

As said it seems not to work (or I did not understand!).
IgorBeg

IgorBeg

2020-12-02 09:33

reporter   ~0004401

I think Andrew-R is an expert C++ coder. I am not, sorry. I can read the code here and there, and sometimes I understand something. I will try to read.
PhyllisSmith

PhyllisSmith

2020-12-02 03:27

manager   ~0004400

@IgorBeg
Andrew supplied a patch for this in the email but the subject line reads "Not quite correct patch for toggling windows". I tested it and it does seem to work but I do not know about why it is "not quite correct". Igor, could you review the code when you have some spare time? Thanks, I have attached the patch.

MENU_TOGGLES-full.patch (6,252 bytes)
diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C
index 5735f8c9..18e2466d 100644
--- a/cinelerra-5.1/cinelerra/mainmenu.C
+++ b/cinelerra-5.1/cinelerra/mainmenu.C
@@ -1607,9 +1607,18 @@ ShowVWindow::ShowVWindow(MWindow *mwindow)
 }
 int ShowVWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_vwindow(1);
-	mwindow->gui->lock_window("ShowVWindow::handle_event");
+
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_vwindow )
+			mwindow->show_vwindow(1);
+		else
+			mwindow->hide_vwindow();
+		mwindow->gui->lock_window("ShowVWindow::handle_event");
+		set_checked(mwindow->session->show_vwindow);
+
+//	mwindow->gui->unlock_window();
+//	mwindow->show_vwindow(1);
+//	mwindow->gui->lock_window("ShowVWindow::handle_event");
 	return 1;
 }
 
@@ -1621,9 +1630,18 @@ ShowAWindow::ShowAWindow(MWindow *mwindow)
 }
 int ShowAWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_awindow();
-	mwindow->gui->lock_window("ShowAWindow::handle_event");
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_awindow )
+			mwindow->show_awindow();
+		else
+			mwindow->hide_awindow();
+		mwindow->gui->lock_window("ShowAWindow::handle_event");
+		set_checked(mwindow->session->show_awindow);
+
+
+//	mwindow->gui->unlock_window();
+//	mwindow->show_awindow();
+//	mwindow->gui->lock_window("ShowAWindow::handle_event");
 	return 1;
 }
 
@@ -1635,9 +1653,17 @@ ShowCWindow::ShowCWindow(MWindow *mwindow)
 }
 int ShowCWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_cwindow();
-	mwindow->gui->lock_window("ShowCWindow::handle_event");
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_cwindow )
+			mwindow->show_cwindow();
+		else
+			mwindow->hide_cwindow();
+		mwindow->gui->lock_window("ShowCWindow::handle_event");
+		set_checked(mwindow->session->show_cwindow);
+
+//	mwindow->gui->unlock_window();
+//	mwindow->show_cwindow();
+//	mwindow->gui->lock_window("ShowCWindow::handle_event");
 	return 1;
 }
 
@@ -1672,9 +1698,18 @@ ShowLWindow::ShowLWindow(MWindow *mwindow)
 }
 int ShowLWindow::handle_event()
 {
-	mwindow->gui->unlock_window();
-	mwindow->show_lwindow();
-	mwindow->gui->lock_window("ShowLWindow::handle_event");
+
+		mwindow->gui->unlock_window();
+		if( !mwindow->session->show_lwindow )
+			mwindow->show_lwindow();
+		else
+			mwindow->hide_lwindow();
+		mwindow->gui->lock_window("ShowLWindow::handle_event");
+		set_checked(mwindow->session->show_lwindow);
+
+//	mwindow->gui->unlock_window();
+//	mwindow->show_lwindow();
+//	mwindow->gui->lock_window("ShowLWindow::handle_event");
 	return 1;
 }
 
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index f245018a..c25c2bdf 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -2997,6 +2997,36 @@ void MWindow::show_vwindow(int raise)
 	gui->mainmenu->show_vwindow->set_checked(1);
 }
 
+
+void MWindow::hide_vwindow()
+{
+	session->show_vwindow = 0;
+	int total_running = 0;
+
+	for(int j = 0; j < vwindows.size(); j++) {
+		VWindow *vwindow = vwindows[j];
+		if( !vwindow->is_running() ) continue;
+		total_running++;
+		if( !raise && !vwindow->gui->is_hidden() ) continue;
+		vwindow->gui->lock_window("MWindow::show_vwindow");
+		vwindow->gui->hide_window(0);
+		//vwindow->gui->raise_window();
+		//vwindow->gui->flush();
+		vwindow->gui->unlock_window();
+	}
+// If no windows visible
+	if( !total_running )
+		get_viewer(1, DEFAULT_VWINDOW);
+
+	gui->mainmenu->show_vwindow->set_checked(0);
+
+//
+//	vwindow->gui->lock_window("MWindow::show_vwindow");
+//	vwindow->gui->hide_window();
+//	vwindow->gui->unlock_window();
+}
+
+
 void MWindow::show_awindow()
 {
 	session->show_awindow = 1;
@@ -3008,6 +3038,18 @@ void MWindow::show_awindow()
 	gui->mainmenu->show_awindow->set_checked(1);
 }
 
+void MWindow::hide_awindow()
+{
+	session->show_awindow = 0;
+
+	awindow->gui->lock_window("MWindow::show_awindow");
+	awindow->gui->hide_window();
+	awindow->gui->unlock_window();
+	gui->mainmenu->show_awindow->set_checked(0);
+}
+
+
+
 char *MWindow::get_cwindow_display()
 {
 	char *x11_host = screens < 2 || session->window_config == 0 ?
@@ -3023,6 +3065,18 @@ void MWindow::show_cwindow()
 	gui->mainmenu->show_cwindow->set_checked(1);
 }
 
+
+void MWindow::hide_cwindow()
+{
+	session->show_cwindow = 0;
+
+	cwindow->gui->lock_window("MWindow::show_cwindow");
+	cwindow->gui->hide_window();
+	cwindow->gui->unlock_window();
+	gui->mainmenu->show_cwindow->set_checked(0);
+}
+
+
 void MWindow::show_gwindow()
 {
 	session->show_gwindow = 1;
@@ -3035,6 +3089,7 @@ void MWindow::show_gwindow()
 
 	gui->mainmenu->show_gwindow->set_checked(1);
 }
+
 void MWindow::hide_gwindow()
 {
 	session->show_gwindow = 0;
@@ -3042,6 +3097,8 @@ void MWindow::hide_gwindow()
 	gwindow->gui->lock_window("MWindow::show_gwindow");
 	gwindow->gui->hide_window();
 	gwindow->gui->unlock_window();
+	
+	gui->mainmenu->show_gwindow->set_checked(0);
 }
 
 void MWindow::show_lwindow()
@@ -3055,6 +3112,18 @@ void MWindow::show_lwindow()
 	gui->mainmenu->show_lwindow->set_checked(1);
 }
 
+void MWindow::hide_lwindow()
+{
+	session->show_lwindow = 0;
+
+	lwindow->gui->lock_window("MWindow::show_lwindow");
+	lwindow->gui->hide_window();
+	lwindow->gui->unlock_window();
+	gui->mainmenu->show_lwindow->set_checked(0);
+}
+
+
+
 void MWindow::restore_windows()
 {
 	gui->unlock_window();
diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h
index 6a4e2fb6..a4508e67 100644
--- a/cinelerra-5.1/cinelerra/mwindow.h
+++ b/cinelerra-5.1/cinelerra/mwindow.h
@@ -210,9 +210,13 @@ public:
 	int create_ref(Asset *asset, EDL *ref);
 // Show windows
 	void show_vwindow(int raise);
+	void hide_vwindow();
 	void show_awindow();
-	void show_lwindow();
+	void hide_awindow();
 	void show_cwindow();
+	void hide_cwindow();
+	void show_lwindow();
+	void hide_lwindow();
 	void show_gwindow();
 	void hide_gwindow();
 	void restore_windows();
MENU_TOGGLES-full.patch (6,252 bytes)

Issue History

Date Modified Username Field Change
2020-12-01 23:46 PhyllisSmith New Issue
2020-12-02 03:27 PhyllisSmith File Added: MENU_TOGGLES-full.patch
2020-12-02 03:27 PhyllisSmith Note Added: 0004400
2020-12-02 09:33 IgorBeg Note Added: 0004401
2020-12-03 09:59 Andrea_Paz Note Added: 0004402
2020-12-03 15:25 Andrew-R Note Added: 0004403
2020-12-03 17:39 PhyllisSmith Note Added: 0004404
2020-12-04 00:10 PhyllisSmith Note Added: 0004405
2020-12-04 08:41 Andrea_Paz Note Added: 0004406
2020-12-04 17:27 Andrew-R File Added: MENU_TOGGLES-full-2.patch
2020-12-04 17:27 Andrew-R Note Added: 0004407
2020-12-04 17:47 Andrew-R Note Added: 0004408
2020-12-05 05:15 PhyllisSmith Note Added: 0004409
2020-12-05 18:23 Andrea_Paz Note Added: 0004410
2020-12-06 00:42 PhyllisSmith Note Added: 0004411
2024-10-23 15:13 PhyllisSmith Assigned To => PhyllisSmith
2024-10-23 15:13 PhyllisSmith Status new => closed
2024-10-23 15:13 PhyllisSmith Resolution open => fixed
2024-10-23 15:13 PhyllisSmith Note Added: 0005719