← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 729: Fixed a bug in calculating if a clip was moved. Added checks if the timeline is being moved/scro...

 

------------------------------------------------------------
revno: 729
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Fri 2012-09-28 19:28:36 -0500
message:
  Fixed a bug in calculating if a clip was moved.  Added checks if the timeline is being moved/scrolled with the middle mouse button, and if so, don't open up the clip properties.
modified:
  openshot/classes/clip.py
  openshot/themes/holo/theme.xml


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/classes/clip.py'
--- openshot/classes/clip.py	2012-09-22 22:40:51 +0000
+++ openshot/classes/clip.py	2012-09-29 00:28:36 +0000
@@ -75,6 +75,8 @@
 		# init vars for drag n drop
 		self.drag_x = 0.0
 		self.drag_y = 0.0
+		self.moved = False
+		self.is_timeline_scrolling = False
 
 		# For example:  imagine a clip that is 30 seconds long.  If we wanted to only play a 10 second section (from 15 to 25 
 		# second range) of this clip, and we wanted the 10 second section to start playing 3 seconds into the tracks timeline, 
@@ -1553,7 +1555,7 @@
 
 		# get the new x,y coordinates from the mouse
 		new_x = float(event.x)
-		new_y = float(event.y)	
+		new_y = float(event.y)
 
 		# get the pixels per second from the parent sequence
 		pixels_per_second = self.parent.parent.get_pixels_per_second()
@@ -1561,10 +1563,13 @@
 		# determine end pixel of sequence
 		end_of_timeline = self.parent.parent.length * pixels_per_second
 
-
 		# determine what cursor mode is enable (arrow, razor, snap, etc...)
 		(isArrow, isRazor, isSnap, isResize) = self.parent.parent.project.form.get_toolbar_options()
 
+		# determine if the timeline is being scrolled (with the middle mouse button)
+		if self.parent.parent.project.form.is_timeline_scrolling:
+			self.is_timeline_scrolling = True
+
 		# ARROW MODE
 		if isArrow:
 
@@ -1581,6 +1586,7 @@
 				if self.get_valid_drop(item.get_bounds().x1 + total_x_diff, item.get_bounds().y1 + total_y_diff):
 					# mark project as modified
 					self.parent.parent.project.set_project_modified(is_modified=True, refresh_xml=True)
+					self.moved = True
 
 					# Determine CTRL snapping amount (if CTRL key is pressed)
 					if not self.parent.parent.project.form._CTRL:
@@ -1670,6 +1676,7 @@
 
 						# mark project as modified
 						self.parent.parent.project.set_project_modified(is_modified=True, refresh_xml=True)
+						self.moved = True
 
 						self.position_on_track = new_position
 						self.start_time = new_start_time
@@ -1701,6 +1708,7 @@
 
 						# mark project as modified
 						self.parent.parent.project.set_project_modified(is_modified=True, refresh_xml=True)
+						self.moved = True
 
 						# re-render this clip to the canvas (passing the canvas group to the RenderClip method)
 						self.RenderClip(item, x_offset, y_offset)
@@ -1747,9 +1755,10 @@
 		item.raise_(None)
 
 		# set the x and y where the cursor started dragging from
-		self.start_drag_x = float(event.x)
 		self.drag_x = float(event.x)
 		self.drag_y = float(event.y)
+		self.moved = False
+		self.is_timeline_scrolling = False
 		
 		# Do not show clip properties by default
 		self.request_show_properties = False
@@ -2102,7 +2111,7 @@
 					distance_from_clip = 0.0
 
 				# check if clip has been really moved or not
-				if ((self.drag_x == item.get_bounds().x1) and (self.drag_y == item.get_bounds().y1)):
+				if not self.moved:
 					# The clip was not moved
 					type_of_event = None
 				else:
@@ -2148,7 +2157,7 @@
 				self.parent.parent.project.set_project_modified(is_modified=True, refresh_xml=True, type = _("Resized clip"))
 
 		# Do we show the clip properties?
-		if self.request_show_properties:
+		if self.request_show_properties and not self.moved and not self.is_timeline_scrolling:
 			self.show_properties(item, 0)
 
 		# raise the play-head line, so it's not covered up
@@ -2312,6 +2321,10 @@
 			state['drag_x'] = 0.0
 		if 'drag_y' not in state:
 			state['drag_y'] = 0.0
+		if 'moved' not in state:
+			state['moved'] = False
+		if 'is_timeline_scrolling' not in state:
+			state['is_timeline_scrolling'] = False			
 
 		# update the state object with new schema changes
 		self.__dict__.update(state)

=== modified file 'openshot/themes/holo/theme.xml'
--- openshot/themes/holo/theme.xml	2012-09-27 22:33:34 +0000
+++ openshot/themes/holo/theme.xml	2012-09-29 00:28:36 +0000
@@ -98,7 +98,7 @@
 			<y>2</y>
 		</transition_name_text>
 		<rectangle>
-			<stroke_color_rgba>000000b1</stroke_color_rgba>
+			<stroke_color_rgba>4c94afff</stroke_color_rgba>
 			<fill_color_rgba>000000b1</fill_color_rgba>
 			<line_width>1.0</line_width>
 			<y>20</y>