[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 987
Date : Tue May 9 20:45:07 BST 2006
Changed paths:
M /Trunk/XaraLX/wxOil/cartctl.h
M /Trunk/XaraLX/wxOil/cartprov.cpp
M /Trunk/XaraLX/wxOil/cartprov.h
M /Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc
Convert status line text to owner rendered. Make it clip properly.
Diff:
Index: Trunk/XaraLX/wxOil/cartprov.cpp
===================================================================
--- Trunk/XaraLX/wxOil/cartprov.cpp (revision 986)
+++ Trunk/XaraLX/wxOil/cartprov.cpp (revision 987)
@@ -859,8 +859,7 @@
if (Flags & CAF_TEXT)
{
- wxString ctext = GetTextInfo(Resource, Flags, dc, text);
- dc.DrawText(ctext, brect.x+bitmapoffsetX, brect.y+bitmapoffsetY);
+ wxString ctext = GetTextInfoOrDraw(Resource, Flags, dc, TRUE, NULL, NULL, brect.x+bitmapoffsetX, brect.y+bitmapoffsetY, text);
}
else
{
@@ -904,8 +903,7 @@
if (Flags & CAF_TEXT)
{
wxScreenDC dc;
- wxString ctext = GetTextInfo(r, Flags, dc, text);
- dc.GetTextExtent(ctext, &w, &h);
+ wxString ctext = GetTextInfoOrDraw(r, Flags, dc, FALSE, &w, &h, 0, 0, text);
}
else
{
@@ -928,14 +926,17 @@
/********************************************************************************************
-> wxString CamArtProvider::GetTextInfo(ResourceID r, wxDC &dc, const wxString &text = wxEmptyString)
+> wxString CamArtProvider::GetTextInfoOrDraw(ResourceID r, wxDC &dc, BOOL Draw=FALSE, wxCoord *w=NULL, wxCoord *h=NULL,
+ wxCoord x=0, wxCoord y=0, const wxString &text = wxEmptyString)
Author: Alex_Bligh <alex@xxxxxxxxxxx>
Created: 24/04/2006
Inputs: r - the resource
Flags - the flags
- Outputs: -
+ Draw = TRUE to draw the text
+ x, y - location to draw the text (if Draw is set)
+ Outputs: w, h, pointers to fill in (can be NULL) for the text extent. Either both or neither must be NULL
Returns: The text
Purpose: Sets up the DC and returns the text
Errors: -
@@ -943,11 +944,14 @@
********************************************************************************************/
-wxString CamArtProvider::GetTextInfo(ResourceID r, CamArtFlags f, wxDC &dc, const wxString &text)
+wxString CamArtProvider::GetTextInfoOrDraw(ResourceID r, CamArtFlags f, wxDC &dc, BOOL Draw/*=FALSE*/, wxCoord *w, wxCoord *h, wxCoord x, wxCoord y, const wxString &text)
{
// find the name by looking up the ID as a string
const TCHAR * tcname=text;
+ if (w) *w=0;
+ if (h) *h=0;
+
if (text.IsEmpty())
{
tcname = CamResource::GetTextFail(r);
@@ -969,9 +973,15 @@
dc.SetTextForeground(wxSystemSettings::GetColour((f & CAF_GREYED)?wxSYS_COLOUR_GRAYTEXT:wxSYS_COLOUR_BTNTEXT));
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
- font.SetPointSize(7);
+ font.SetPointSize((f & CAF_HALFHEIGHT)?7:8);
dc.SetFont(font);
+ if (h && w)
+ dc.GetTextExtent(wxString(tcname), w, h);
+
+ if (Draw)
+ dc.DrawText(wxString(tcname), x, y);
+
return wxString(tcname);
}
Index: Trunk/XaraLX/wxOil/cartprov.h
===================================================================
--- Trunk/XaraLX/wxOil/cartprov.h (revision 986)
+++ Trunk/XaraLX/wxOil/cartprov.h (revision 987)
@@ -135,8 +135,11 @@
CAF_NOINTERNALBORDER= 1<<18, // Don't paint an internal border (unused, for CACS_)
CAF_NOAUTOREPEAT = 1<<19, // Used for CACS_
+
+ CAF_STATUSBARTEXT = 1<<20, // Used for status bar - render bit before :: in bold, chop on word boundaries
+
// And this goes right at the end
- CAF_MAX = 1<<20,
+ CAF_MAX = 1<<21,
// And here is the default
CAF_DEFAULT = 0
@@ -242,7 +245,8 @@
void DeleteHashContents();
void ArtLoad(BOOL newbitmaps = FALSE, BOOL defer=TRUE);
- wxString GetTextInfo(ResourceID r, CamArtFlags f, wxDC &dc, const wxString &text = wxEmptyString);
+ wxString GetTextInfoOrDraw(ResourceID r, CamArtFlags f, wxDC &dc, BOOL Draw=FALSE, wxCoord *w=NULL, wxCoord *h=NULL,
+ wxCoord x=0, wxCoord y=0, const wxString &text = wxEmptyString);
ResIDWithFlagsToBitmapPtr * m_pHash;
BOOL m_GetBitmapEventPending;
Index: Trunk/XaraLX/wxOil/cartctl.h
===================================================================
--- Trunk/XaraLX/wxOil/cartctl.h (revision 986)
+++ Trunk/XaraLX/wxOil/cartctl.h (revision 987)
@@ -120,6 +120,7 @@
wxCACS_LEFT = CAF_LEFT,
wxCACS_RIGHT = CAF_RIGHT,
wxCACS_NOAUTOREPEAT = CAF_NOAUTOREPEAT,
+ wxCACS_STATUSBARTEXT = CAF_STATUSBARTEXT,
wxCACS_DEFAULT = 0
};
@@ -129,7 +130,7 @@
> class wxCamArtControlEvent : public wxEvent
Author: Alex_Bligh <alex@xxxxxxxxxxx>
- Created: 19/12/2005
+o Created: 19/12/2005
Purpose: A derived event to allow for postprocessing of autorepeat on buttons
Notes: In the OIL
See Also:
@@ -243,6 +244,8 @@
return wxControl::Enable(enable);
}
+ virtual void SetLabel(const wxString& label) {if (label!=GetLabel()) {wxControl::SetLabel(label); Refresh(TRUE);}}
+
wxString GetOpDesc() {return m_OpDesc;}
const ResourceID GetBitmapId() {return m_BitmapId?m_BitmapId:GetId();}
Index: Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc (revision 986)
+++ Trunk/XaraLX/wxOil/xrc/EN/statusbar.xrc (revision 987)
@@ -12,11 +12,10 @@
<flag>wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE|wxGROW</flag>
<border>1</border>
<option>1</option>
- <object class="wxStaticText" name="IDC_SL_STATUSTEXT">
- <font>
- <size>8</size>
- </font>
- <style>wxALIGN_LEFT|wxST_NO_AUTORESIZE</style>
+ <object class="wxCamArtControl" name="IDC_SL_STATUSTEXT">
+ <camartstyle>wxCACS_TEXT|wxCACS_LEFT|wxCACS_EXACTFIT</camartstyle>
+ <style>wxFULL_REPAINT_ON_RESIZE</style>
+ <size>-1,12</size>
<label>Nothing Selected</label>
<tooltip>Status bar text</tooltip>
<help>Displays the current status</help>
Xara