Hey Andraz,

Attached is a "bit more work" patch that makes it match now.. I'm wondering if some of the things I did are a non-standard way of doing things, so could you review the patch please?


Modifying the order of the menubar results in the numbers not being in order! Do people mind if we change the keyboard shortcuts so the numbering is in order?

That's a bit nasty, couldn't we put a bit of extra more work and change
the way overlay window works?

done..
and while we are at it: i think in overlay window, each checkbox should
also have min and max range values there which should be editable... :)
If I was to do this, I'd want to use my widgetgrid class.. though that the same time, my desktop real estate isn't that large as it is, let alone adding textboxes!

Though if I used widgetgrid I'd probably make something so you could hide the ranges... I'll look into it sometime..
diff --git a/cinelerra/gwindowgui.C b/cinelerra/gwindowgui.C
index ebe4bed..d9b3961 100644
--- a/cinelerra/gwindowgui.C
+++ b/cinelerra/gwindowgui.C
@@ -31,7 +31,7 @@ GWindowGUI::GWindowGUI(MWindow *mwindow,
 	this->mwindow = mwindow;
 }
 
-static char *other_text[OTHER_TOGGLES] =
+static char *other_text[NONAUTOTOGGLES_COUNT] =
 {
 	"Assets",
 	"Titles",
@@ -55,13 +55,36 @@ static char *auto_text[] = 
 	"Nudge"
 };
 
+#define ISAUTO  0x1000
+#define NOTAUTO 0x2000
+
+static int auto_reorder[] = 
+{
+
+	NOTAUTO + NONAUTOTOGGLES_ASSETS,
+	NOTAUTO + NONAUTOTOGGLES_TITLES,
+	NOTAUTO + NONAUTOTOGGLES_TRANSITIONS,
+	ISAUTO  + AUTOMATION_FADE,
+	ISAUTO  + AUTOMATION_MUTE,
+	ISAUTO  + AUTOMATION_MODE,
+	ISAUTO  + AUTOMATION_PAN,
+	NOTAUTO + NONAUTOTOGGLES_PLUGIN_AUTOS,
+	ISAUTO  + AUTOMATION_MASK,
+	ISAUTO  + AUTOMATION_CAMERA_X,
+	ISAUTO  + AUTOMATION_CAMERA_Y,
+	ISAUTO  + AUTOMATION_CAMERA_Z,
+	ISAUTO  + AUTOMATION_PROJECTOR_X,
+	ISAUTO  + AUTOMATION_PROJECTOR_Y,
+	ISAUTO  + AUTOMATION_PROJECTOR_Z,
+};
+
 void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h)
 {
 	int temp1, temp2, temp3, temp4, temp5, temp6, temp7;
 	int current_w, current_h;
 	*w = 10;
 	*h = 10;
-	for(int i = 0; i < OTHER_TOGGLES; i++)
+	for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
 	{
 		BC_Toggle::calculate_extents(gui, 
 			BC_WindowBase::get_resources()->checkbox_images,
@@ -75,29 +98,12 @@ void GWindowGUI::calculate_extents(BC_Wi
 			&temp5, 
 			&temp6,
 			&temp7, 
-			other_text[i]);
+			auto_reorder[i] & ISAUTO ? 
+				auto_text[auto_reorder[i] - ISAUTO] : other_text[auto_reorder[i] - NOTAUTO]);
 		*w = MAX(current_w, *w);
 		*h += current_h + 5;
 	}
 
-	for(int i = 0; i < AUTOMATION_TOTAL; i++)
-	{
-		BC_Toggle::calculate_extents(gui, 
-			BC_WindowBase::get_resources()->checkbox_images,
-			0,
-			&temp1,
-			&current_w,
-			&current_h,
-			&temp2,
-			&temp3,
-			&temp4,
-			&temp5, 
-			&temp6,
-			&temp7, 
-			auto_text[i]);
-		*w = MAX(current_w, *w);
-		*h += current_h + 5;
-	}
 	*h += 10;
 	*w += 20;
 }
