Exemplo n.º 1
0
 def update_undo_buffer(self,iterate):
     self.modified=True
     w = self.surface.get_width()
     h = self.surface.get_height()
     s = self.surface.get_stride()
     data = self.surface.get_data()
     buf = self.undo_buffer.cur_buf
     self.undo_buffer.Buffer[buf] = create_string_buffer(s*h)
     self.undo_buffer.Buffer[buf][:] = data[:]
     self.undo_buffer.width[buf] = w
     self.undo_buffer.height[buf] = h
     if iterate==1:
         self.emit("change_sensitivty", senstivity_data('undo',True))
         self.emit("change_sensitivty", senstivity_data('redo',False))
         self.undo_buffer.redos_allowed = 0
         if self.undo_buffer.n_buf_full<self.undo_buffer.n_buf:
             self.undo_buffer.n_buf_full += 1
         self.undo_buffer.cur_buf = self.undo_buffer.next_buf()
Exemplo n.º 2
0
 def update_undo_buffer(self, iterate):
     self.modified = True
     w = self.surface.get_width()
     h = self.surface.get_height()
     s = self.surface.get_stride()
     data = self.surface.get_data()
     buf = self.undo_buffer.cur_buf
     self.undo_buffer.Buffer[buf] = create_string_buffer(s * h)
     self.undo_buffer.Buffer[buf][:] = data[:]
     self.undo_buffer.width[buf] = w
     self.undo_buffer.height[buf] = h
     if iterate == 1:
         self.emit("change_sensitivty", senstivity_data('undo', True))
         self.emit("change_sensitivty", senstivity_data('redo', False))
         self.undo_buffer.redos_allowed = 0
         if self.undo_buffer.n_buf_full < self.undo_buffer.n_buf:
             self.undo_buffer.n_buf_full += 1
         self.undo_buffer.cur_buf = self.undo_buffer.next_buf()
Exemplo n.º 3
0
 def redo(self):
     if self.undo_buffer.redos_allowed > 0:
         self.modified = True
         buf = self.undo_buffer.next_buf()
         data = self.surface.get_data()
         w = self.surface.get_width()
         h = self.surface.get_height()
         bw = self.undo_buffer.width[buf]
         bh = self.undo_buffer.height[buf]
         if bh != h | bw != w:
             self.set_size(bw, bh)
             self.print_tool()
             data = self.surface.get_data()
         data[:] = self.undo_buffer.Buffer[buf][:]
         self.undo_buffer.redos_allowed -= 1
         self.undo_buffer.n_buf_full += 1
         self.undo_buffer.cur_buf = buf
         self.swap_buffers()
         self.emit("change_sensitivty", senstivity_data('undo', True))
         if self.undo_buffer.redos_allowed == 0:
             self.emit("change_sensitivty", senstivity_data('redo', False))
Exemplo n.º 4
0
 def redo(self):
     if self.undo_buffer.redos_allowed>0:
         self.modified=True
         buf = self.undo_buffer.next_buf()
         data = self.surface.get_data()
         w = self.surface.get_width()
         h = self.surface.get_height()
         bw = self.undo_buffer.width[buf]
         bh = self.undo_buffer.height[buf]
         if bh!=h | bw!=w:
             self.set_size(bw,bh)
             self.print_tool()
             data = self.surface.get_data()
         data[:] = self.undo_buffer.Buffer[buf][:]
         self.undo_buffer.redos_allowed -=1
         self.undo_buffer.n_buf_full +=1
         self.undo_buffer.cur_buf = buf
         self.swap_buffers()
         self.emit("change_sensitivty", senstivity_data('undo',True))
         if self.undo_buffer.redos_allowed==0:
             self.emit("change_sensitivty", senstivity_data('redo',False))
Exemplo n.º 5
0
 def clear_undo_buffer(self):
     self.emit("change_sensitivty", senstivity_data('undo', False))
     self.emit("change_sensitivty", senstivity_data('redo', False))
     self.undo_buffer.cur_buf = 0
     self.undo_buffer.n_buf_full = 0
     self.undo_buffer.redos_allowed = 0
Exemplo n.º 6
0
 def set_selection(self, value):
     if self.select_active != value:
         self.select_active = value
         self.emit("change_sensitivty", senstivity_data('crop', value))
Exemplo n.º 7
0
 def clear_undo_buffer(self):
     self.emit("change_sensitivty", senstivity_data('undo',False))
     self.emit("change_sensitivty", senstivity_data('redo',False))
     self.undo_buffer.cur_buf = 0
     self.undo_buffer.n_buf_full = 0
     self.undo_buffer.redos_allowed = 0
Exemplo n.º 8
0
 def set_selection(self,value):
     if self.select_active != value:
         self.select_active = value
         self.emit("change_sensitivty", senstivity_data('crop',value))