summaryrefslogtreecommitdiff
path: root/gtk-recordmydesktop/src
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-08-09 23:11:43 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-08-09 23:11:43 +0000
commitc364387c6657769e29ade8fe16038a1c9b6fa1e0 (patch)
tree57e4a0e606ec4c32c70d41b185fe5e399801063d /gtk-recordmydesktop/src
parentb5244639d1b3e38b1c56e03e7f65b8da44970233 (diff)
rmdConfig.py.in, rmdFrame.py, rmdPrefsWidget.py,
rmdSelectThumb.py, rmdSimple.py, rmdStrings.py, rmdTrayIcon.py : Added follow mouse option in the Preferences Widget and all relevant functionality ( save/load , defaults, string/tooltip). Also added moveFrame method so that the frame can follow the mouse. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@406 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'gtk-recordmydesktop/src')
-rw-r--r--gtk-recordmydesktop/src/rmdConfig.py.in2
-rw-r--r--gtk-recordmydesktop/src/rmdFrame.py26
-rw-r--r--gtk-recordmydesktop/src/rmdPrefsWidget.py26
-rwxr-xr-xgtk-recordmydesktop/src/rmdSelectThumb.py16
-rw-r--r--gtk-recordmydesktop/src/rmdSimple.py11
-rw-r--r--gtk-recordmydesktop/src/rmdStrings.py5
-rw-r--r--gtk-recordmydesktop/src/rmdTrayIcon.py15
7 files changed, 75 insertions, 26 deletions
diff --git a/gtk-recordmydesktop/src/rmdConfig.py.in b/gtk-recordmydesktop/src/rmdConfig.py.in
index ff17ebc..60bdf42 100644
--- a/gtk-recordmydesktop/src/rmdConfig.py.in
+++ b/gtk-recordmydesktop/src/rmdConfig.py.in
@@ -22,7 +22,7 @@ default_values=[15, #framerate
#but when the value is set to this the argument is omitted
0, #shared memory,0 on 1 off
0, #reset recording area ,0 on 1 off
- 75, #shared threshold.Removed at 0.3.4, preserved for compatibility of prefs file.
+ 1, #follow mouse,0 on 1 off
1, #quick subsampling,0 on 1 off
"/tmp", #working directory
1, #on the fly encoding,0 on 1 off
diff --git a/gtk-recordmydesktop/src/rmdFrame.py b/gtk-recordmydesktop/src/rmdFrame.py
index f5187e4..2dc556f 100644
--- a/gtk-recordmydesktop/src/rmdFrame.py
+++ b/gtk-recordmydesktop/src/rmdFrame.py
@@ -26,19 +26,20 @@
import pygtk
pygtk.require('2.0')
import gtk
+import gobject
class rmdFrame:
borderwidth=6
outlinewidth=1
- def __init__(self,x,y,w,h):
+ def __init__(self,x,y,w,h,parent):
self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
self.area=gtk.DrawingArea()
self.x=x
self.y=y
self.w=w
self.h=h
-
+ self.parent=parent
mask = gtk.gdk.Pixmap(None,
self.w+self.borderwidth*2,
self.h+self.borderwidth*2,
@@ -71,6 +72,27 @@ class rmdFrame:
self.window.move(self.x-self.borderwidth,
self.y-self.borderwidth)
self.window.set_resizable(False)
+ self.disp=gtk.gdk.display_get_default()
+ self.wroot = gtk.gdk.get_default_root_window()
+ (self.wwidth, self.wheight) = self.wroot.get_size()
+ self.timed_id=gobject.timeout_add(10,self.moveFrame)
+
+ def moveFrame(self):
+ if self.parent.values[15]==0:
+ npos=gtk.gdk.Display.get_pointer(self.disp)
+ x=npos[1]-self.w/2
+ y=npos[2]-self.h/2
+ x=(x>>1)<<1
+ y=(y>>1)<<1
+ if x<0:x=0
+ if y<0:y=0
+ if x+self.w>self.wwidth:x=self.wwidth-self.w
+ if y+self.h>self.wheight:y=self.wheight-self.h
+ if(x!=self.x or y!= self.y):
+ self.x=x
+ self.y=y
+ self.window.move(self.x-(self.borderwidth),self.y-(self.borderwidth))
+ return True
def __expose_cb(self, widget, event):
diff --git a/gtk-recordmydesktop/src/rmdPrefsWidget.py b/gtk-recordmydesktop/src/rmdPrefsWidget.py
index 050be4f..480fc4d 100644
--- a/gtk-recordmydesktop/src/rmdPrefsWidget.py
+++ b/gtk-recordmydesktop/src/rmdPrefsWidget.py
@@ -42,7 +42,7 @@ from rmdStrings import *
class prefsWidget(object):
def __tooltips__(self):
self.tooltips=gtk.Tooltips()
- for i in range(18):
+ for i in range(19):
self.tooltips.set_tip(self.eboxes[i],prefTooltipLabels[i])
self.tooltips.set_tip(self.jack_ebox,prefJacktip)
@@ -56,7 +56,7 @@ class prefsWidget(object):
self.values[12]=self.displayEntry.get_text().replace(' ','')
self.values[13]=self.sharedComboBox.get_active()
self.values[14]=self.areaResetComboBox.get_active()
-# self.values[15]=self.thresSpinButton.get_value_as_int()
+ self.values[15]=self.followMouseComboBox.get_active()
self.values[16]=self.quickComboBox.get_active()
self.values[17]=self.workdirEntry.get_text()
self.values[18]=self.onTheFlyComboBox.get_active()
@@ -236,7 +236,7 @@ class prefsWidget(object):
self.boxes[9].pack_end(self.deviceEntry,expand=False,fill=False)
#misc page
- for i in xrange(10,18):
+ for i in xrange(10,19):
self.labels[i]=gtk.Label(prefLabelStrings[i])
self.labels[i].set_justify(gtk.JUSTIFY_LEFT)
self.boxes[i]=gtk.HBox(homogeneous=False, spacing=0)
@@ -259,27 +259,33 @@ class prefsWidget(object):
self.mouseComboBox.show()
self.boxes[11].pack_end(self.mouseComboBox,expand=False,fill=False)
+ self.followMouseComboBox = gtk.combo_box_new_text()
+ for i in range(2):
+ self.followMouseComboBox.append_text(prefStateStrings[i])
+ self.followMouseComboBox.set_active(self.values[15])
+ self.followMouseComboBox.show()
+ self.boxes[12].pack_end(self.followMouseComboBox,expand=False,fill=False)
self.sharedComboBox = gtk.combo_box_new_text()
for i in range(2):
self.sharedComboBox.append_text(prefStateStrings[i])
self.sharedComboBox.set_active(self.values[13])
self.sharedComboBox.show()
- self.boxes[12].pack_end(self.sharedComboBox,expand=False,fill=False)
+ self.boxes[13].pack_end(self.sharedComboBox,expand=False,fill=False)
self.winDecoComboBox = gtk.combo_box_new_text()
for i in range(2):
self.winDecoComboBox.append_text(prefStateStrings[i])
self.winDecoComboBox.set_active(self.values[21])
self.winDecoComboBox.show()
- self.boxes[13].pack_end(self.winDecoComboBox,expand=False,fill=False)
+ self.boxes[14].pack_end(self.winDecoComboBox,expand=False,fill=False)
self.tooltipsComboBox = gtk.combo_box_new_text()
for i in range(2):
self.tooltipsComboBox.append_text(prefStateStrings[i])
self.tooltipsComboBox.set_active(self.values[24])
self.tooltipsComboBox.show()
- self.boxes[14].pack_end(self.tooltipsComboBox,expand=False,fill=False)
+ self.boxes[15].pack_end(self.tooltipsComboBox,expand=False,fill=False)
self.rFrameComboBox = gtk.combo_box_new_text()
@@ -287,21 +293,21 @@ class prefsWidget(object):
self.rFrameComboBox.append_text(prefStateStrings[i])
self.rFrameComboBox.set_active(self.values[25])
self.rFrameComboBox.show()
- self.boxes[15].pack_end(self.rFrameComboBox,expand=False,fill=False)
+ self.boxes[16].pack_end(self.rFrameComboBox,expand=False,fill=False)
self.areaResetComboBox = gtk.combo_box_new_text()
for i in range(2):
self.areaResetComboBox.append_text(prefStateStrings[i])
self.areaResetComboBox.set_active(self.values[14])
self.areaResetComboBox.show()
- self.boxes[16].pack_end(self.areaResetComboBox,expand=False,fill=False)
+ self.boxes[17].pack_end(self.areaResetComboBox,expand=False,fill=False)
self.extraOptsEntry= gtk.Entry(max=0)
self.extraOptsEntry.set_text(self.values[26])
self.extraOptsEntry.show()
- self.boxes[17].pack_end(self.extraOptsEntry,expand=False,fill=False)
+ self.boxes[18].pack_end(self.extraOptsEntry,expand=False,fill=False)
- for i in range(18):
+ for i in range(19):
self.boxes[i].show()
self.eboxes[i].show()
diff --git a/gtk-recordmydesktop/src/rmdSelectThumb.py b/gtk-recordmydesktop/src/rmdSelectThumb.py
index 5e305a5..b9533aa 100755
--- a/gtk-recordmydesktop/src/rmdSelectThumb.py
+++ b/gtk-recordmydesktop/src/rmdSelectThumb.py
@@ -192,8 +192,11 @@ class GtkThumbSelector(gtk.DrawingArea):
if self.area_return[3]>=0:
vals[3]=self.area_return[3]-self.area_return[1]
if vals[0] >0 or vals[1] >0 or vals[2] <self.wwidth or vals[3] <self.wheight:
- if self.selecting==0:
+ if self.selecting==0 and self.caller.values[15]==1:
self.__draw_lines__(self.root,vals,self.factor)
+ elif self.selecting==0 and self.caller.values[15]==0:
+ self.__check_frame__()
+
elif self.realFrame!=None:
self.realFrame.destroy()
self.realFrame=None
@@ -210,9 +213,13 @@ class GtkThumbSelector(gtk.DrawingArea):
img.put_pixel(vals[0]/factor+k,i,0xff0000)
img.put_pixel((vals[0]+vals[2]/2-k)/factor,i,0xff0000)
img.put_pixel((vals[0]+vals[2]-1-k)/factor,i,0xff0000)
+ self.__check_frame__()
+
+ def __check_frame__(self):
if self.realFrame!=None:
- if (self.area_return[0]!=self.realFrame.x or
- self.area_return[1]!=self.realFrame.y or
+ if (((self.area_return[0]!=self.realFrame.x or
+ self.area_return[1]!=self.realFrame.y) and
+ self.caller.values[15]==1) or
self.area_return[2]-self.area_return[0]!=self.realFrame.w or
self.area_return[3]-self.area_return[1]!=self.realFrame.h or
self.caller.values[25]):
@@ -228,7 +235,8 @@ class GtkThumbSelector(gtk.DrawingArea):
self.realFrame=rmdFrame(self.area_return[0],
self.area_return[1],
self.area_return[2]-self.area_return[0],
- self.area_return[3]-self.area_return[1])
+ self.area_return[3]-self.area_return[1],
+ self.caller)
#area_return=[-1,-1,-1,-1]
diff --git a/gtk-recordmydesktop/src/rmdSimple.py b/gtk-recordmydesktop/src/rmdSimple.py
index 671d619..1bf2c2a 100644
--- a/gtk-recordmydesktop/src/rmdSimple.py
+++ b/gtk-recordmydesktop/src/rmdSimple.py
@@ -303,7 +303,7 @@ class simpleWidget(object):
self.values[5]=[]
for i in rmdConfig.default_values[5]:
self.values[5].append(i)
- #open for some future option
+ #loaded further bellow
self.values.append(0)
savefile.readline()
self.values.append(int(savefile.readline()))
@@ -349,6 +349,13 @@ class simpleWidget(object):
self.values.append(rmdConfig.default_values[26])
else:
self.values.append(savefile.readline().replace("\n",""))
+ p=savefile.readline()
+ if p=='':
+ self.values[15]=rmdConfig.default_values[15]
+ else:
+ t_followmouse=int(savefile.readline())
+ if t_followmouse>1: t_followmouse=1
+ self.values[15]=t_followmouse
return True
except:
return False
@@ -415,6 +422,8 @@ class simpleWidget(object):
savefile.write("%d\n"%self.values[25])
savefile.write("#Extra options\n")
savefile.write("%s\n"%self.values[26])
+ savefile.write("#Follow mouse,1 disabled 0 enabled\n")
+ savefile.write("%d\n"%self.values[15])
savefile.flush()
savefile.close()
return True
diff --git a/gtk-recordmydesktop/src/rmdStrings.py b/gtk-recordmydesktop/src/rmdStrings.py
index b0d82d0..108d4f6 100644
--- a/gtk-recordmydesktop/src/rmdStrings.py
+++ b/gtk-recordmydesktop/src/rmdStrings.py
@@ -69,8 +69,8 @@ prefLabelStrings=[_('Overwite Existing Files'),_('Working Directory'),
_('Frames Per Second'),_('Encode On the Fly'),_('Zero Compression'),
_('Quick Subsampling'),_('Full shots at every frame'),
_('Channels'),_('Frequency'),_('Device'),_('Display'),_('Mouse Cursor'),
- _('MIT-Shm extension'),_('Include Window Decorations'),_('Tooltips'),
- _('Outline Capture Area On Screen'),
+ _('Follow Mouse'),_('MIT-Shm extension'),_('Include Window Decorations'),
+ _('Tooltips'),_('Outline Capture Area On Screen'),
_('Reset Capture Area'),
_('Extra Options'),
_('Video Quality'),_('Sound Quality'),
@@ -90,6 +90,7 @@ prefTooltipLabels=[_('By default, if you try to save under a filename that alrea
_('ALSA sound device, that is used for sound recording.'),
_('Connection to the Xserver.'),
_('The mouse cursor that will be drawn.\nNormal is for the real cursor that you see while recording,\nwhile black and white are fake cursors, drawn by the program.\nYou can also disable cursor drawing.'),
+ _('When This option is enabled, the capture\narea will follow your mouse cursor.\nEnabling this option will also enable full shots at\nevery frame, so it\'s not recommended\nfor large capture areas.'),
_('Use the MIT-Shared memory extension, whenever appropriate,\n depending on the rest of the program settings.\nDisabling this option is not recommended,\nas it may severely slow down the program.'),
_('When selecting a window via the "Select Window" button,\ninclude that window\'s decorations in the recording area.'),
_('Enable or disable tooltips, like this one.\n(Requires restart)'),
diff --git a/gtk-recordmydesktop/src/rmdTrayIcon.py b/gtk-recordmydesktop/src/rmdTrayIcon.py
index 560d2bf..f6907f0 100644
--- a/gtk-recordmydesktop/src/rmdTrayIcon.py
+++ b/gtk-recordmydesktop/src/rmdTrayIcon.py
@@ -150,12 +150,13 @@ class trayIcon(object):
self.execargs.append("--full-shots")
if self.parent.values[13] == 1:
self.execargs.append("--no-shared")
- if self.parent.values[5][0]>0 :
- self.execargs.append('-x')
- self.execargs.append('%d'%self.parent.values[5][0])
- if self.parent.values[5][1]>0:
- self.execargs.append('-y')
- self.execargs.append('%d'%self.parent.values[5][1])
+ if self.parent.values[15]==1:
+ if self.parent.values[5][0]>0 :
+ self.execargs.append('-x')
+ self.execargs.append('%d'%self.parent.values[5][0])
+ if self.parent.values[5][1]>0:
+ self.execargs.append('-y')
+ self.execargs.append('%d'%self.parent.values[5][1])
if self.parent.values[5][2]>0 and self.parent.values[5][3]>0:
self.execargs.append('-width')
self.execargs.append('%d'%(self.parent.values[5][2]-self.parent.values[5][0]))
@@ -191,6 +192,8 @@ class trayIcon(object):
self.execargs.append('--compress-cache')
if self.parent.values[20] == True:
self.execargs.append('--overwrite')
+ if self.parent.values[15] == 0:
+ self.execargs.append('--follow-mouse')
if self.parent.values[22] == True:
self.execargs.append('-use-jack')
for i in self.parent.values[23]:
© All Rights Reserved