First patch:
1) Prevent naming two clips the same (fixes bug 333)
2) Create useful default comments - include length of the clip and its origin

Second patch:
Minor performance tweak, when we are playing we need to update just clocks, not 
all the the zoombar widgets...

Third patch:
Saner default when loading 

bye
andraz
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/clipedit.C hvirtual-2.1/cinelerra/clipedit.C
--- hvirtual-svn/cinelerra/clipedit.C	2006-10-13 12:05:59.000000000 +0200
+++ hvirtual-2.1/cinelerra/clipedit.C	2006-10-14 23:45:17.000000000 +0200
@@ -10,7 +10,8 @@
 #include "mwindowgui.h"
 #include "vwindow.h"
 #include "vwindowgui.h"
-
+#include "errorbox.h"
+#include "tracks.h"
 
 
 
@@ -70,9 +71,41 @@
 
 
 		ClipEditWindow *window = new ClipEditWindow(mwindow, this);
+
 		window->create_objects();
-		int result = window->run_window();
-		
+
+		int  name_ok_or_cancel = 0;
+		int result;
+		while (!name_ok_or_cancel)
+		{ 
+			result = window->run_window();
+			if (result)
+				name_ok_or_cancel = 1;
+			else
+			{
+				// Check if clip name is unique
+				name_ok_or_cancel = 1;
+				for (int i = 0; i < mwindow->edl->clips.total; i++)
+				{
+					if (!strcasecmp(clip->local_session->clip_title,
+						mwindow->edl->clips.values[i]->local_session->clip_title) &&
+						(create_it || strcasecmp(clip->local_session->clip_title,
+						original->local_session->clip_title)))
+					
+						name_ok_or_cancel = 0;
+				}
+				if (!name_ok_or_cancel)
+				{
+					ErrorBox error(PROGRAM_NAME ": Error", 
+						mwindow->gui->get_abs_cursor_x(1), 
+						mwindow->gui->get_abs_cursor_y(1));
+					error.create_objects(_("A clip with that name already exists."));
+					error.run_window();
+					window->titlebox->activate();
+				}
+			}
+		}
+
 		if(!result)
 		{
 			EDL *new_edl = 0;
@@ -148,7 +181,6 @@
 	int x = 10, y = 10;
 	int x1 = x;
 	BC_TextBox *textbox;
-	BC_TextBox *titlebox;
 	BC_Title *title;
 
 	add_subwindow(title = new BC_Title(x1, y, _("Title:")));
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/clipedit.h hvirtual-2.1/cinelerra/clipedit.h
--- hvirtual-svn/cinelerra/clipedit.h	2006-10-12 12:09:08.000000000 +0200
+++ hvirtual-2.1/cinelerra/clipedit.h	2006-10-14 23:13:51.000000000 +0200
@@ -46,6 +46,7 @@
 	int create_it;
 	MWindow *mwindow;
 	ClipEdit *thread;
+	BC_TextBox *titlebox;
 };
 
 
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/mwindowedit.C hvirtual-2.1/cinelerra/mwindowedit.C
--- hvirtual-svn/cinelerra/mwindowedit.C	2006-10-13 12:05:59.000000000 +0200
+++ hvirtual-2.1/cinelerra/mwindowedit.C	2006-10-14 23:40:45.000000000 +0200
@@ -1981,6 +1982,16 @@
 	new_edl->create_objects();
 	new_edl->load_xml(plugindb, &file, LOAD_ALL);
 	sprintf(new_edl->local_session->clip_title, _("Clip %d"), session->clip_number++);
+	char string[BCTEXTLEN];
+	Units::totext(string, 
+			end - start, 
+			edl->session->time_format, 
+			edl->session->sample_rate, 
+			edl->session->frame_rate,
+			edl->session->frames_per_foot);
+
+	sprintf(new_edl->local_session->clip_notes, _("%s\nCreated from main window"), string);
+
 	new_edl->local_session->set_selectionstart(0);
 	new_edl->local_session->set_selectionend(0);
 
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/vwindowgui.C hvirtual-2.1/cinelerra/vwindowgui.C
--- hvirtual-svn/cinelerra/vwindowgui.C	2006-10-12 12:09:08.000000000 +0200
+++ hvirtual-2.1/cinelerra/vwindowgui.C	2006-10-14 23:40:41.000000000 +0200
@@ -49,6 +49,7 @@
 {
 	this->mwindow = mwindow;
 	this->vwindow = vwindow;
+	strcpy(loaded_title, "");
 }
 
 VWindowGUI::~VWindowGUI()
