#1058 Allow setting edge style for Scintilla control in SciTe on Windows

Completed
open
nobody
None
5
2014-07-10
2014-07-06
klo
No

SciTE embeds Scintilla control with "Sunken" edge style: http://i.imgur.com/zfLo95R.png

screenshot

Assuming it's does not require hard work, please allow two more flags for controlling edge style: Grey and None, in SciTE properties file.

Thanks

Discussion

  • Neil Hodgson

    Neil Hodgson - 2014-07-06

    Its the content window which holds the two Scintilla windows that has the WS_EX_CLIENTEDGE style. I don't know of any flag for a grey border. Which style flags do you want set and on which window should they be set?

     
  • klo

    klo - 2014-07-06

    Hi Neil,

    thanks for your reply.

    I think edge style should be applied same on content window and both Scintilla controls (editor and output panes).

    I assume setting edge to None can be set easily.

    I don't code C++, but grey edge is single line border (in .Net it's "FixedSingle"), and maybe for C++ it's WS_BORDER, if applicable? (I discarded WS_EX_STATICEDGE and WS_EX_WINDOWEDGE)
    It should be possible, as edge examples in the screenshot are from C++ application which uses standard windows forms.

     
    Last edit: klo 2014-07-06
    • Neil Hodgson

      Neil Hodgson - 2014-07-06

      Here is SciTE on Windows 7 with the original settings, no border, and WS_BORDER.
      different borders
      To me, both variants appear worse than the original.

       
  • klo

    klo - 2014-07-07

    I think that edge style with single line border will look more native on flat Windows 8 design. Windows Explorer, IE and rest of Windows 8 applications have single line border. Firefox, Total Commander... all have single line border in tabbed interface. They would look dated otherwise.
    On Windows 7, applications with single line border, look better to me. Sunken seems best for windows with no visual style (Windows 95 style). It's even hard to find updated application on Windows 7/8 with sunken edge.

    screenshot

    Notepad and some other applications have interesting edge, which differs from single line:

    screenshot

    On your screenshots however, the last sample (WS_BORDER) seems to have single line only on top border – the left and bottom borders are couple of pixels wide.
    Sample with no border looks best to me from three, but on both separator between editor and output pane does not seem to follow set border style.

    I hope, you decide to make this available as property setting.

     
  • Neil Hodgson

    Neil Hodgson - 2014-07-07

    The WS_BORDER style appears, to me, extra-heavy on the bottom and right compared to the current state.

     
  • klo

    klo - 2014-07-07

    Yep, there must be some other flag people are using.
    I don't know which is it.

     
  • klo

    klo - 2014-07-09

    Hi Neil,

    I inspected the window with "grey" edge from my initial post, with spyxx.
    In a hope to be useful here is report:

    screenshot

     
  • klo

    klo - 2014-07-09

    ...and I we put edit control inside above tab container, here is report:

    From lurking around, edge style also seem to depend on control library used (logically) but I would guess that SciTE uses appropriate one...

     
  • Neil Hodgson

    Neil Hodgson - 2014-07-09

    That is using WS_EX_CLIENTEDGE just like the SciTE content window does. The edit window is a bit different as it changes its borders to blue when it has the focus or the mouse moves over it and this change is animated.

    SciTE specifies the control library in the win32\SciTE.exe.manifest file if you want to try changing it. If you open win32/SciTE.vcxproj in Visual C++ and run it in the debugger, it doesn't pick up that manifest so looks like it is running on an old version of Windows.

     
  • klo

    klo - 2014-07-10

    Neil,

    I compared manifests from SciTE and example application I used to demonstrate this request, and found they are identical - exact same control library version and same attributes elsewhere with same namespaces and tags.

    I also inspected SciTE through spyxx, and noticed that SciTE doesn't use classical tab control, but tabs are like separate entity.
    I guess you can do this easily by yourself, but this is how "Content window" looks here:

    content

    and this is for Scintilla editor pane:

    scintilla

    I'll try tomorrow to load SciTE project and see if I can do anything.

     
  • klo

    klo - 2014-07-10

    Hi Neil,

    I loaded project file in VS.
    Like you said, doing debug build made controls uglier. To solve this I did the following:

    diff -r afe5d309e54a win32/SciTEWin.h
    --- a/win32/SciTEWin.h  Thu Jul 10 17:49:07 2014 +1000
    +++ b/win32/SciTEWin.h  Thu Jul 10 18:33:36 2014 +0200
    @@ -43,6 +43,8 @@
     #include <uxtheme.h>
     #endif
     #include <commctrl.h>
    +#pragma comment(lib,"comctl32.lib")
    +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
     #include <richedit.h>
     #include <shlwapi.h>
    

    or alternatively by adding that linker manifestdependency string in "VS Project > Properties > Linker > Manifest File > Additional Manifest Dependencies".

    After that I tried setting various flags in scite\win32\SciTEWinBar.cxx to hopefully get "Grey" edge style - single line border, but sadly I wasn't able to get there. Closest I get is WS_EX_STATICEDGE on content window:

    diff -r afe5d309e54a win32/SciTEWinBar.cxx
    --- a/win32/SciTEWinBar.cxx Thu Jul 10 17:49:07 2014 +1000
    +++ b/win32/SciTEWinBar.cxx Thu Jul 10 18:38:54 2014 +0200
    @@ -826,7 +826,7 @@
     void SciTEWin::Creation() {
    
        wContent = ::CreateWindowEx(
    -                  WS_EX_CLIENTEDGE,
    +                  WS_EX_STATICEDGE,
                       classNameInternal,
                       TEXT("Source"),
                       WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
    

    WS_EX_STATICEDGE screenshot

    which still has two pixels wide border on left and bottom side. However it is better then previous WS_BORDER relief from your screenshot.

    What is also inconsistent is the splitter between editor and output pane - I could not find in the source code where is that thing defined.
    If edge style is set to "None", then separator should be 2px wide with button color and no borders.
    If edge style is set to "Grey" then separator should be 2px wide with button color and 1px solid line border on the right side.

     
    • Neil Hodgson

      Neil Hodgson - 2014-07-11

      Changed .vcxproj with [ffaa1d]. Credit is currently "klo" - if you want a different name in credits then tell me.

      The splitter is painted by ContentWin::Paint.

      WS_EX_STATICEDGE looks OK although its documented as "border style intended to be used for items that do not accept user input" and may appear worse depending on Windows version and theme. The CreateWindow call runs once only early in startup so any property to set this should document that, similarly to the buffers setting.

       

      Related

      Commit: [ffaa1d]

      • klo

        klo - 2014-07-11

        OK Neil, thanks.
        Don't need a credit, just a bit disappointing that edge can't be changed.

         
      • klo

        klo - 2014-07-11

        Neil, I changed the splitter to match better WS_EX_STATICEDGE style.
        It's 4px wide, with white border on left and dark one on right:

        screenshot

        diff -r afe5d309e54a win32/SciTEWin.cxx
        --- a/win32/SciTEWin.cxx    Thu Jul 10 17:49:07 2014 +1000
        +++ b/win32/SciTEWin.cxx    Fri Jul 11 04:19:27 2014 +0200
        @@ -161,7 +161,7 @@
            replaceStrip.SetSearcher(this);
        
            cmdShow = 0;
        -   heightBar = 7;
        +   heightBar = 4;
            fontTabs = 0;
            wFocus = 0;
        
        @@ -1463,12 +1463,10 @@
            int xBorder = widthClient - pSciTEWin->heightOutput - pSciTEWin->heightBar;
            for (int i = 0; i < pSciTEWin->heightBar; i++) {
                HPEN pen;
        -       if (i == 1)
        +       if (i == 0)
                    pen = ::CreatePen(0,1,::GetSysColor(COLOR_3DHIGHLIGHT));
        -       else if (i == pSciTEWin->heightBar - 2)
        +       else if (i == pSciTEWin->heightBar - 1)
                    pen = ::CreatePen(0,1,::GetSysColor(COLOR_3DSHADOW));
        -       else if (i == pSciTEWin->heightBar - 1)
        -           pen = ::CreatePen(0,1,::GetSysColor(COLOR_3DDKSHADOW));
                else
                    pen = ::CreatePen(0,1,::GetSysColor(COLOR_3DFACE));
                HPEN penOld = static_cast<HPEN>(::SelectObject(hDC, pen));
        
         
        • Neil Hodgson

          Neil Hodgson - 2014-07-11

          For Windows XP or later, there may be a theming API to call for separator width and appearance although I couldn't find a suitable part at http://msdn.microsoft.com/en-us/library/windows/desktop/bb773210%28v=vs.85%29.aspx .

          Also not a fan of making borders too thin so they are easy to miss with poorer mouse coordination - I have a horrible time with some Linux distributions with themes where the borders are very thin. SciTE's current separator is similar in width to the pane separators in Visual Studio.

           
          • klo

            klo - 2014-07-11

            Yes, of course separator should be clearly visible, because it separates editors, and not some UI display panes.
            It's fine also with 7px as it was, but without emphasized relief effect.

            Here is screenshot of VS:

            So they change separator width all the time :)
            The older version has 9px width! 7px + 2 * 1px border. Then later reduced to 4px and current at 5px. Width perhaps depends on separator color - the darker color thinner the width, so if we hypothetically set separator color to darker like COLOR_3DDKSHADOW, then 4-5px width should be enough.

             
            • klo

              klo - 2014-07-11

               
            • Neil Hodgson

              Neil Hodgson - 2014-07-12

              Its more important that the area be easily hit with the mouse than the visual appearance. The width was 7 pixels back when many people had 640 pixel wide monitors. Now its common to have 2560 pixel wide monitors so the separator is 4x harder to hit. Soon 4K monitors will be common.

              Different appearances are used for vertical and horizontal splitters in Visual Studio. The appearance of the horizontal splitters looks to me to be too modern/flat for use on Windows 7.

               
  • klo

    klo - 2014-07-10

    Maybe this is hard mission as tab control in SciTE is separated from the content window. Tab control appears as separate control element to hold the tabs, while content window is not it child member.
    In the app I used as example, content is inside the tab control, which is parent.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks