Results 1 to 5 of 5

Thread: Some fresh fixes to GUI (and other)

  1. #1
    Lesser Knight
    Join Date
    Jan 2011
    Posts
    32

    Post Some fresh fixes to GUI (and other)

    I created a new patch-file with some fixes mainly to GUI, please, review it and apply if necessary:

    1. CL_LineEdit improvements (added some verifications when adding text to it)
    2. CL_PopupMenu crash fix when pressing "left" or "right" key when the menu is opened
    3. CL_ToolTip fix - now it can contain multiline text
    4. CL_PixelBuffer copy() fix
    Attached Files Attached Files

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,772

    Default

    Nice, it looks good to me (to apply to 2.3 SVN)

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Seems nothing should stop it from being applied to 2.2 as well?

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,772

    Default

    My mistake, I thought the API had changed, but it was the implementation header file.

    Yes, it can be applied to 2.2. It may require manually patching for CL_LineEdit since (iirc), the .cpp is different from 2.2 and 2.3.

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,772

    Default

    Okay. I have partially applied both to 2.2 and 2.3 SVN.

    I have not yet applied the following multiline text patch:
    Code:
    Index: GUI/Components/tooltip.cpp
    ===================================================================
    --- GUI/Components/tooltip.cpp	(revision 5565)
    +++ GUI/Components/tooltip.cpp	(working copy)
    @@ -180,7 +180,7 @@
     	CL_Size text_size = font.get_text_size(gc, text);
     	font.draw_text(gc,
     		content_rect.left,
    -		content_rect.top + content_rect.get_height()/2 + text_size.height/2 - 2,
    +		content_rect.top + font.get_text_size(gc, "l").height - 3,
     		text,
     		text_color);
     }
    Although multiline tooltips are excellent. I am not sure this is the correct way. I would like other developers to comment.

    The complete code to this function is now:

    Code:
    void CL_ToolTip_Impl::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect)
    {
    	CL_Rect rect = tooltip->get_geometry();
    	part_component.render_box(gc, rect.get_size(), update_rect);
    
    	CL_Rect content_rect = part_component.get_content_box(rect.get_size());
    
    	CL_Size text_size = font.get_text_size(gc, text);
    	font.draw_text(gc,
    		content_rect.left,
    		content_rect.top + font.get_text_size(gc, "l").height - 3,
    		text,
    		text_color);
    }
    Using font.get_text_size(gc, "l"), does not seem right.

    I would have used the font metrics ( http://clanlib.org/wiki/File:FontMetrics.png )
    Last edited by rombust; 07-04-2011 at 09:44 AM. Reason: grammer

Similar Threads

  1. Various fixes and improvements
    By toiffel in forum ClanLib: Developer Chat
    Replies: 20
    Last Post: 07-29-2011, 08:29 AM
  2. This patch fixes the black screen problem on some video cards
    By huntercool in forum ClanLib: Developer Chat
    Replies: 1
    Last Post: 04-06-2011, 12:06 PM
  3. gcc fixes to subversion code
    By xrubio in forum ClanLib: Help
    Replies: 2
    Last Post: 08-21-2009, 07:26 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •