Announcement

Collapse
No announcement yet.

Scintilla Background Color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scintilla Background Color

    Hey everyone,

    I'm using a scintilla control for a school project, however I've been wanting to
    change the background color and also let the user define the colors.

    Anyhow, I can set the background color for styles, but that will only set the
    background color for that line of text the style applies to, not the overall
    background color.

    Does anyone know a message to send to the scintilla control I can use to set
    the backgroundcolor for the whole (editor part) control?
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

  • #2
    I know $h!t about scintilla but I found this, is this what you're looking for, Bas?

    http://www.scintilla.org/ScintillaDo...#OtherSettings
    https://github.com/CentauriSoldier

    Comment


    • #3
      Originally posted by Centauri Soldier View Post
      I know $h!t about scintilla but I found this, is this what you're looking for, Bas?

      http://www.scintilla.org/ScintillaDo...#OtherSettings
      Unfortunately not, thanks.
      I've also been looking over that whole dam documentation, I've even tried setting the background
      color for each seperate style and applying SCI_STYLESETEOLFILLED on the default style. Didn't work
      Bas Groothedde
      Imagine Programming :: Blog

      AMS8 Plugins
      IMXLH Compiler

      Comment


      • #4
        Now your talking my language

        you need #STYLE_DEFAULT in SCI_StyleSetBack, that sets the overall background colour, but style and line/selection colours override the default

        any scintilla questions you have, im your man, i got that thing 100% mapped
        Embrace change in your life, you never know, it could all work out for the best

        Comment


        • #5
          Originally posted by RizlaUK View Post
          Now your talking my language

          you need #STYLE_DEFAULT in SCI_StyleSetBack, that sets the overall background colour, but style and line/selection colours override the default

          any scintilla questions you have, im your man, i got that thing 100% mapped
          Thanks mate, I already send that message with STYLE_DEFAULT, however it'll only colorize the parts containing
          characters, not the whole control. But that's probably because other styles overwrite them. Also, if I for example
          set the backcolor of another style (let's say comment) too, it'll only colorize the text-containing part and not the
          white space around it.

          So, my question is, do I have to customly draw the backgroundcolor? Or do I need to set the backgroundcolor for
          all freaking styles?

          We're talking the lua lexer btw It's a fun project I'll tell you about later :yes
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            Or do I need to set the backgroundcolor for
            all freaking styles?
            afraid so mate, there's not a great deal of them tho, it shouldn't take too long to write a function to set all back styles

            heres the macro i used in the old PX editor before i changed it all to xml (maybe its of some help)
            Code:
            Macro SetupScintilla(GadgetID)
                
                ;- Other 
                SCI_SetIndent(GadgetID,4)
                SCI_SetIndentationGuides(GadgetID,#True)
                SCI_UsePopUp(GadgetID,#False)    
                    
                ;Error marker
                SCI_MarkerDefine(GadgetID,0,#SC_MARK_ARROW)
                SCI_MarkerSetBack(GadgetID,0,255)
                SCI_MarkerSetFore(GadgetID,0,0)
                            
                ;- Font And Size 
                SCI_StyleSetFont(GadgetID,#STYLE_DEFAULT, @"Courier New")
                SCI_StyleSetSize(GadgetID,#STYLE_DEFAULT, 10) 
                
                ;- Margins
                ; number margin
                SCI_SetMarginTypen(GadgetID,0, #SC_MARGIN_NUMBER) 
                SCI_SetMarginWidthN(GadgetID,0, 37) 
                ; sep
                SCI_SetMarginTypen(GadgetID,1, #SC_MARGIN_SYMBOL)     
                SCI_SetMarginWidthN(GadgetID,1, 18) 
                ; folding margin
                SCI_SetMarginMaskN(GadgetID,2, #SC_MASK_FOLDERS) 
                SCI_SetMarginWidthN(GadgetID,2, 18) 
                SCI_SetMarginSensitiveN(GadgetID,2, #True) 
                
                ;- Choose folding icons 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDEROPEN, #SC_MARK_CIRCLEMINUS) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDER, #SC_MARK_CIRCLEPLUS) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDERSUB, #SC_MARK_VLINE) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDERTAIL, #SC_MARK_LCORNER) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDEREND, #SC_MARK_CIRCLEPLUSCONNECTED) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDEROPENMID, #SC_MARK_CIRCLEMINUSCONNECTED) 
                SCI_MarkerDefine(GadgetID,#SC_MARKNUM_FOLDERMIDTAIL, #SC_MARK_TCORNERCURVE) 
                
                ;- Choose folding icon colours 
                SCI_MarkerSetFore(GadgetID,#SC_MARKNUM_FOLDEROPEN, 14215660);RGB(236, 233, 216)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDEROPEN, RGB(128, 128, 128)) 
                SCI_MarkerSetFore(GadgetID,#SC_MARKNUM_FOLDER, RGB(236, 233, 216)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDER, RGB(128, 128, 128)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDERSUB, RGB(128, 128, 128)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDERTAIL, RGB(128, 128, 128)) 
                SCI_MarkerSetFore(GadgetID,#SC_MARKNUM_FOLDEREND, RGB(236, 233, 216)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDEREND, RGB(128, 128, 128)) 
                SCI_MarkerSetFore(GadgetID,#SC_MARKNUM_FOLDEROPENMID, RGB(236, 233, 216)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDEROPENMID, RGB(128, 128, 128)) 
                SCI_MarkerSetBack(GadgetID,#SC_MARKNUM_FOLDERMIDTAIL, RGB(128, 128, 128)) 
                
                ;- lex setup 
                SCI_SetLexer(GadgetID,#SCLEX_LUA)
                SCI_SetStyleBits(GadgetID,5)
                SCI_StyleSetFore(GadgetID,#STYLE_DEFAULT, RGB(0,0,0)) 
                SCI_StyleSetBack(GadgetID,#STYLE_DEFAULT, RGB(255,255,255))
                SCI_StyleClearAll(GadgetID)
                
                
                ;- Set caret line colour 
                SCI_SetCaretLineBack(GadgetID,12632256) 
                SCI_SetCaretLineVisible(GadgetID,#True) 
                
                ;- Comment block
                SCI_StyleSetFore(GadgetID,#SCE_LUA_DEFAULT, 0) ; Default Color 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_COMMENT, 32768) ; Coment Color 
                SCI_StyleSetFont(GadgetID,#SCE_LUA_COMMENT, @"Courier New") ; Coment Font 
                SCI_StyleSetSize(GadgetID,#SCE_LUA_COMMENT, 9) ; Coment Size
                 
                ;- Single line comment
                SCI_StyleSetSize(GadgetID,#SCE_LUA_COMMENTLINE, 9) ; Coment Size 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_COMMENTLINE, 32768) ; Coment Color 
                SCI_StyleSetFont(GadgetID,#SCE_LUA_COMMENTLINE, @"Courier New") ; Coment Font 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_NUMBER, 8421504)
                SCI_StyleSetBold(GadgetID,#SCE_LUA_NUMBER, #True) ; set number Bold  
                SCI_StyleSetFore(GadgetID,#SCE_LUA_STRING, 8388736) 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_OPERATOR, 255)
                SCI_StyleSetBold(GadgetID,#SCE_LUA_OPERATOR, #True) ; set operator Bold 
                ;SCI_StyleSetFore(GadgetID,#SCE_LUA_PREPROCESSOR, 255) 
                
                ;- Color Of Selection 
                SCI_SetSelBack(GadgetID,#True, RGB(49, 106, 197)) 
                SCI_SetSelFore(GadgetID,#True, RGB(255, 255, 255)) 
                
                ; Code Wraper 
                ;SCI_SETWRAPMODE(GadgetID,#SC_WRAP_WORD) 
                ;SCI_SETWRAPVISUALFLAGS(GadgetID,#SC_WRAPVISUALFLAG_START | #SC_WRAPVISUALFLAG_END) 
                
                ; Keyword 
            ;     SCI_SetKeywords(GadgetID,0, @KeyWord1) ; Set KeyWord 1 
            ;     SCI_SetKeywords(GadgetID,1, @KeyWord2) ; Set KeyWord 2 
            ;     SCI_SetKeywords(GadgetID,2, @KeyWord3) ; Set KeyWord 3 
            ;     SCI_SetKeywords(GadgetID,3, @KeyWord4) ; Set KeyWord 4 
            ;     SCI_SetKeywords(GadgetID,4, @KeyWord5) ; Set KeyWord 5 
            ;     SCI_SetKeywords(GadgetID,5, @KeyWord6) ; Set KeyWord 6 
            ;     SCI_SetKeywords(GadgetID,6, @KeyWord7) ; Set KeyWord 7 
            ;     SCI_SetKeywords(GadgetID,7, @KeyWord8) ; Set KeyWord 8 
                
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD, 16711680) 
                SCI_StyleSetBold(GadgetID,#SCE_LUA_WORD, #True)
                 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD2, 16744576)
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD3, 16744448)
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD4, 8388608)
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD5, 16711808) 
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD6, 8421440)
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD7, 32896)
                SCI_StyleSetFore(GadgetID,#SCE_LUA_WORD8, 255)
                
                
                ; Working Fold 
                SCI_SetProperty(GadgetID,@"fold", @"1") 
                SCI_SetProperty(GadgetID,@"fold.compact", @"0") 
                ;SCI_SetProperty(GadgetID,@"fold.comment", @"1") ; If enable this Line Your Comment get Fold 
                SCI_SetProperty(GadgetID,@"fold.preprocessor", @"1") 
                
            EndMacro
            Embrace change in your life, you never know, it could all work out for the best

            Comment


            • #7
              Oh it was my own error! I used the SCI_STYLECLEARALL message too early, and I was trying to set the overall background using the LCE_LUA_DEFAULT style. Stupid me

              It's working now by only setting one background :yes I'm using the default scintilla functions, ScintillaSendMessage, I've seen some includes wrapping them up but I like the actual 'function' being highlighted in constant color so I can find them quicker

              It's all working now Now it's just statically linking lua, creating a state and get *some word these forums mask out... crac...ing *


              Thanks Dean
              Bas Groothedde
              Imagine Programming :: Blog

              AMS8 Plugins
              IMXLH Compiler

              Comment


              • #8
                Ha, easy mistake to make

                heres my scintilla wrapper, its a dam sight easier to use than ScintillaSendMessage, compile it with talibite and use the static scintilla lib and you have everything built into the editor, no external files at all
                Embrace change in your life, you never know, it could all work out for the best

                Comment


                • #9
                  Bas, linking to lua, you rewriting Scite, lol or writing you own version of PX :(
                  Embrace change in your life, you never know, it could all work out for the best

                  Comment


                  • #10
                    Thanks, much appreciated :yes

                    Dean, your inbox seems to be filled up with messages
                    Bas Groothedde
                    Imagine Programming :: Blog

                    AMS8 Plugins
                    IMXLH Compiler

                    Comment


                    • #11
                      tis full already...again!

                      thnaks for the heads up :yes
                      Embrace change in your life, you never know, it could all work out for the best

                      Comment


                      • #12
                        Originally posted by RizlaUK View Post
                        Bas, linking to lua, you rewriting Scite, lol or writing you own version of PX :(
                        Neither of them It's, well, a sort of informative application.
                        I'll send a message
                        Bas Groothedde
                        Imagine Programming :: Blog

                        AMS8 Plugins
                        IMXLH Compiler

                        Comment

                        Working...
                        X