I've created a StatusBar for BeOS version. I've changed various files, but I
only send you a diff file (thanks Karl).
Enjoy It. :)
--
-----------------------------------------
Pablo Montesinos Ortego
tobe
Be Different
Be Fast
Just Be
Index: src/BeOS_5.0_x86_OBJ/bin/AbiWord
===================================================================
RCS file: /boot/home/abi_rep/abi/src/BeOS_5.0_x86_OBJ/bin/AbiWord,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 AbiWord
Binary files /tmp/cvsh1OvTn and AbiWord differ
Index: src/af/gr/beos/gr_BeOSGraphics.h
===================================================================
RCS file: /boot/home/abi_rep/abi/src/af/gr/beos/gr_BeOSGraphics.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gr_BeOSGraphics.h
--- src/af/gr/beos/gr_BeOSGraphics.h 2000/08/11 09:20:20 1.1.1.1
+++ src/af/gr/beos/gr_BeOSGraphics.h 2000/08/11 09:38:03
@@ -104,6 +104,9 @@
{ return(m_pPrintJob); };
void SetPrintJob(BPrintJob *j)
{ m_pPrintJob = j; };
+ //Added for obtain background Color
+ rgb_color Get3DColor(GR_Graphics::GR_Color3D c)
+ { return m_3dColors[c];};
protected:
BView *m_pShadowView, *m_pFrontView;
Index: src/af/xap/beos/xap_BeOSFrame.cpp
===================================================================
RCS file: /boot/home/abi_rep/abi/src/af/xap/beos/xap_BeOSFrame.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 xap_BeOSFrame.cpp
--- src/af/xap/beos/xap_BeOSFrame.cpp 2000/08/11 09:20:29 1.1.1.1
+++ src/af/xap/beos/xap_BeOSFrame.cpp 2000/08/11 09:59:18
@@ -395,20 +395,17 @@
_createDocumentWindow();
-#if 0
// Let the app-specific frame code create the status bar
// if it wants to. we will put it below the document
// window (a peer with toolbars and the overall sunkenbox)
// so that it will appear outside of the scrollbars.
- m_wStatusBar = _createStatusBarWindow();
- if (m_wStatusBar) {
- gtk_widget_show(m_wStatusBar);
- gtk_box_pack_end(GTK_BOX(m_wVBox), m_wStatusBar, FALSE, FALSE, 0
-);
- }
-#endif
+ m_pBeOSStatusBarView = _createStatusBarWindow();
+
+ if (!m_pBeOSStatusBarView)
+ return (false);
+
return(true);
}
Index: src/af/xap/beos/xap_BeOSFrame.h
===================================================================
RCS file: /boot/home/abi_rep/abi/src/af/xap/beos/xap_BeOSFrame.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 xap_BeOSFrame.h
--- src/af/xap/beos/xap_BeOSFrame.h 2000/08/11 09:20:29 1.1.1.1
+++ src/af/xap/beos/xap_BeOSFrame.h 2000/08/11 09:57:22
@@ -33,6 +33,7 @@
class EV_BeOSMenu;
class EV_Toolbar;
class GR_Graphics;
+class ap_BeOSStausBar;
/*****************************************************************
******************************************************************
@@ -78,6 +79,7 @@
//Located in the app specific code
be_DocView * _createDocumentWindow(void);
+ virtual BView * _createStatusBarWindow(void);
//Be Function overrides
virtual bool QuitRequested(void);
@@ -88,6 +90,7 @@
XAP_BeOSFrame *m_pBeOSFrame;
TFScrollBar *m_hScroll, *m_vScroll;
BRect m_winRectAvailable;
+ BView *m_pBeOSStatusBarView; //TODO: I don't like
+this!
};
/*****************************************************************/
Index: src/wp/ap/beos/ap_BeOSFrame.cpp
===================================================================
RCS file: /boot/home/abi_rep/abi/src/wp/ap/beos/ap_BeOSFrame.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ap_BeOSFrame.cpp
--- src/wp/ap/beos/ap_BeOSFrame.cpp 2000/08/11 09:21:14 1.1.1.1
+++ src/wp/ap/beos/ap_BeOSFrame.cpp 2000/08/11 10:19:51
@@ -197,7 +197,7 @@
// frame is created.
((AP_FrameData*)m_pData)->m_pTopRuler->setView(pView);
((AP_FrameData*)m_pData)->m_pLeftRuler->setView(pView);
- //((AP_FrameData*)m_pData)->m_pStatusBar->setView(pView);
+ ((AP_FrameData*)m_pData)->m_pStatusBar->setView(pView);
pView->setInsertMode(((AP_FrameData*)m_pData)->m_bInsertMode);
((FV_View *) m_pView)->setShowPara(((AP_FrameData*)m_pData)->m_bShowPara);
@@ -232,7 +232,7 @@
#endif
((AP_FrameData*)m_pData)->m_pTopRuler->draw(NULL);
((AP_FrameData*)m_pData)->m_pLeftRuler->draw(NULL);
- //((AP_FrameData*)m_pData)->m_pStatusBar->draw();
+ ((AP_FrameData*)m_pData)->m_pStatusBar->draw();
return UT_OK;
@@ -558,8 +558,8 @@
void AP_BeOSFrame::setStatusMessage(const char * szMsg)
{
- printf("FRAME:Set Status Message not yet supported \n");
-// ((AP_FrameData *)m_pData)->m_pStatusBar->setStatusMessage(szMsg);
+
+ ((AP_FrameData *)m_pData)->m_pStatusBar->setStatusMessage(szMsg);
}
@@ -573,22 +573,24 @@
//Set up the scroll bars on the outer edges of the document area
r = m_winRectAvailable;
- r.bottom -= B_H_SCROLL_BAR_HEIGHT;
+ r.bottom -= (B_H_SCROLL_BAR_HEIGHT+1+ STATUS_BAR_HEIGHT);
r.left = r.right - B_V_SCROLL_BAR_WIDTH;
m_vScroll = new TFScrollBar(m_pBeOSFrame, r,
"VertScroll", NULL, 0, 100, B_VERTICAL);
AddChild(m_vScroll);
r = m_winRectAvailable;
- r.top = r.bottom - B_H_SCROLL_BAR_HEIGHT;
+ r.top = r.bottom - (B_H_SCROLL_BAR_HEIGHT+1+ STATUS_BAR_HEIGHT);
+ r.bottom-=(1+ STATUS_BAR_HEIGHT);
r.right -= B_V_SCROLL_BAR_WIDTH;
m_hScroll = new TFScrollBar(m_pBeOSFrame, r,
"HortScroll", NULL, 0, 100, B_HORIZONTAL);
AddChild(m_hScroll);
m_pBeOSFrame->setScrollBars(m_hScroll, m_vScroll);
- m_winRectAvailable.bottom -= B_H_SCROLL_BAR_HEIGHT +1;
+ m_winRectAvailable.bottom -= (B_H_SCROLL_BAR_HEIGHT +2+ STATUS_BAR_HEIGHT);
m_winRectAvailable.right -= B_V_SCROLL_BAR_WIDTH +1;
+
//Create the Top and Left Rulers (need a width here)
#define TOP_HEIGHT 32
#define LEFT_WIDTH 32
@@ -626,6 +628,23 @@
m_pbe_DocView->MakeFocus(true);
return(m_pbe_DocView);
}
+
+BView * be_Window::_createStatusBarWindow() {
+
+ AP_BeOSStatusBar *pStatusBar = new AP_BeOSStatusBar(m_pBeOSFrame);
+ BView *pStatusBarView;
+ UT_ASSERT(pStatusBar);
+ static_cast<AP_FrameData*>(m_pBeOSFrame->m_pData)->m_pStatusBar = pStatusBar;
+ BRect r;
+ r = Bounds();
+ r.top = r.bottom - STATUS_BAR_HEIGHT;
+ pStatusBarView = pStatusBar->createWidget(r);
+ AddChild(pStatusBarView);
+ return pStatusBarView;
+}
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
UT_Error AP_BeOSFrame::_replaceDocument(AD_Document * pDoc)
{
Index: src/wp/ap/beos/ap_BeOSStatusBar.cpp
===================================================================
RCS file: /boot/home/abi_rep/abi/src/wp/ap/beos/ap_BeOSStatusBar.cpp,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ap_BeOSStatusBar.cpp
--- src/wp/ap/beos/ap_BeOSStatusBar.cpp 2000/08/11 09:21:14 1.1.1.1
+++ src/wp/ap/beos/ap_BeOSStatusBar.cpp 2000/08/11 09:49:53
@@ -18,12 +18,70 @@
*/
#include "ut_types.h"
+#include "ut_misc.h"
#include "ut_assert.h"
#include "ut_debugmsg.h"
#include "xap_Frame.h"
-#include "xap_BeOSFrame.h"
#include "gr_BeOSGraphics.h"
#include "ap_BeOSStatusBar.h"
+#include "xap_BeOSFrame.h"
+
+//////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+
+class StatusBarDrawView: public be_GRDrawView {
+public:
+ StatusBarDrawView(AP_BeOSStatusBar *pBar, AV_View *pView,
+ BRect frame, const char *name,
+ uint32 resizeMask, uint32 flags);
+ virtual void FrameResized(float new_width, float new_height);
+ virtual void Draw(BRect invalid);
+
+private:
+ float m_fOldWidth;
+ float m_fOldHeight;
+ AP_BeOSStatusBar *m_pAPStatusBar;
+
+};
+
+
+StatusBarDrawView::StatusBarDrawView(AP_BeOSStatusBar *pBar, AV_View *pView,
+ BRect frame, const char *name,
+ uint32 resizeMask, uint32 flags)
+ : be_GRDrawView(pView, frame, name, resizeMask, flags) {
+
+ m_pAPStatusBar = pBar;
+ m_pAPStatusBar->setHeight(20); //this line is the key
+ m_pAPStatusBar->setWidth((int)frame.IntegerWidth());
+}
+
+void StatusBarDrawView::FrameResized(float new_width, float new_height) {
+ //m_pAPStatusBar->setHeight((int)new_height);
+ m_pAPStatusBar->setWidth((int)new_width);
+
+ //TODO does this goes well?? umm.. we'll see later
+ BRect r;
+ if (new_width > m_fOldWidth)
+ {
+ r.left=m_fOldWidth-5;
+ r.right=new_width;
+ r.top=Bounds().top;
+ r.bottom=Bounds().bottom;
+ UT_DEBUGMSG(("Actually invalidating StatusBar\n"));
+ Invalidate(r);
+ }
+ m_fOldWidth=new_width;
+
+}
+
+void StatusBarDrawView::Draw(BRect invalid) {
+
+ m_pAPStatusBar->draw();
+
+}
+
+
+
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
@@ -31,7 +89,7 @@
AP_BeOSStatusBar::AP_BeOSStatusBar(XAP_Frame * pFrame)
: AP_StatusBar(pFrame)
{
-// m_wStatusBar = NULL;
+ m_wStatusBar = NULL;
m_pG = NULL;
}
@@ -40,19 +98,35 @@
DELETEP(m_pG);
}
+be_GRDrawView * AP_BeOSStatusBar::createWidget(BRect r)
+{
+
+ UT_ASSERT(!m_pG && !m_wStatusBar);
+ m_wStatusBar = NULL;
+ m_wStatusBar = new
+StatusBarDrawView(this,m_pView,r,"StatusBar",B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM,
+B_WILL_DRAW | B_FRAME_EVENTS);
+ return m_wStatusBar;
+
+}
+
void AP_BeOSStatusBar::setView(AV_View * pView)
{
// We really should allocate m_pG in createWidget(), but
// unfortunately, the actual window (m_wStatusBar->window)
// is not created until the frame's top-level window is
// shown.
-#if 0
+
DELETEP(m_pG);
- XAP_BeOSApp * app = static_cast<XAP_BeOSApp *>(m_pFrame->getApp());
- XAP_BeOSFontManager * fontManager = app->getFontManager();
- m_pG = new GR_BeOSGraphics(m_wStatusBar->window, m_pFrame->getApp());
+ UT_ASSERT(m_wStatusBar);
+
+ GR_BeOSGraphics *pG = new GR_BeOSGraphics(m_wStatusBar,m_pFrame->getApp());
+ m_pG = pG;
UT_ASSERT(m_pG);
+ be_Window *pBWin = (be_Window*)((XAP_BeOSFrame
+*)m_pFrame)->getTopLevelWindow();
+ pBWin->Lock();
+ m_wStatusBar->SetViewColor(pG->Get3DColor(GR_Graphics::CLR3D_Background));
+ pBWin->Unlock();
+
GR_Font * pFont = m_pG->getGUIFont();
m_pG->setFont(pFont);
@@ -61,5 +135,4 @@
// think and layout the fields.
AP_StatusBar::setView(pView);
-#endif
-}
+}
\ No newline at end of file
Index: src/wp/ap/beos/ap_BeOSStatusBar.h
===================================================================
RCS file: /boot/home/abi_rep/abi/src/wp/ap/beos/ap_BeOSStatusBar.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ap_BeOSStatusBar.h
--- src/wp/ap/beos/ap_BeOSStatusBar.h 2000/08/11 09:21:14 1.1.1.1
+++ src/wp/ap/beos/ap_BeOSStatusBar.h 2000/08/11 09:40:41
@@ -26,8 +26,11 @@
#include "ut_types.h"
#include "ap_StatusBar.h"
#include "gr_BeOSGraphics.h"
+#include "be_GRDrawView.h"
class XAP_Frame;
+#define STATUS_BAR_HEIGHT 20
+
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
@@ -38,10 +41,11 @@
virtual ~AP_BeOSStatusBar(void);
virtual void setView(AV_View * pView);
- //GtkWidget * createWidget(void);
+ be_GRDrawView * createWidget(BRect r);
protected:
- //GtkWidget * m_wStatusBar;
+ be_GRDrawView * m_wStatusBar;
+
};
-#endif /* AP_BEOSSTATUSBAR_H */
+#endif /* AP_BEOSSTATUSBAR_H */ /* AP_BEOSSTATUSBAR_H */