Пример #1
0
    def drawMarker(self, iMarker, cycle=0):
        # load special marker RGBA images
        if iMarker == self.m_active:
            rgb, rgba, rgba_r = self.specialMarkers[iMarker][cycle]
        else:
            rgb, rgba, rgba_r = self.specialMarkers[iMarker]

        editor.rGBAImageSetWidth(self.markerWidth)
        editor.rGBAImageSetHeight(self.markerHeight)
        editor.markerDefine(iMarker, Npp.MARKERSYMBOL.LEFTRECT)
        editor.markerSetBack(iMarker, rgb)
        editor.markerDefineRGBAImage(iMarker + 1, rgba)
        editor.markerDefine(iMarker + 1, Npp.MARKERSYMBOL.RGBAIMAGE)
        editor.markerDefineRGBAImage(iMarker + 2, rgba_r)
        editor.markerDefine(iMarker + 2, Npp.MARKERSYMBOL.RGBAIMAGE)
Пример #2
0
MARK_HIDELINESBEGIN_MASK = 1 << MARK_HIDELINESBEGIN
MARK_HIDELINESEND_MASK = 1 << MARK_HIDELINESEND
MARK_HIDELINESUNDERLINE_MASK = 1 << MARK_HIDELINESUNDERLINE
MARK_COMBINED_MASK = MARK_HIDELINESBEGIN_MASK + MARK_HIDELINESEND_MASK

editor.setMarginMaskN(1, (MARK_HIDELINESBEGIN_MASK
                          | MARK_HIDELINESEND_MASK
                          | MARK_HIDELINESUNDERLINE_MASK
                          | NPP_MARK_BOOKMARK_MASK
                          | NPP_MARK_HIDELINESBEGIN_MASK
                          | NPP_MARK_HIDELINESEND_MASK
                          | NPP_MARK_HIDELINESUNDERLINE_MASK))

editor.rGBAImageSetWidth(14)
editor.rGBAImageSetHeight(14)
editor.markerDefineRGBAImage(MARK_HIDELINESBEGIN, hidelines_begin14)
editor.markerDefineRGBAImage(MARK_HIDELINESEND, hidelines_end14)
editor.markerDefine(MARK_HIDELINESUNDERLINE, MARKERSYMBOL.UNDERLINE)
editor.markerSetBack(MARK_HIDELINESUNDERLINE, (0xF7, 0xCC, 0x77))


# ---------------------------------------------------------------------------------
# helper functions
# toggle_bookmark is only needed to cheat npp
def toggle_bookmark(current_line):
    current_marker_mask = editor.markerGet(current_line)
    if (current_marker_mask
            & NPP_MARK_BOOKMARK_MASK) == NPP_MARK_BOOKMARK_MASK:
        editor.markerDelete(current_line, NPP_MARK_BOOKMARK)
    else:
        editor.markerAdd(current_line, NPP_MARK_BOOKMARK)