import wx
import os

#Version: 0.0.0, 08.04.2007.


def Plugin(DrFrame):
    DrFrame.wildcard = "All Files (*)|*|Python Source (*.pyw *.py *.txt)|*.pyw;*.py;*.txt|C/C++ Source (*.c *.cc *.cpp *.cxx *.h *.hh *.hpp *.hxx)|*.c;*.cc;*.cpp;*.cxx;*.h;*.hh;*.hpp;*.hxx|HTML Files (*.htm *.html *.shtm *.shtml *.xml)|*.htm;*.html;*.shtm;*.shtml;*.xml|Backup Files (*.bak)|*.bak|Plain Text (*.txt *.dat *.log)|*.txt;*.dat;*.log"
    def MySetStatusText(text, col):
        if col == 1:
            #text.find
            ind1 = text.find ("Col: ")
            if ind1 > -1:
                ind1 += len ("Col: ")
                ind2 = text.find (" ", ind1)
                nr = int (text [ind1:ind2]) + 1
                text = text [:ind1] + str (nr) + text[ind2:]
                ind1 = text.find ("->")
                ind2 = text.find (" ", ind1)
                if text [ind1:] == "->MIXED":
                    st = ": SPACES"
                    if DrFrame.txtDocument.GetUseTabs():
                        st = ": TABS"
                    text = text [:ind1+7] + st + text [ind1+7:]
#               text = text [:ind1] + str (nr) + text[ind2:]


                text = text + " Pos: " + str(DrFrame.txtDocument.GetCurrentPos())
                #access = 1
                if not os.access(DrFrame.txtDocument.filename, os.W_OK):
                    text = text + " R/O"

        #super(type(DrFrame), DrFrame).SetStatusText(text, col)
        #print text, col
        DrFrame.OrigStatusText (text, col)

    DrFrame.OrigStatusText = DrFrame.SetStatusText
    DrFrame.SetStatusText = MySetStatusText