@@ -65,7 +66,7 @@
 		sprintf(string, PROGRAM_NAME ": %s", title);
 	else
 		sprintf(string, PROGRAM_NAME);
-
+	strcpy(loaded_title, title);
 	lock_window("VWindowGUI::change_source");
 	slider->set_position();
 	timebar->update();
@@ -628,6 +629,16 @@
 		new_edl->create_objects();
 		new_edl->load_xml(mwindow->plugindb, &file, LOAD_ALL);
 		sprintf(new_edl->local_session->clip_title, _("Clip %d"), mwindow->session->clip_number++);
+		char string[BCTEXTLEN];
+		Units::totext(string, 
+				end - start, 
+				edl->session->time_format, 
+				edl->session->sample_rate, 
+				edl->session->frame_rate,
+				edl->session->frames_per_foot);
+
+		sprintf(new_edl->local_session->clip_notes, _("%s\n Created from:\n%s"), string, vwindow->gui->loaded_title);
+
 		new_edl->local_session->set_selectionstart(0);
 		new_edl->local_session->set_selectionend(0);
 
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/vwindowgui.h hvirtual-2.1/cinelerra/vwindowgui.h
--- hvirtual-svn/cinelerra/vwindowgui.h	2006-10-12 12:09:08.000000000 +0200
+++ hvirtual-2.1/cinelerra/vwindowgui.h	2006-10-14 23:38:05.000000000 +0200
@@ -69,7 +69,7 @@
 	ArrayList<LabelGUI*> labels;
 	VWindowInPoint *in_point;
 	VWindowOutPoint *out_point;
-
+	char loaded_title[BCTEXTLEN];
 private:
 	void get_scrollbars(int &canvas_x, int &canvas_y, int &canvas_w, int &canvas_h);
 };
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/ctracking.C hvirtual-2.1/cinelerra/ctracking.C
--- hvirtual-svn/cinelerra/ctracking.C	2006-10-12 12:09:09.000000000 +0200
+++ hvirtual-2.1/cinelerra/ctracking.C	2006-10-14 17:53:36.000000000 +0200
@@ -134,7 +134,7 @@
 	if(!updated_scroll)
 	{
 		mwindow->gui->cursor->update();
-		mwindow->gui->zoombar->update();
+		mwindow->gui->zoombar->update_clocks();   // we just need to update clocks, not everything
 
 
 		mwindow->gui->canvas->flash();
diff -ru --exclude-from exclude hvirtual-svn/cinelerra/localsession.C hvirtual-2.1/cinelerra/localsession.C
--- hvirtual-svn/cinelerra/localsession.C	2006-10-12 12:09:09.000000000 +0200
+++ hvirtual-2.1/cinelerra/localsession.C	2006-10-14 15:02:38.000000000 +0200
@@ -41,7 +41,7 @@
 	loop_playback = 0;
 	loop_start = 0;
 	loop_end = 0;
-	zoom_sample = 0;
+	zoom_sample = 16384;
 	zoom_y = 0;
 	zoom_track = 0;
 	view_start = 0;
@@ -225,7 +225,7 @@
 	selectionend = defaults->get("SELECTIONEND", selectionend);
 //	track_start = defaults->get("TRACK_START", 0);
 //	view_start = defaults->get("VIEW_START", 0);
-	zoom_sample = defaults->get("ZOOM_SAMPLE", 1);
+	zoom_sample = defaults->get("ZOOM_SAMPLE", 16384);
 	zoom_y = defaults->get("ZOOMY", 64);
 	zoom_track = defaults->get("ZOOM_TRACK", 64);
 	red = defaults->get("RED", 0.0);

Reply via email to