|
26 | 26 |
|
27 | 27 | -behaviour(wx_object). |
28 | 28 |
|
| 29 | +-define(TEXT_PADDING_X, 3). |
| 30 | +-define(TEXT_PADDING_Y, 2). |
| 31 | +-define(GRIP_DOT_SIZE, 2). |
| 32 | +-define(GRIP_DOT_SPACING, 3). |
| 33 | +-define(GRIP_ROWS, 3). |
| 34 | + |
29 | 35 | start_link() -> |
30 | 36 | Status = wx_object:start_link({local,?MODULE}, ?MODULE, [wings_frame:get_top_frame()], []), |
31 | 37 | {ok, wx_object:get_pid(Status)}. |
@@ -109,25 +115,36 @@ custom_draw(#wx{obj=Obj, event=#wxPaint{}}, _) -> |
109 | 115 | Size = wxWindow:getSize(Obj), |
110 | 116 | DC = case os:type() of |
111 | 117 | {win32, _} -> %% Flicker on windows |
112 | | - wx:typeCast(wxBufferedPaintDC:new(Obj), wxPaintDC); |
| 118 | + BufferedDC = wxBufferedPaintDC:new(Obj), |
| 119 | + wx:typeCast(BufferedDC, wxPaintDC); |
113 | 120 | _ -> |
| 121 | + BufferedDC = none, |
114 | 122 | wxPaintDC:new(Obj) |
115 | 123 | end, |
| 124 | + SBG = wings_color:rgb4bv(wings_pref:get_value(info_line_bg)), |
| 125 | + Brush = wxBrush:new(SBG), |
116 | 126 | wxDC:setBackgroundMode(DC, ?wxBRUSHSTYLE_SOLID), |
| 127 | + wxDC:setBackground(DC, Brush), |
117 | 128 | wxDC:clear(DC), |
118 | 129 | case wxStatusBar:getFieldsCount(Obj) of |
119 | 130 | 2 -> |
120 | 131 | {true,{Xl,Yl,_,_Hl}} = wxStatusBar:getFieldRect(Obj, 0), |
121 | 132 | {true,{Xr,Yr,_Wr,_Hr}} = wxStatusBar:getFieldRect(Obj, 1), |
122 | | - wxDC:drawText(DC, wxStatusBar:getStatusText(Obj,[{number,0}]), {Xl+3,Yl+2}), |
123 | | - wxDC:drawText(DC, wxStatusBar:getStatusText(Obj,[{number,1}]), {Xr+3,Yr+2}); |
| 133 | + wxDC:drawText(DC, wxStatusBar:getStatusText(Obj,[{number,0}]), {Xl+?TEXT_PADDING_X,Yl+?TEXT_PADDING_Y}), |
| 134 | + wxDC:drawText(DC, wxStatusBar:getStatusText(Obj,[{number,1}]), {Xr+?TEXT_PADDING_X,Yr+?TEXT_PADDING_Y}); |
124 | 135 | _ -> ok |
125 | 136 | end, |
126 | 137 | GrpPen = wxPen:new(wxSystemSettings:getColour(?wxSYS_COLOUR_3DSHADOW)), |
127 | 138 | wxDC:setPen(DC,GrpPen), |
128 | | - draw_grip(DC, Size, 3), |
| 139 | + draw_grip(DC, Size, ?GRIP_ROWS), |
129 | 140 | wxPen:destroy(GrpPen), |
130 | | - wxPaintDC:destroy(DC). |
| 141 | + wxBrush:destroy(Brush), |
| 142 | + case os:type() of |
| 143 | + {win32, _} -> %% Flicker on windows |
| 144 | + wxBufferedPaintDC:destroy(BufferedDC); |
| 145 | + _ -> |
| 146 | + wxPaintDC:destroy(DC) |
| 147 | + end. |
131 | 148 |
|
132 | 149 | update_status({value, Prev}, Prev, _SB) -> |
133 | 150 | Prev; |
@@ -160,7 +177,8 @@ set_status(Msgs={Left, Right}, SB) -> |
160 | 177 |
|
161 | 178 | draw_grip(_, _, 0) -> ok; |
162 | 179 | draw_grip(DC, {W,H}=Size, C) -> |
163 | | - [wxDC:drawRectangle(DC, {W-(3*I)-1, H-(3*(4-C))-1}, {2,2}) || I <- lists:seq(C,1,-1)], |
| 180 | + [wxDC:drawRectangle(DC, {W-(?GRIP_DOT_SPACING*I)-1, H-(?GRIP_DOT_SPACING*(4-C))-1}, |
| 181 | + {?GRIP_DOT_SIZE,?GRIP_DOT_SIZE}) || I <- lists:seq(C,1,-1)], |
164 | 182 | draw_grip(DC, Size, C-1). |
165 | 183 |
|
166 | 184 | str(undefined, Old) -> Old; |
|
0 commit comments