@@ -109,28 +115,16 @@ void GWindowGUI::create_objects()
 	int x = 10, y = 10;
 
 
-	for(int i = 0; i < OTHER_TOGGLES; i++)
+	for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
 	{
-		add_tool(other[i] = new GWindowToggle(mwindow, 
+		add_tool(toggles[i] = new GWindowToggle(mwindow, 
 			this, 
 			x, 
 			y, 
-			-1,
-			i, 
-			other_text[i]));
-		y += other[i]->get_h() + 5;
-	}
-
-	for(int i = 0; i < AUTOMATION_TOTAL; i++)
-	{
-		add_tool(auto_toggle[i] = new GWindowToggle(mwindow, 
-			this, 
-			x, 
-			y, 
-			i,
-			-1, 
-			auto_text[i]));
-		y += auto_toggle[i]->get_h() + 5;
+			auto_reorder[i],
+			auto_reorder[i] & ISAUTO ? 
+				auto_text[auto_reorder[i] - ISAUTO] : other_text[auto_reorder[i] - NOTAUTO]));
+		y += toggles[i]->get_h() + 5;
 	}
 }
 
@@ -145,14 +139,9 @@ void GWindowGUI::update_toggles(int use_
 {
 	if(use_lock) lock_window("GWindowGUI::update_toggles");
 
-	for(int i = 0; i < OTHER_TOGGLES; i++)
-	{
-		other[i]->update();
-	}
-
-	for(int i = 0; i < AUTOMATION_TOTAL; i++)
+	for(int i = 0; i < NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL; i++)
 	{
-		auto_toggle[i]->update();
+		toggles[i]->update();
 	}
 
 	if(use_lock) unlock_window();
@@ -205,40 +194,38 @@ GWindowToggle::GWindowToggle(MWindow *mw
 	GWindowGUI *gui, 
 	int x, 
 	int y, 
-	int subscript, 
-	int other,
+	int toggleref, 
 	char *text)
  : BC_CheckBox(x, 
  	y, 
-	*get_main_value(mwindow, subscript, other), 
+	*get_main_value(mwindow, toggleref), 
 	text)
 {
 	this->mwindow = mwindow;
 	this->gui = gui;
-	this->subscript = subscript;
-	this->other = other;
+	this->toggleref = toggleref;
 }
 
 int GWindowToggle::handle_event()
 {
-	*get_main_value(mwindow, subscript, other) = get_value();
+	*get_main_value(mwindow, toggleref) = get_value();
 	gui->update_mwindow();
 
 
 // Update stuff in MWindow
 	unlock_window();
 	mwindow->gui->lock_window("GWindowToggle::handle_event");
-	if(subscript >= 0)
+	if(toggleref & ISAUTO)
 	{
 		mwindow->gui->canvas->draw_overlays();
 		mwindow->gui->canvas->flash();
 	}
 	else
 	{
-		switch(other)
+		switch(toggleref - NOTAUTO)
 		{
-			case ASSETS:
-			case TITLES:
+			case NONAUTOTOGGLES_ASSETS:
+			case NONAUTOTOGGLES_TITLES:
 				mwindow->gui->update(1,
 					1,
 					0,
@@ -248,8 +235,8 @@ int GWindowToggle::handle_event()
 					0);
 				break;
 
-			case TRANSITIONS:
-			case PLUGIN_AUTOS:
+			case NONAUTOTOGGLES_TRANSITIONS:
+			case NONAUTOTOGGLES_PLUGIN_AUTOS:
 				mwindow->gui->canvas->draw_overlays();
 				mwindow->gui->canvas->flash();
 				break;
@@ -262,26 +249,26 @@ int GWindowToggle::handle_event()
 	return 1;
 }
 
-int* GWindowToggle::get_main_value(MWindow *mwindow, int subscript, int other)
+int* GWindowToggle::get_main_value(MWindow *mwindow, int toggleref)
 {
-	if(subscript >= 0)
+	if(toggleref & ISAUTO)
 	{
-		return &mwindow->edl->session->auto_conf->autos[subscript];
+		return &mwindow->edl->session->auto_conf->autos[toggleref - ISAUTO];
 	}
 	else
 	{
-		switch(other)
+		switch(toggleref - NOTAUTO)
 		{
-			case ASSETS:
+			case NONAUTOTOGGLES_ASSETS:
 				return &mwindow->edl->session->show_assets;
 				break;
-			case TITLES:
+			case NONAUTOTOGGLES_TITLES:
 				return &mwindow->edl->session->show_titles;
 				break;
-			case TRANSITIONS:
+			case NONAUTOTOGGLES_TRANSITIONS:
 				return &mwindow->edl->session->auto_conf->transitions;
 				break;
-			case PLUGIN_AUTOS:
+			case NONAUTOTOGGLES_PLUGIN_AUTOS:
 				return &mwindow->edl->session->auto_conf->plugins;
 				break;
 		}
@@ -290,7 +277,7 @@ int* GWindowToggle::get_main_value(MWind
 
 void GWindowToggle::update()
 {
-	set_value(*get_main_value(mwindow, subscript, other));
+	set_value(*get_main_value(mwindow, toggleref));
 }
 
 
diff --git a/cinelerra/gwindowgui.h b/cinelerra/gwindowgui.h
index 4f839d4..ab0e23e 100644
--- a/cinelerra/gwindowgui.h
+++ b/cinelerra/gwindowgui.h
@@ -7,11 +7,13 @@ #include "mwindow.inc"
 
 class GWindowToggle;
 
-#define ASSETS 0
-#define TITLES 1
-#define TRANSITIONS 2
-#define PLUGIN_AUTOS 3
-#define OTHER_TOGGLES 4
+enum {
+	NONAUTOTOGGLES_ASSETS,
+	NONAUTOTOGGLES_TITLES,
+	NONAUTOTOGGLES_TRANSITIONS,
+	NONAUTOTOGGLES_PLUGIN_AUTOS,
+	NONAUTOTOGGLES_COUNT
+};
 
 class GWindowGUI : public BC_Window
 {
@@ -26,8 +28,7 @@ public:
 	void update_mwindow();
 
 	MWindow *mwindow;
-	GWindowToggle *other[OTHER_TOGGLES];
-	GWindowToggle *auto_toggle[AUTOMATION_TOTAL];
+	GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL];
 };
 
 class GWindowToggle : public BC_CheckBox
@@ -37,18 +38,16 @@ public:
 		GWindowGUI *gui, 
 		int x, 
 		int y, 
-		int subscript,
-		int other, 
+		int toggleref, 
 		char *text);
 	int handle_event();
 	void update();
 
-	static int* get_main_value(MWindow *mwindow, int subscript, int other);
+	static int* get_main_value(MWindow *mwindow, int toggleref);
 
 	MWindow *mwindow;
 	GWindowGUI *gui;
-	int subscript;
-	int other;
+	int toggleref;
 };
 
 #endif
diff --git a/cinelerra/viewmenu.C b/cinelerra/viewmenu.C
index f876904..d37a4e3 100644
--- a/cinelerra/viewmenu.C
+++ b/cinelerra/viewmenu.C
@@ -122,7 +122,7 @@ void ShowAutomation::update_toggle()
 
 
 PluginAutomation::PluginAutomation(MWindow *mwindow, char *hotkey)
- : BC_MenuItem(_("Plugin keyframes"), hotkey, hotkey[0]) 
+ : BC_MenuItem(_("Plugin Autos"), hotkey, hotkey[0]) 
 { 
 	this->mwindow = mwindow; 
 }

Reply via email to