Author Topic: Font for Preview toolbar window  (Read 10781 times)

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Font for Preview toolbar window
« on: July 21, 2008, 06:40:06 pm »
Note:  go to the end of this thread for the most current version of the macro.

I'm using SE 13.0.1 r16 on Vista.

I'm having trouble figuring out how to set the font for the Preview toolbar window.  I've set editor windows to use Consolas, and they do.  The References toolbar window also uses Consolas.  But the Preview toolbar window still uses Courier New.

I also noticed that although I have "Current line" color coding enabled in C/C++ (and Slick-C and Perl and Lua and Html), when the Preview and References toolbar windows show a file it does not use the "Current line" color coding setting.

Is there a special setting I need to set somewhere other than the following two settings, or is this a bug?
  • Tools|Options|Appearance|Fonts|Element "* Source Windows" = Consolas
  • Tools|Options|Languages|Application Languages|General "Current line" = checked
« Last Edit: March 25, 2014, 03:19:23 am by chrisant »

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Font for Preview toolbar window
« Reply #1 on: July 21, 2008, 07:21:17 pm »
@chrisant:
Maybe this thread will help:
http://community.slickedit.com/index.php?topic=2087.0

It's worked for me through a few versions of Slick now...   ;)

-Evan

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: Font for Preview toolbar window
« Reply #2 on: July 22, 2008, 08:03:54 am »
Thanks, Evan (and Ding and HS2).

I found the line in tagwin.e that explicitly removes the CURLINE_COLOR_WFLAG, so that explains that part.

I've combined into a single macro file the various snippets for overriding fonts for various toolbars.  The macro file is for v13.0.1, but may work with little or no modification for earlier versions as well.  The macro sets the font for the Preview, References, Build, and Output toolbars by setting them to the CFG_SBCS_DBCS_SOURCE_WINDOW font but cranking it down to 9pt.  You can change the fonts/sizes/etc to your liking.


