# Path: plugins/examples/Bookmark2/signals.py
# class Signals(SignalManager):
#     toggle         = Signal()
#     remove_all     = Signal(1)
#     show           = Signal()
#     hide           = Signal()
#     add            = Signal(2)
#     remove         = Signal(2)
#     lines          = Signal(1)
#     bookmark_lines = Signal(1)
#     model_data     = Signal(1)
#     scroll_to_line = Signal(1)
#     updated_model  = Signal()


from .signals import Signals

class Marker(object):

    def __init__(self, signals, editor):
        self.editor = editor
        self.signals = signals        
        self.lines = []
        
        self.signals.connect_signals(self)

    @Signals.toggle
    def toggle(self, sender):
        line = self.editor.cursor.get_line()
        
        if line in self.lines:
            self.signals.remove.emit(line, True)
        else:
            self.signals.add.emit(line, True)
            
        return False


# Path: plugins/examples/Bookmark2/signals.py
# class Signals(SignalManager):
#     toggle         = Signal()
#     remove_all     = Signal(1)
#     show           = Signal()
#     hide           = Signal()
#     add            = Signal(2)
#     remove         = Signal(2)
#     lines          = Signal(1)
#     bookmark_lines = Signal(1)
#     model_data     = Signal(1)
#     scroll_to_line = Signal(1)
#     updated_model  = Signal()


# Path: plugins/examples/Bookmark2/Marker.py
from .signals import Signals


class Marker(object):

    def __init__(self, signals, editor):
        self.editor = editor
        self.signals = signals        
        self.lines = []
        
        self.signals.connect_signals(self)

    @Signals.toggle
    def toggle(self, sender):
        line = self.editor.cursor.get_line()
        
        if line in self.lines:
            self.signals.remove.emit(line, True)
        else:
            self.signals.add.emit(line, True)
            
        return False


    @Signals.lines(idle=False)