(Overriding the Output toolbar font was slightly tricky; something else sets the font after the on_create2 call, but _post_call was enough to defer overriding the font).

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #3 on: July 22, 2008, 08:27:55 am »
Thanks for sharing chrisant ! This part of my 'hs2_ui.e' is quite similar ;)
I'll check your implementation to see if I can improve my stuff a bit and to make it ready for v13. Didn't have the time to bump all my mods to v13 yet :(.
BTW I'm also tweaking the Search TB. I've patched tbsearch.e - _create_grep_buffer(); (near end of function just before _sort_tabs(tab_id, false); to achieve that. This should also work with v13. At impl. time I didn't find a better way to do that. Any idea howto extract that into a separate module ?
HS2

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #4 on: July 22, 2008, 08:40:48 am »
@SlickTeam: Since a number of users want to configure some toolbar fonts differently I'd propose to add configuration support to SE in a future release.
With the new (v13) configuration infrastructure it seems to be a lot easier to do that. What do you think ?
Thanks, HS2

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: Font for Preview toolbar window
« Reply #5 on: July 22, 2008, 05:46:10 pm »
BTW I'm also tweaking the Search TB. I've patched tbsearch.e - _create_grep_buffer(); (near end of function just before _sort_tabs(tab_id, false); to achieve that. This should also work with v13. At impl. time I didn't find a better way to do that. Any idea howto extract that into a separate module ?

I had looked at your patch, and considered doing something similar, but couldn't see how to achieve it without touching tbsearch.e.  But, this morning I realized a relatively elegant way:  override the grep_mode command.  So here is an updated version that also overrides the Search toolbar font (but is careful not to override the font when you use "Open as Editor Window" ;)).

Updated a couple hours later:  Per HS2's suggestion this now uses _isGrepBuffer to detect Search buffers.  Also, the font/size config settings are variables now, so you can download/load new versions of the macro without losing your specific config tweaks.
« Last Edit: July 22, 2008, 08:25:34 pm by chrisant »

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #6 on: July 22, 2008, 06:30:05 pm »
Ok - I see. This seems to be the best way with minimal impact.
Thanks a lot for finding this alternative way, HS2
« Last Edit: July 22, 2008, 06:44:03 pm by hs2 »

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #7 on: July 22, 2008, 06:36:33 pm »
@chrisant: There should be a '_isGrepBuffer(_str name)' call also in v13. I think it's better to use this call in DeferredSearchFont().
HS2
« Last Edit: July 22, 2008, 06:44:55 pm by hs2 »

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Font for Preview toolbar window
« Reply #8 on: July 22, 2008, 06:42:26 pm »
Thanks chrisant, this is an even slicker way than what I had been using previously... HP++

-Evan

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: Font for Preview toolbar window
« Reply #9 on: July 22, 2008, 08:27:46 pm »
I updated it again (scroll up, I just refreshed the .e file this time).
Changes:
  • Per HS2's suggestion this now uses _isGrepBuffer to detect Search buffers (_isGrepBuffer exists in 12.0.3 as well, and possibly earlier).
  • The font/size config settings are variables now, so you can download/load new versions of the macro without losing your specific config tweaks.

Again, the macro is designed for and tested with SE 13.x but might work on earlier versions of SE with little or no modification.

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #10 on: July 22, 2008, 08:47:42 pm »
It's getting better and better. Good job chrisant !
I've added this minor change to make it fully backwards compatible:
Code: [Select]
_command void grep_mode() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   #if __VERSION__<13
   select_edit_mode  ( 'grep' );
   #else
   _SetEditorLanguage( 'grep' );
   #endif
   _post_call( DeferredSearchFont, p_window_id );
}

HS2

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: Font for Preview toolbar window
« Reply #11 on: July 23, 2008, 07:36:16 am »
HS2, I noticed that with my FontOverrides.e loaded, clicking on the Preview TB editor control changes the font back to Courier New.  I tracked that down to this tweak that I picked up as part of your mod for def_tagwin_use_bottom_style (for which I'm quite grateful):

Code: [Select]
// HS2-ADD: bottom style support - use diff. fonts for each style
void edit1.on_create2, on_got_focus()
{
   _setEditFont( edit1, def_tagwin_use_bottom_style ? CFG_FILE_MANAGER_WINDOW : CFG_SBCS_DBCS_SOURCE_WINDOW);
}

I have a fix for FontOverrides.e, but first I had a couple questions:
1.  It seems that's what had been making the Preview TB use the Courier New font (that issue that started this topic, actually ;)).  Why does it use CFG_FILE_MANAGER_WINDOW for source code files when the Preview TB is configured to use the bottom style?
2.  Also, why does it set the font both in on_create2 and also in on_got_focus?  Isn't setting it in on_create2 enough?

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #12 on: July 23, 2008, 08:44:30 am »
Hi chrisant,
the reason for the on_got_focus handler hook is that it allows an on-the-fly change of the font w/o closing/destroying the TB (window) and re-open it. This in turn was added mainly to support the 'toggle-tagwin-style' command.
But it's rather a HS2 specifc thing that different fonts are choosen for each style.
I've always used the same font in the Preview TB (I've forgotten the former name of it) as in the edit window b/c I didn't need to switch the font in my mind when quickly looking up some details in the Preview TB. This is still true (just for me maybe) for the normal window layout of the Preview TB since the width of the editor control is the same as the edit window.
When using 'bottom style' Preview TB I'm using a more condensed font (CFG_FILE_MANAGER_WINDOW in my case).
This allows to display the same number of chars as visible in the edit win at least. But it's a compromise :(
At the time I've started using this patch (thanks Ding !) I was not sure which way to go. But it turned out that I prefer more visible lines in the Preview TB b/c I didn't switch the (bottom) style since months ;)
It's just difficult. Currently I can't propose a better design of the Preview TB. I only know that I don't need the HTML area especially because I'm using the TB in docked mode. When I want to read the code doc I'm using 'list-symbols/A-DOT'.
So for me it'd be better to get the deprecated design back where the list of ambiguous tags was a drop down list right above the editor control...
Maybe I'll buy an appropriate screen, turn it 90 degrees and use the default Preview TB again.
I've also tried to use the Preview TB (my absolute #1 TB btw) undocked on a 2nd screen but I found that it's just not ergonomic.
Unfortunately all that doesn't help a lot when working somewhere else...

HS2
« Last Edit: July 23, 2008, 08:56:07 am by hs2 »

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Font for Preview toolbar window
« Reply #13 on: July 23, 2008, 05:11:47 pm »
hs2,
Maybe I'm misunderstanding you, but I don't need the comment area of the Preview toolbar either. I just ended up dragging the divider bar all the way to the top of the window, and now the Preview TB is very close to how the old Symbol toolbar operated. Or is that not what you meant?

-Evan

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Font for Preview toolbar window
« Reply #14 on: July 23, 2008, 05:30:32 pm »
Hi Evan, the modification I'm using goes a step further.
Have a look here. Ding added a screencap when he thankfully posted the original patch.
HS2