From: J. Russell Smyth Date: Wed, 17 Mar 1999 11:07:19 +0000 (+0000) Subject: 1 - Moved settingsdlg.[h,cpp] and wxinfo.[h,cpp] to demo where they belong X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/af11388a6210ffc2d588ea852cea103511c50f08?hp=29006414014249ec3eb86e9c13da7f06b2741e3a 1 - Moved settingsdlg.[h,cpp] and wxinfo.[h,cpp] to demo where they belong 2 - removed pf_sample from library - this was test code 3 - modified newbmpbutton to create all button images once at initial creation 4 - newbmpbutton only refreses when necessary 5 - non-msw platforms may now disable (enable(FALSE)) a button - this will half-grey the image and draw text in disabled color. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/framelayout/samples/demo/Makefile.in b/utils/framelayout/samples/demo/Makefile.in index 052f24b23e..57813c13ae 100644 --- a/utils/framelayout/samples/demo/Makefile.in +++ b/utils/framelayout/samples/demo/Makefile.in @@ -10,8 +10,10 @@ RULE=bin BIN_TARGET=fl_demo # define library sources -BIN_CPP_SRC=\ - fl_demo.cpp\ +BIN_CPP_SRC= \ + fl_demo.cpp \ + settingsdlg.cpp \ + wxinfo.cpp #define library objects BIN_OBJ=\ diff --git a/utils/framelayout/samples/demo/fl_demo.cpp b/utils/framelayout/samples/demo/fl_demo.cpp index 29c33308ba..60ee20f6ef 100644 --- a/utils/framelayout/samples/demo/fl_demo.cpp +++ b/utils/framelayout/samples/demo/fl_demo.cpp @@ -769,7 +769,7 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ) new cbDynToolBarDimHandler() ); - cbDimInfo sizes4( 430,35, // when docked horizontally + cbDimInfo sizes4( 450,35, // when docked horizontally 44,375, // when docked vertically 80,100, // when floated TRUE, // the bar is fixed-size @@ -790,8 +790,6 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ) pTBar2->AddTool( 4, wxBitmap("nextmark_icon") ); pTBar2->AddTool( 5, wxBitmap("prevmark_icon") ); - - wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 ); pTBar3->AddTool( 1, wxBitmap("open_icon"), " Open " ); @@ -821,7 +819,6 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ) pTBar2->AddTool( 4, nextmark_xpm ); pTBar2->AddTool( 5, prevmark_xpm ); - wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 ); pTBar3->AddTool( 1, wxBitmap(open_xpm), " Open " ); @@ -832,6 +829,8 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ) pTBar3->AddTool( 5, wxBitmap(copy_xpm), " Copy " ); pTBar3->AddTool( 6, wxBitmap(paste_xpm), " Paste " ); + pTBar3->EnableTool( 2, FALSE ); + wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, -1 ); pTBar4->AddTool( 1, wxBitmap(bookmarks_xpm), "Bookmarks ", TRUE ); @@ -839,6 +838,8 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent ) pTBar4->AddTool( 3, wxBitmap(prevmark_xpm), "Prev bookmark ", TRUE ); //pTBar4->AddSeparator(); pTBar4->AddTool( 4, wxBitmap(search_xpm),"Search ", TRUE ); + + pTBar4->EnableTool( 4, FALSE ); #endif layout.AddBar( pTBar2, diff --git a/utils/framelayout/samples/demo/settingsdlg.cpp b/utils/framelayout/samples/demo/settingsdlg.cpp new file mode 100644 index 0000000000..c1a861679a --- /dev/null +++ b/utils/framelayout/samples/demo/settingsdlg.cpp @@ -0,0 +1,496 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: settingsdlg.cpp +// Purpose: Settings dialog for Frame Layout +// Author: Aleksandras Gluchovas +// Modified by: +// Created: 05/11/98 +// RCS-ID: $Id$ +// Copyright: (c) Aleksandras Gluchovas +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "settingsdlg.cpp" +#pragma interface "settingsdlg.cpp" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include "settingsdlg.h" + +/***** Implementation for class SettingsDlg *****/ + +#define ID_NOTES ( wxEVT_FIRST + 1000 ) +#define ID_HINTANIM_CHECK ( ID_NOTES + 1 ) +#define ID_RTUPDATES_CHECK ( ID_NOTES + 2 ) + +BEGIN_EVENT_TABLE( SettingsDlg, wxDialog ) + + EVT_BUTTON( wxID_APPLY, SettingsDlg::OnApply ) + EVT_BUTTON( ID_NOTES, SettingsDlg::OnNotes ) + + EVT_CHECKBOX( ID_HINTANIM_CHECK, SettingsDlg::OnHintAnimCheck ) + EVT_CHECKBOX( ID_RTUPDATES_CHECK, SettingsDlg::OnRTUpdatesCheck ) + +END_EVENT_TABLE() + +SettingsDlg::SettingsDlg( wxWindow* pParent ) + + : wxDialog( pParent, -1, "Active Layout Settings...", + wxDefaultPosition, + wxSize( 325,585), + wxDIALOG_MODAL | wxCAPTION ) +{ + int curY = 10; + int lMargin = 50; + int lBoxMargin = lMargin - 20; + int checkHeight = 20; + int labelHeight = 20; + int boxWidth = 260; + int interBoxGap = 10; + int lastItemGap = 10; + + int topY = curY; + + curY += labelHeight; + + mpRTU_Check = new wxCheckBox( this, ID_RTUPDATES_CHECK, + "&Real-time updates", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpOPD_Check = new wxCheckBox( this, -1, "&Out of Pane drag", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpEDP_Check = new wxCheckBox( this, -1, "&Exact docking prediction", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpNDF_Check = new wxCheckBox( this, -1, "Non-destructive bar &friction", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpSPB_Check = new wxCheckBox( this, -1, "&Shaded pane borders", + wxPoint( lMargin, curY ) ); + + curY += checkHeight + lastItemGap; + + wxStaticBox* pDNDBox = new wxStaticBox( this, -1, "Drag && Drop settings", + wxPoint( lBoxMargin, topY ), + wxSize( boxWidth, curY - topY ) ); + + curY += interBoxGap; + + //////////////////////////////////////////////////////////////////// + + topY = curY; + + curY += labelHeight; + + mpHAP_Check = new wxCheckBox( this, ID_HINTANIM_CHECK, + "&Hint-Rect animation plugin", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpGCU_Check = new wxCheckBox( this, -1, "\"Garbage collecting\" &Updates-Mgr.", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpAFP_Check = new wxCheckBox( this, -1, "&Antiflicker plugin", + wxPoint( lMargin, curY ) ); + + curY += checkHeight; + + mpCSP_Check = new wxCheckBox( this, -1, "C&ustomization plugin", + wxPoint( lMargin, curY ) ); + + curY += checkHeight + lastItemGap; + + wxStaticBox* pPBox = new wxStaticBox( this, -1, "Plugins", + wxPoint( lBoxMargin, topY ), + wxSize( boxWidth, curY - topY ) ); + + curY += interBoxGap; + + //////////////////////////////////////////////////////////////////// + + wxSize fieldSz( 30,20 ); + int fieldHeight = 20; + int fieldCapMargin = lMargin + fieldSz.x + 5; + int fieldCapOfs = 4; + + topY = curY; + + curY += labelHeight; + + mpRWInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpRWLabel = new wxStaticText ( this, -1, "Resizing sash width(height)", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + + curY += fieldHeight; + + mpPTMInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpPTMLabel = new wxStaticText( this, -1, "Pene's top margin", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + + curY += fieldHeight; + + + mpPBMInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpPBMLabel = new wxStaticText( this, -1, "Pene's bottom margin", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + + curY += fieldHeight; + + + mpPLMInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpPLMLabel = new wxStaticText( this, -1, "Pane's left margin", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + + curY += fieldHeight; + + + mpPRMInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpPRMLabel = new wxStaticText( this, -1, "Pane's right margin", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + curY += fieldHeight + lastItemGap; + + wxStaticBox* pCPPBox = new wxStaticBox( this, -1, "Common Pane properties", + wxPoint( lBoxMargin, topY ), + wxSize( boxWidth, curY - topY ) ); + + curY += interBoxGap; + + //////////////////////////////////////////////////////////////////// + + topY = curY; + + curY += labelHeight; + + fieldSz.x = 65; + fieldCapMargin = lMargin + fieldSz.x + 10; + + mpDCInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpDCLabel = new wxStaticText ( this, -1, "Dark Color (hex-RGB)", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + curY += fieldHeight; + + mpLCInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpLCLabel = new wxStaticText ( this, -1, "Light Color (hex-RGB)", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + curY += fieldHeight; + + mpGCInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpGCLabel = new wxStaticText ( this, -1, "Gray Color (hex-RGB)", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + curY += fieldHeight; + + mpBCInput = new wxTextCtrl ( this, -1, "", + wxPoint( lMargin, curY ), + fieldSz ); + + mpBCLabel = new wxStaticText ( this, -1, "Pane border Color (hex-RGB)", + wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); + + curY += fieldHeight + lastItemGap; + + wxStaticBox* pCSPBox = new wxStaticBox( this, -1, "Coluor sheme properties", + wxPoint( lBoxMargin, topY ), + wxSize( boxWidth, curY - topY ) ); + + curY += interBoxGap; /*button ofs*/; + + //////////////////////////////////////////////////////////////////////////////// + + int lBtnMargin = 35; + int btnGap = 20; + int btnHeight = 22; + int btnWidth = 70; + + wxButton* mpApplyBtn = new wxButton( this, wxID_APPLY, "A&pply", + wxPoint( lBtnMargin, curY ), + wxSize( btnWidth, btnHeight ) ); + + wxButton* mpCancelBtn = new wxButton( this, wxID_CANCEL, "&Cancel", + wxPoint( lBtnMargin + btnWidth + btnGap, curY ), + wxSize( btnWidth, btnHeight ) ); + + wxButton* mpNotesBtn = new wxButton( this, ID_NOTES, "&Notes...", + wxPoint( lBtnMargin + 2*btnWidth + 2*btnGap, curY ), + wxSize( btnWidth, btnHeight ) ); + + mpApplyBtn->SetDefault(); + mpApplyBtn->SetFocus(); + + Center( wxBOTH ); +} + +void SettingsDlg::ExchangeFields( bool toDialog ) +{ + mToDlg = toDialog; + + ExchgCheck( mpRTU_Check, mRealTimeUpdatesOn ); + ExchgCheck( mpOPD_Check, mOutOfPaneDragOn ); + ExchgCheck( mpEDP_Check, mExactDockingPredictionOn ); + ExchgCheck( mpNDF_Check, mNonDestructFrictionOn ); + ExchgCheck( mpSPB_Check, m3DShadesOn ); + + ExchgCheck( mpHAP_Check, mHintRectAnimationOn ); + ExchgCheck( mpGCU_Check, mGCUpdatesMgrOn ); + ExchgCheck( mpAFP_Check, mAntiflickerPluginOn ); + ExchgCheck( mpCSP_Check, mCustomizationPluginOn ); + + ExchgIntField( mpRWInput, mSashWidth ); + ExchgIntField( mpPTMInput, mTopMargin ); + ExchgIntField( mpPBMInput, mBottomMargin ); + ExchgIntField( mpPLMInput, mLeftMargin ); + ExchgIntField( mpPRMInput, mRightMargin ); + + ExchgColourField( mpDCInput, mDarkCol ); + ExchgColourField( mpLCInput, mLightCol ); + ExchgColourField( mpGCInput, mGrayCol ); + ExchgColourField( mpBCInput, mBorderCol ); +} + +void SettingsDlg::OnApply( wxCommandEvent& event ) +{ + ExchangeFields( FALSE ); + EndModal( wxID_APPLY ); +} + +void SettingsDlg::OnNotes( wxCommandEvent& event ) +{ + wxMessageBox("Notes go here...(TBD)"); +} + +void SettingsDlg::OnRTUpdatesCheck( wxCommandEvent& event ) +{ + if ( mpRTU_Check->GetValue() == TRUE ) + { + // user probably wants to see how the real-time drag & drop + // works -- so we "let 'im know" that animation is N/A when + // real-time option is on + + mpHAP_Check->SetValue(FALSE); + mpHAP_Check->Refresh(); + } +} + +void SettingsDlg::OnHintAnimCheck( wxCommandEvent& event ) +{ + if ( mpHAP_Check->GetValue() == TRUE ) + { + // user probably wants to see some animation effects, + // but he/she forgot to turn off "real-time updates" + // setting -- so we do it for you :-) + + mpRTU_Check->SetValue(FALSE); + mpRTU_Check->Refresh(); + } +} + +void SettingsDlg::ExchgCheck( wxCheckBox* pChk, bool& value ) +{ + if ( mToDlg ) pChk->SetValue( value ); + + else value = pChk->GetValue(); +} + +void SettingsDlg::ExchgIntField( wxTextCtrl* pFld, int& value ) +{ + if ( mToDlg ) + { + char buf[32]; + + sprintf( buf, "%d", value ); + pFld->SetValue( buf ); + } + else + { + wxString txt = pFld->GetLineText( 0 ); + value = atoi( txt ); + } +} + +void SettingsDlg::ExchgColourField( wxTextCtrl* pFld, wxColour& value ) +{ + int rgbVal; + + if ( mToDlg ) + { + rgbVal = ( value.Red() & 0x0000FF ) | + ( (value.Green() << 8 ) & 0x00FF00 ) | + ( (value.Blue() << 16 ) & 0xFF0000 ); + + char buf[32]; + + sprintf( buf, "0x%06X", rgbVal ); + + pFld->SetValue( buf ); + } + else + { + wxString txt = pFld->GetLineText( 0 ); + + sscanf( txt, "0x%06X", &rgbVal ); + + value.Set( rgbVal & 0xFF, + ( rgbVal >> 8 ) & 0xFF, + ( rgbVal >> 16 ) & 0xFF ); + } +} + +bool SettingsDlg::TransferDataToWindow() +{ + ExchangeFields( TRUE ); + + return TRUE; +} + +bool SettingsDlg::TransferDataFromWindow() +{ + ExchangeFields( FALSE ); + + return TRUE; +} + +#include "controlbar.h" +#include "rowlayoutpl.h" +#include "antiflickpl.h" +#include "bardragpl.h" +#include "cbcustom.h" + +#include "gcupdatesmgr.h" +#include "hintanimpl.h" + +void SettingsDlg::ReadLayoutSettings( wxFrameLayout& fl ) +{ + cbDockPane& pane = *fl.GetPane( wxTOP ); + cbCommonPaneProperties& props = pane.mProps; + + mRealTimeUpdatesOn = props.mRealTimeUpdatesOn; + mOutOfPaneDragOn = props.mOutOfPaneDragOn; + mExactDockingPredictionOn = props.mExactDockPredictionOn; + mNonDestructFrictionOn = props.mNonDestructFirctionOn; + m3DShadesOn = props.mShow3DPaneBorderOn; + + mHintRectAnimationOn = fl.FindPlugin( CLASSINFO( cbHintAnimationPlugin ) ) != NULL; + mAntiflickerPluginOn = fl.FindPlugin( CLASSINFO( cbAntiflickerPlugin ) ) != NULL; + mCustomizationPluginOn = fl.FindPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ) != NULL; + mGCUpdatesMgrOn = fl.GetUpdatesManager().GetClassInfo() + == CLASSINFO( cbGCUpdatesMgr ); + + mSashWidth = props.mResizeHandleSize; + + mTopMargin = pane.mTopMargin; + mBottomMargin = pane.mBottomMargin; + mLeftMargin = pane.mLeftMargin; + mRightMargin = pane.mRightMargin; + + mDarkCol = fl.mDarkPen.GetColour(); + mLightCol = fl.mLightPen.GetColour(); + mGrayCol = fl.mGrayPen.GetColour(); + mBorderCol = fl.mBorderPen.GetColour(); +} + +void SettingsDlg::ApplyLayoutSettings( wxFrameLayout& fl ) +{ + cbCommonPaneProperties props; + + props.mRealTimeUpdatesOn = mRealTimeUpdatesOn; + props.mOutOfPaneDragOn = mOutOfPaneDragOn; + props.mExactDockPredictionOn = mExactDockingPredictionOn; + props.mNonDestructFirctionOn = mNonDestructFrictionOn; + props.mShow3DPaneBorderOn = m3DShadesOn; + + props.mResizeHandleSize = mSashWidth; + + fl.SetPaneProperties( props, wxALL_PANES ); + + if ( mHintRectAnimationOn ) fl.AddPlugin ( CLASSINFO( cbHintAnimationPlugin ) ); + else fl.RemovePlugin( CLASSINFO( cbHintAnimationPlugin ) ); + + if ( mAntiflickerPluginOn ) fl.AddPlugin ( CLASSINFO( cbAntiflickerPlugin ) ); + else fl.RemovePlugin( CLASSINFO( cbAntiflickerPlugin ) ); + + if ( mCustomizationPluginOn ) fl.AddPlugin ( CLASSINFO( cbSimpleCustomizationPlugin ) ); + else fl.RemovePlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ); + + // FOR NOW:: unfortunatelly, currently pane marin-information is currently + // placed into cbDockPane, instead of cbCommonPaneProperties + + fl.SetMargins( mTopMargin, mBottomMargin, + mLeftMargin, mRightMargin, wxALL_PANES ); + + fl.mDarkPen.SetColour( mDarkCol ); + fl.mLightPen.SetColour( mLightCol ); + fl.mGrayPen.SetColour( mGrayCol ); + fl.mBorderPen.SetColour( mBorderCol ); + + fl.RecalcLayout( TRUE ); + + // NOTE:: currently it's bit tricky changing updates-manager + // in future, updates-manager will become a normal plugin + // and more convenient methods (Add/FindPlugin) will be used + + if ( mGCUpdatesMgrOn && + fl.GetUpdatesManager().GetClassInfo() != CLASSINFO( cbGCUpdatesMgr ) + ) + + fl.SetUpdatesManager( new cbGCUpdatesMgr( &fl ) ); + else + if ( !mGCUpdatesMgrOn && + fl.GetUpdatesManager().GetClassInfo() == CLASSINFO( cbGCUpdatesMgr ) + ) + + fl.SetUpdatesManager( new cbSimpleUpdatesMgr( &fl ) ); +} diff --git a/utils/framelayout/samples/demo/settingsdlg.h b/utils/framelayout/samples/demo/settingsdlg.h new file mode 100644 index 0000000000..7ea1d4f847 --- /dev/null +++ b/utils/framelayout/samples/demo/settingsdlg.h @@ -0,0 +1,99 @@ +#ifndef __SETTINGSDLG_G__ +#define __SETTINGSDLG_G__ + +#include "wx/dialog.h" + +class wxFrameLayout; + +class SettingsDlg : public wxDialog +{ +protected: + + // "nice thing" about wxWindows: + + wxCheckBox* mpRTU_Check; + wxCheckBox* mpOPD_Check; + wxCheckBox* mpEDP_Check; + wxCheckBox* mpNDF_Check; + wxCheckBox* mpSPB_Check; + + wxCheckBox* mpHAP_Check; + wxCheckBox* mpGCU_Check; + wxCheckBox* mpAFP_Check; + wxCheckBox* mpCSP_Check; + + wxTextCtrl* mpRWInput; + wxStaticText* mpRWLabel; + wxTextCtrl* mpPTMInput; + wxStaticText* mpPTMLabel; + wxTextCtrl* mpPBMInput; + wxStaticText* mpPBMLabel; + wxTextCtrl* mpPLMInput; + wxStaticText* mpPLMLabel; + wxTextCtrl* mpPRMInput; + wxStaticText* mpPRMLabel; + + wxTextCtrl* mpDCInput; + wxStaticText* mpDCLabel; + wxTextCtrl* mpLCInput; + wxStaticText* mpLCLabel; + wxTextCtrl* mpGCInput; + wxStaticText* mpGCLabel; + wxTextCtrl* mpBCInput; + wxStaticText* mpBCLabel; + + // fields/properties + + bool mRealTimeUpdatesOn; + bool mOutOfPaneDragOn; + bool mExactDockingPredictionOn; + bool mNonDestructFrictionOn; + bool m3DShadesOn; + bool mHintRectAnimationOn; + bool mGCUpdatesMgrOn; + bool mAntiflickerPluginOn; + bool mCustomizationPluginOn; + + int mSashWidth; + int mTopMargin; + int mBottomMargin; + int mLeftMargin; + int mRightMargin; + + wxColour mDarkCol; + wxColour mLightCol; + wxColour mGrayCol; + wxColour mBorderCol; + +protected: + + bool mToDlg; + + // helpers + + void ExchgCheck( wxCheckBox* pChk, bool& value ); + void ExchgIntField( wxTextCtrl* pFld, int& value ); + void ExchgColourField( wxTextCtrl* pFld, wxColour& value ); + + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + +public: + + SettingsDlg( wxWindow* pParent ); + + void ReadLayoutSettings( wxFrameLayout& fl ); + void ApplyLayoutSettings( wxFrameLayout& fl ); + + void ExchangeFields( bool toDialog ); + + void OnApply( wxCommandEvent& event ); + void OnNotes( wxCommandEvent& event ); + + void OnHintAnimCheck( wxCommandEvent& event ); + void OnRTUpdatesCheck( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); +}; + +#endif \ No newline at end of file diff --git a/utils/framelayout/samples/demo/wxinfo.cpp b/utils/framelayout/samples/demo/wxinfo.cpp new file mode 100644 index 0000000000..5f4d3ab8cd --- /dev/null +++ b/utils/framelayout/samples/demo/wxinfo.cpp @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: No names yet. +// Purpose: Contrib. demo +// Author: Aleksandras Gluchovas +// Modified by: +// Created: 23/11/98 +// RCS-ID: $Id$ +// Copyright: 1998 (c) Aleksandras Gluchovas +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "wxinifo.cpp" +#pragma interface "wxinifo.cpp" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "wx/hash.h" +#include "wxinfo.h" + +inline static void expand_item( wxTreeCtrl* pTree, wxTreeItemId& itemId ) +{ + pTree->Expand( itemId ); +} + +void wxCreateClassInfoTree( wxTreeCtrl* pTree, + wxTreeItemId parentBranchId, + long classImageNo + ) +{ + expand_item( pTree, parentBranchId ); + + wxHashTable hash; + + wxList lst; + + // collect all classes into list + + { + wxClassInfo* pCur = wxClassInfo::GetFirst(); + + wxClassInfo::InitializeClasses(); + + while( pCur ) + { + lst.Append( (wxObject*)pCur ); + + pCur = pCur->GetNext(); + } + } + + wxClassInfo::InitializeClasses(); + + // reflect class-hierarchy into the tree nodes + + int nHanged; + + do + { + nHanged = 0; + + wxNode* pCur = lst.First(); + + // repeat passes through class list, untill all of + // the class items are "hanged" onto their parent-items in the tree + + while( pCur ) + { + wxClassInfo& info = *((wxClassInfo*)pCur->Data()); + + if ( info.GetBaseClass1() == NULL ) + { + // parentless classes are put into the root branch + + wxTreeItemId* pId = new wxTreeItemId(); + *pId = pTree->AppendItem( parentBranchId, info.GetClassName(), classImageNo ); + + expand_item( pTree, *pId ); + + // "remember" it + hash.Put( long(&info), (wxObject*)pId ); + + // class is "hanged", remove it from the list + wxNode* pTmp = pCur; + + pCur = pCur->Next(); + + delete pTmp; + + ++nHanged; + } + else + { + wxTreeItemId* pParentId = (wxTreeItemId*)hash.Get( (long)info.GetBaseClass1() ); + + if ( pParentId != NULL ) + { + wxTreeItemId* pId = new wxTreeItemId(); + + *pId = pTree->AppendItem( *pParentId, info.GetClassName(), classImageNo ); + + expand_item( pTree, *pId ); + + hash.Put( long(&info), (wxObject*)pId ); + + wxNode* pTmp = pCur; + + pCur = pCur->Next(); + + // class is "hanged", remove it from the list + delete pTmp; + + ++nHanged; + } + else + { + // otherwise there's a parent, but it's not in the tree yet... + // hope to "hang" it in the subsequent passes + + pCur = pCur->Next(); + } + } + } + + } while( nHanged != 0 ); +} + +void wxCreateSerializerInfoTree( wxTreeCtrl* pTree, + wxTreeItemId parentBranchId, + long classImageNo + ) +{ + expand_item( pTree, parentBranchId ); + + wxSerializerInfo::InitializeSerializers(); + + // FOR NOW:: no hierarchy - one branch + + wxSerializerInfo* pCur = wxSerializerInfo::first; + + while( pCur ) + { + wxString fullName = pCur->className + wxString( "Serializer" ); + + pTree->AppendItem( parentBranchId, fullName, classImageNo ); + + pCur = pCur->next; + } +} diff --git a/utils/framelayout/samples/demo/wxinfo.h b/utils/framelayout/samples/demo/wxinfo.h new file mode 100644 index 0000000000..9e9d135ab4 --- /dev/null +++ b/utils/framelayout/samples/demo/wxinfo.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: No names yet. +// Purpose: Contrib. demo +// Author: Aleksandras Gluchovas +// Modified by: +// Created: 23/11/98 +// RCS-ID: $Id$ +// Copyright: 1998 (c) Aleksandras Gluchovas +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WXINFO_G__ +#define __WXINFO_G__ + +#include "wx/object.h" +#include "wx/treectrl.h" + +#include "objstore.h" + +/* + * creates tree with hierarchically cauptured + * information about wxWindows dynamic classes (at "current run-time") + */ + +void wxCreateClassInfoTree( wxTreeCtrl* pTree, + wxTreeItemId parentBranchId, + long classImageNo = -1 + ); + +/* + * creates tree with information about + * serializer-classes (at current run-time) + * NOTE:: "objstore.cpp" should be compiled in + */ + +void wxCreateSerializerInfoTree( wxTreeCtrl* pTree, // existing tree control + wxTreeItemId parentBranchId, + long classImageNo = -1 // (-1) - text only + ); + +#endif diff --git a/utils/framelayout/src/Makefile.in b/utils/framelayout/src/Makefile.in index 5e39eab3f9..dd44f2de11 100644 --- a/utils/framelayout/src/Makefile.in +++ b/utils/framelayout/src/Makefile.in @@ -40,13 +40,10 @@ hintanimpl.cpp \ newbmpbtn.cpp \ objstore.cpp \ panedrawpl.cpp \ -pf_sample.cpp \ rowdragpl.cpp \ rowlayoutpl.cpp \ -settingsdlg.cpp \ toolwnd.cpp \ -updatesmgr.cpp \ -wxinfo.cpp +updatesmgr.cpp #define library objects LIB_OBJ= \ @@ -64,7 +61,7 @@ ADD_COMPILE= include ../../../../template.mak install:: - @echo "Installing library files and headers for libwx_gl_gtk.." + @echo "Installing library files and headers for libwx_fl_gtk.." @echo " Creating directory.." @$(WXBASEDIR)/mkinstalldirs /usr/local/include/wx_fl @echo " Copying headers from framelayout/src" diff --git a/utils/framelayout/src/newbmpbtn.cpp b/utils/framelayout/src/newbmpbtn.cpp index 617abfbf75..3f2efd9216 100644 --- a/utils/framelayout/src/newbmpbtn.cpp +++ b/utils/framelayout/src/newbmpbtn.cpp @@ -71,7 +71,6 @@ static int* create_array( int width, int height, int fill = 0 ) static void gray_out_pixmap( int* src, int* dest, int width, int height ) { // assuming the pixels along the edges are of the background color - int bgCol = GET_ELEM(src,0,0); int x = 0; int y = 1; @@ -80,9 +79,6 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height ) { int cur = GET_ELEM(src,x,y); - int r = GET_RED(cur); - int g = GET_GREEN(cur); - int b = GET_BLUE(cur); if ( IS_IN_ARRAY(x-1,y-1) ) { @@ -167,11 +163,6 @@ void greay_out_image_on_dc( wxDC& dc, int width, int height ) wxColour col; dc.GetPixel( x,y, &col ); - int r = col.Red(), - g = col.Green(), - b = col.Blue(); - - int o = MAKE_INT_COLOR( r,g,b ); GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() ); } @@ -233,37 +224,38 @@ wxNewBitmapButton::wxNewBitmapButton( const wxBitmap& labelBitmap, int marginY, int textToLabelGap, bool isSticky) - : mpDepressedImg( NULL ), - mpPressedImg ( NULL ), - mpDisabledImg ( NULL ), - mpFocusedImg ( NULL ), - + : mTextToLabelGap ( textToLabelGap ), mMarginX( marginX ), mMarginY( marginY ), mTextAlignment( alignText ), + mIsSticky( isSticky ), mIsFlat( isFlat ), + mLabelText( labelText ), + mImageFileType( -1 ), + mDepressedBmp( labelBitmap ), + + mpDepressedImg( NULL ), + mpPressedImg ( NULL ), + mpDisabledImg ( NULL ), + mpFocusedImg ( NULL ), + - mIsPressed ( FALSE ), mDragStarted ( FALSE ), + mIsPressed ( FALSE ), + mIsInFocus( FALSE ), mPrevPressedState( FALSE ), - mTextToLabelGap ( textToLabelGap ), + mPrevInFocusState( FALSE ), + mHasFocusedBmp( FALSE ), + mFiredEventType( firedEventType ), mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ), mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ), mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ), - mFiredEventType( firedEventType ), - mIsSticky( isSticky ), mIsCreated( FALSE ), - mSizeIsSet( FALSE ), + mSizeIsSet( FALSE ) - mHasFocusedBmp( FALSE ), - mIsInFocus( FALSE ), - - mDepressedBmp( labelBitmap ), - mLabelText( labelText ), - mImageFileType( -1 ) { } @@ -278,39 +270,38 @@ wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName, int textToLabelGap, bool isSticky) - : mpDepressedImg( NULL ), - mpPressedImg ( NULL ), - mpDisabledImg ( NULL ), - mpFocusedImg ( NULL ), - + : mTextToLabelGap ( 2 ), mMarginX( 2 ), mMarginY( 2 ), mTextAlignment( alignText ), + mIsSticky( FALSE ), mIsFlat( isFlat ), + mLabelText( labelText ), + mImageFileName( bitmapFileName ), + mImageFileType( bitmapFileType ), + + mpDepressedImg( NULL ), + mpPressedImg ( NULL ), + mpDisabledImg ( NULL ), + mpFocusedImg ( NULL ), - mIsPressed ( FALSE ), mDragStarted ( FALSE ), + mIsPressed ( FALSE ), + mIsInFocus ( FALSE ), mPrevPressedState( FALSE ), - mTextToLabelGap ( 2 ), + mPrevInFocusState( FALSE ), + mHasFocusedBmp( FALSE ), + mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ), mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ), mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ), mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ), - mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ), - mIsSticky( FALSE ), mIsCreated( FALSE ), - mSizeIsSet( FALSE ), - - mHasFocusedBmp( FALSE ), - mIsInFocus( FALSE ), + mSizeIsSet( FALSE ) - mLabelText( labelText ), - mImageFileName( bitmapFileName ), - mImageFileType( bitmapFileType ) { - //mDepressedBmp.LoadFile( bitmapFileName, bitmapFileType ); } wxNewBitmapButton::~wxNewBitmapButton(void) @@ -379,6 +370,11 @@ wxBitmap* wxNewBitmapButton::GetStateLabel() return mpDisabledImg; } +static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA, + 0x55,0xAA,0x55,0xAA, + 0x55,0xAA,0x55,0xAA, + 0x55,0xAA,0x55,0xAA + }; void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp, bool isEnabled, bool isPressed ) { @@ -461,10 +457,11 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp, if ( hasImage ) { + destDc.Blit( imgPos.x, imgPos.y, - srcBmp->GetWidth()+1, - srcBmp->GetHeight()+1, - &srcDc, 0,0, wxCOPY,TRUE ); + srcBmp->GetWidth()+1, + srcBmp->GetHeight()+1, + &srcDc, 0,0, wxCOPY,TRUE ); } if ( hasText ) @@ -482,17 +479,73 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp, destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) ); - // Should be wxSYS_COLOUR_BTNTEXT, but gtk gives white? - destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) ); + if( isEnabled ){ + destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) ); + }else{ + destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW) ); + } destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) ); destDc.DrawText( mLabelText, txtPos.x, txtPos.y ); } - if ( !isEnabled ) + + destDc.SetBrush( grayBrush ); + destDc.SetPen( nullPen ); + + destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 ); + + if ( isPressed ) + { + ++imgPos.x; ++imgPos.y; + ++txtPos.x; ++txtPos.y; + } + + if ( hasImage ) + { + + destDc.Blit( imgPos.x, imgPos.y, + srcBmp->GetWidth()+1, + srcBmp->GetHeight()+1, + &srcDc, 0,0, wxCOPY,TRUE ); + } + + if ( hasText ) + { + wxWindow* pTopWnd = this; + + do + { + wxWindow* pParent = pTopWnd->GetParent(); + + if ( pParent == 0 ) break; + + pTopWnd = pParent; + } while(1); + + destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) ); + + if( isEnabled ){ + destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) ); + }else{ + destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW) ); + } + destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) ); + + destDc.DrawText( mLabelText, txtPos.x, txtPos.y ); + } + + if ( !isEnabled ){ +#ifdef __WXMSW // This is currently MSW specific greay_out_image_on_dc( destDc, destDim.x, destDim.y ); - +#else + wxBrush checkerBrush( wxBitmap( (const char*)_gDisableImage,8,8) ); + checkerBrush.SetColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) ); + destDc.SetBrush( checkerBrush ); + destDc.DrawRectangle( imgPos.x, imgPos.y, srcBmp->GetWidth()+1, srcBmp->GetHeight()+1); +#endif + } // adjust button size to fit the new dimensions of the label if ( !mSizeIsSet && 0 ) { @@ -503,6 +556,17 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp, ); } } +void wxNewBitmapButton::RenderAllLabelImages() +{ + if( !mIsCreated ) return; + RenderLabelImage( mpDisabledImg, &mDepressedBmp, FALSE ); + RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE ); + RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE ); + if ( mHasFocusedBmp ){ + RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE ); + } +} + void wxNewBitmapButton::RenderLabelImages() { @@ -572,7 +636,8 @@ void wxNewBitmapButton::SetLabel(const wxBitmap& labelBitmap, mLabelText = labelText; mDepressedBmp = labelBitmap; - RenderLabelImages(); + //RenderLabelImages(); + RenderAllLabelImages(); } void wxNewBitmapButton::SetAlignments( int alignText, @@ -587,7 +652,8 @@ void wxNewBitmapButton::SetAlignments( int alignText, mTextAlignment = alignText; mTextToLabelGap = textToLabelGap; - RenderLabelImages(); + //RenderLabelImages(); + RenderAllLabelImages(); } // event handlers @@ -636,6 +702,8 @@ bool wxNewBitmapButton::IsInWindow( int x, int y ) void wxNewBitmapButton::OnMouseMove( wxMouseEvent& event ) { + mPrevPressedState=mIsPressed; + mPrevInFocusState=mIsInFocus; if ( !mIsInFocus && IsInWindow( event.m_x, event.m_y ) ) { if ( !mDragStarted ) @@ -659,16 +727,11 @@ void wxNewBitmapButton::OnMouseMove( wxMouseEvent& event ) mIsPressed = TRUE; else mIsPressed = FALSE; - - if ( mIsPressed != mPrevPressedState ) - - Refresh(); - - mPrevPressedState = mIsPressed; } - // FOR NOW:: - Refresh(); + if((mIsPressed != mPrevPressedState)||(mIsInFocus!=mPrevInFocusState)){ + Refresh(); + } } void wxNewBitmapButton::OnSize( wxSizeEvent& event ) @@ -678,6 +741,7 @@ void wxNewBitmapButton::OnSize( wxSizeEvent& event ) void wxNewBitmapButton::Reshape( ) { + bool wasCreated = mIsCreated; mIsCreated = TRUE; @@ -693,7 +757,8 @@ void wxNewBitmapButton::Reshape( ) //wxMessageBox("Image Loaded!!!"); } - RenderLabelImages(); + //RenderLabelImages(); + RenderAllLabelImages(); wxBitmap* pCurImg = GetStateLabel(); @@ -713,7 +778,7 @@ void wxNewBitmapButton::DrawLabel( wxDC& dc ) wxSizeEvent evt; OnSize( evt ); // fake it up! - RenderLabelImages(); + //RenderLabelImages(); pCurBmp = GetStateLabel(); } @@ -734,7 +799,7 @@ void wxNewBitmapButton::OnPaint( wxPaintEvent& event ) wxPaintDC dc(this); // first, make sure images for current state are prepared - RenderLabelImages(); + //RenderLabelImages(); DrawLabel( dc ); diff --git a/utils/framelayout/src/newbmpbtn.h b/utils/framelayout/src/newbmpbtn.h index df25a45752..9d0c6315d0 100644 --- a/utils/framelayout/src/newbmpbtn.h +++ b/utils/framelayout/src/newbmpbtn.h @@ -42,11 +42,11 @@ protected: int mMarginY; int mTextAlignment; bool mIsSticky; + bool mIsFlat; wxString mLabelText; wxString mImageFileName; int mImageFileType; - bool mIsFlat; wxBitmap mDepressedBmp; // source image for rendering // labels for particular state @@ -64,6 +64,7 @@ protected: bool mIsPressed; bool mIsInFocus; bool mPrevPressedState; + bool mPrevInFocusState; bool mHasFocusedBmp; @@ -142,6 +143,7 @@ public: bool isPressed = FALSE); virtual void RenderLabelImages(); + virtual void RenderAllLabelImages(); // event handlers void OnLButtonDown( wxMouseEvent& event ); diff --git a/utils/framelayout/src/settingsdlg.cpp b/utils/framelayout/src/settingsdlg.cpp deleted file mode 100644 index c1a861679a..0000000000 --- a/utils/framelayout/src/settingsdlg.cpp +++ /dev/null @@ -1,496 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: settingsdlg.cpp -// Purpose: Settings dialog for Frame Layout -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 05/11/98 -// RCS-ID: $Id$ -// Copyright: (c) Aleksandras Gluchovas -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "settingsdlg.cpp" -#pragma interface "settingsdlg.cpp" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include "settingsdlg.h" - -/***** Implementation for class SettingsDlg *****/ - -#define ID_NOTES ( wxEVT_FIRST + 1000 ) -#define ID_HINTANIM_CHECK ( ID_NOTES + 1 ) -#define ID_RTUPDATES_CHECK ( ID_NOTES + 2 ) - -BEGIN_EVENT_TABLE( SettingsDlg, wxDialog ) - - EVT_BUTTON( wxID_APPLY, SettingsDlg::OnApply ) - EVT_BUTTON( ID_NOTES, SettingsDlg::OnNotes ) - - EVT_CHECKBOX( ID_HINTANIM_CHECK, SettingsDlg::OnHintAnimCheck ) - EVT_CHECKBOX( ID_RTUPDATES_CHECK, SettingsDlg::OnRTUpdatesCheck ) - -END_EVENT_TABLE() - -SettingsDlg::SettingsDlg( wxWindow* pParent ) - - : wxDialog( pParent, -1, "Active Layout Settings...", - wxDefaultPosition, - wxSize( 325,585), - wxDIALOG_MODAL | wxCAPTION ) -{ - int curY = 10; - int lMargin = 50; - int lBoxMargin = lMargin - 20; - int checkHeight = 20; - int labelHeight = 20; - int boxWidth = 260; - int interBoxGap = 10; - int lastItemGap = 10; - - int topY = curY; - - curY += labelHeight; - - mpRTU_Check = new wxCheckBox( this, ID_RTUPDATES_CHECK, - "&Real-time updates", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpOPD_Check = new wxCheckBox( this, -1, "&Out of Pane drag", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpEDP_Check = new wxCheckBox( this, -1, "&Exact docking prediction", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpNDF_Check = new wxCheckBox( this, -1, "Non-destructive bar &friction", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpSPB_Check = new wxCheckBox( this, -1, "&Shaded pane borders", - wxPoint( lMargin, curY ) ); - - curY += checkHeight + lastItemGap; - - wxStaticBox* pDNDBox = new wxStaticBox( this, -1, "Drag && Drop settings", - wxPoint( lBoxMargin, topY ), - wxSize( boxWidth, curY - topY ) ); - - curY += interBoxGap; - - //////////////////////////////////////////////////////////////////// - - topY = curY; - - curY += labelHeight; - - mpHAP_Check = new wxCheckBox( this, ID_HINTANIM_CHECK, - "&Hint-Rect animation plugin", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpGCU_Check = new wxCheckBox( this, -1, "\"Garbage collecting\" &Updates-Mgr.", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpAFP_Check = new wxCheckBox( this, -1, "&Antiflicker plugin", - wxPoint( lMargin, curY ) ); - - curY += checkHeight; - - mpCSP_Check = new wxCheckBox( this, -1, "C&ustomization plugin", - wxPoint( lMargin, curY ) ); - - curY += checkHeight + lastItemGap; - - wxStaticBox* pPBox = new wxStaticBox( this, -1, "Plugins", - wxPoint( lBoxMargin, topY ), - wxSize( boxWidth, curY - topY ) ); - - curY += interBoxGap; - - //////////////////////////////////////////////////////////////////// - - wxSize fieldSz( 30,20 ); - int fieldHeight = 20; - int fieldCapMargin = lMargin + fieldSz.x + 5; - int fieldCapOfs = 4; - - topY = curY; - - curY += labelHeight; - - mpRWInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpRWLabel = new wxStaticText ( this, -1, "Resizing sash width(height)", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - - curY += fieldHeight; - - mpPTMInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpPTMLabel = new wxStaticText( this, -1, "Pene's top margin", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - - curY += fieldHeight; - - - mpPBMInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpPBMLabel = new wxStaticText( this, -1, "Pene's bottom margin", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - - curY += fieldHeight; - - - mpPLMInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpPLMLabel = new wxStaticText( this, -1, "Pane's left margin", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - - curY += fieldHeight; - - - mpPRMInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpPRMLabel = new wxStaticText( this, -1, "Pane's right margin", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - curY += fieldHeight + lastItemGap; - - wxStaticBox* pCPPBox = new wxStaticBox( this, -1, "Common Pane properties", - wxPoint( lBoxMargin, topY ), - wxSize( boxWidth, curY - topY ) ); - - curY += interBoxGap; - - //////////////////////////////////////////////////////////////////// - - topY = curY; - - curY += labelHeight; - - fieldSz.x = 65; - fieldCapMargin = lMargin + fieldSz.x + 10; - - mpDCInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpDCLabel = new wxStaticText ( this, -1, "Dark Color (hex-RGB)", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - curY += fieldHeight; - - mpLCInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpLCLabel = new wxStaticText ( this, -1, "Light Color (hex-RGB)", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - curY += fieldHeight; - - mpGCInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpGCLabel = new wxStaticText ( this, -1, "Gray Color (hex-RGB)", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - curY += fieldHeight; - - mpBCInput = new wxTextCtrl ( this, -1, "", - wxPoint( lMargin, curY ), - fieldSz ); - - mpBCLabel = new wxStaticText ( this, -1, "Pane border Color (hex-RGB)", - wxPoint( fieldCapMargin, curY + fieldCapOfs ) ); - - curY += fieldHeight + lastItemGap; - - wxStaticBox* pCSPBox = new wxStaticBox( this, -1, "Coluor sheme properties", - wxPoint( lBoxMargin, topY ), - wxSize( boxWidth, curY - topY ) ); - - curY += interBoxGap; /*button ofs*/; - - //////////////////////////////////////////////////////////////////////////////// - - int lBtnMargin = 35; - int btnGap = 20; - int btnHeight = 22; - int btnWidth = 70; - - wxButton* mpApplyBtn = new wxButton( this, wxID_APPLY, "A&pply", - wxPoint( lBtnMargin, curY ), - wxSize( btnWidth, btnHeight ) ); - - wxButton* mpCancelBtn = new wxButton( this, wxID_CANCEL, "&Cancel", - wxPoint( lBtnMargin + btnWidth + btnGap, curY ), - wxSize( btnWidth, btnHeight ) ); - - wxButton* mpNotesBtn = new wxButton( this, ID_NOTES, "&Notes...", - wxPoint( lBtnMargin + 2*btnWidth + 2*btnGap, curY ), - wxSize( btnWidth, btnHeight ) ); - - mpApplyBtn->SetDefault(); - mpApplyBtn->SetFocus(); - - Center( wxBOTH ); -} - -void SettingsDlg::ExchangeFields( bool toDialog ) -{ - mToDlg = toDialog; - - ExchgCheck( mpRTU_Check, mRealTimeUpdatesOn ); - ExchgCheck( mpOPD_Check, mOutOfPaneDragOn ); - ExchgCheck( mpEDP_Check, mExactDockingPredictionOn ); - ExchgCheck( mpNDF_Check, mNonDestructFrictionOn ); - ExchgCheck( mpSPB_Check, m3DShadesOn ); - - ExchgCheck( mpHAP_Check, mHintRectAnimationOn ); - ExchgCheck( mpGCU_Check, mGCUpdatesMgrOn ); - ExchgCheck( mpAFP_Check, mAntiflickerPluginOn ); - ExchgCheck( mpCSP_Check, mCustomizationPluginOn ); - - ExchgIntField( mpRWInput, mSashWidth ); - ExchgIntField( mpPTMInput, mTopMargin ); - ExchgIntField( mpPBMInput, mBottomMargin ); - ExchgIntField( mpPLMInput, mLeftMargin ); - ExchgIntField( mpPRMInput, mRightMargin ); - - ExchgColourField( mpDCInput, mDarkCol ); - ExchgColourField( mpLCInput, mLightCol ); - ExchgColourField( mpGCInput, mGrayCol ); - ExchgColourField( mpBCInput, mBorderCol ); -} - -void SettingsDlg::OnApply( wxCommandEvent& event ) -{ - ExchangeFields( FALSE ); - EndModal( wxID_APPLY ); -} - -void SettingsDlg::OnNotes( wxCommandEvent& event ) -{ - wxMessageBox("Notes go here...(TBD)"); -} - -void SettingsDlg::OnRTUpdatesCheck( wxCommandEvent& event ) -{ - if ( mpRTU_Check->GetValue() == TRUE ) - { - // user probably wants to see how the real-time drag & drop - // works -- so we "let 'im know" that animation is N/A when - // real-time option is on - - mpHAP_Check->SetValue(FALSE); - mpHAP_Check->Refresh(); - } -} - -void SettingsDlg::OnHintAnimCheck( wxCommandEvent& event ) -{ - if ( mpHAP_Check->GetValue() == TRUE ) - { - // user probably wants to see some animation effects, - // but he/she forgot to turn off "real-time updates" - // setting -- so we do it for you :-) - - mpRTU_Check->SetValue(FALSE); - mpRTU_Check->Refresh(); - } -} - -void SettingsDlg::ExchgCheck( wxCheckBox* pChk, bool& value ) -{ - if ( mToDlg ) pChk->SetValue( value ); - - else value = pChk->GetValue(); -} - -void SettingsDlg::ExchgIntField( wxTextCtrl* pFld, int& value ) -{ - if ( mToDlg ) - { - char buf[32]; - - sprintf( buf, "%d", value ); - pFld->SetValue( buf ); - } - else - { - wxString txt = pFld->GetLineText( 0 ); - value = atoi( txt ); - } -} - -void SettingsDlg::ExchgColourField( wxTextCtrl* pFld, wxColour& value ) -{ - int rgbVal; - - if ( mToDlg ) - { - rgbVal = ( value.Red() & 0x0000FF ) | - ( (value.Green() << 8 ) & 0x00FF00 ) | - ( (value.Blue() << 16 ) & 0xFF0000 ); - - char buf[32]; - - sprintf( buf, "0x%06X", rgbVal ); - - pFld->SetValue( buf ); - } - else - { - wxString txt = pFld->GetLineText( 0 ); - - sscanf( txt, "0x%06X", &rgbVal ); - - value.Set( rgbVal & 0xFF, - ( rgbVal >> 8 ) & 0xFF, - ( rgbVal >> 16 ) & 0xFF ); - } -} - -bool SettingsDlg::TransferDataToWindow() -{ - ExchangeFields( TRUE ); - - return TRUE; -} - -bool SettingsDlg::TransferDataFromWindow() -{ - ExchangeFields( FALSE ); - - return TRUE; -} - -#include "controlbar.h" -#include "rowlayoutpl.h" -#include "antiflickpl.h" -#include "bardragpl.h" -#include "cbcustom.h" - -#include "gcupdatesmgr.h" -#include "hintanimpl.h" - -void SettingsDlg::ReadLayoutSettings( wxFrameLayout& fl ) -{ - cbDockPane& pane = *fl.GetPane( wxTOP ); - cbCommonPaneProperties& props = pane.mProps; - - mRealTimeUpdatesOn = props.mRealTimeUpdatesOn; - mOutOfPaneDragOn = props.mOutOfPaneDragOn; - mExactDockingPredictionOn = props.mExactDockPredictionOn; - mNonDestructFrictionOn = props.mNonDestructFirctionOn; - m3DShadesOn = props.mShow3DPaneBorderOn; - - mHintRectAnimationOn = fl.FindPlugin( CLASSINFO( cbHintAnimationPlugin ) ) != NULL; - mAntiflickerPluginOn = fl.FindPlugin( CLASSINFO( cbAntiflickerPlugin ) ) != NULL; - mCustomizationPluginOn = fl.FindPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ) != NULL; - mGCUpdatesMgrOn = fl.GetUpdatesManager().GetClassInfo() - == CLASSINFO( cbGCUpdatesMgr ); - - mSashWidth = props.mResizeHandleSize; - - mTopMargin = pane.mTopMargin; - mBottomMargin = pane.mBottomMargin; - mLeftMargin = pane.mLeftMargin; - mRightMargin = pane.mRightMargin; - - mDarkCol = fl.mDarkPen.GetColour(); - mLightCol = fl.mLightPen.GetColour(); - mGrayCol = fl.mGrayPen.GetColour(); - mBorderCol = fl.mBorderPen.GetColour(); -} - -void SettingsDlg::ApplyLayoutSettings( wxFrameLayout& fl ) -{ - cbCommonPaneProperties props; - - props.mRealTimeUpdatesOn = mRealTimeUpdatesOn; - props.mOutOfPaneDragOn = mOutOfPaneDragOn; - props.mExactDockPredictionOn = mExactDockingPredictionOn; - props.mNonDestructFirctionOn = mNonDestructFrictionOn; - props.mShow3DPaneBorderOn = m3DShadesOn; - - props.mResizeHandleSize = mSashWidth; - - fl.SetPaneProperties( props, wxALL_PANES ); - - if ( mHintRectAnimationOn ) fl.AddPlugin ( CLASSINFO( cbHintAnimationPlugin ) ); - else fl.RemovePlugin( CLASSINFO( cbHintAnimationPlugin ) ); - - if ( mAntiflickerPluginOn ) fl.AddPlugin ( CLASSINFO( cbAntiflickerPlugin ) ); - else fl.RemovePlugin( CLASSINFO( cbAntiflickerPlugin ) ); - - if ( mCustomizationPluginOn ) fl.AddPlugin ( CLASSINFO( cbSimpleCustomizationPlugin ) ); - else fl.RemovePlugin( CLASSINFO( cbSimpleCustomizationPlugin ) ); - - // FOR NOW:: unfortunatelly, currently pane marin-information is currently - // placed into cbDockPane, instead of cbCommonPaneProperties - - fl.SetMargins( mTopMargin, mBottomMargin, - mLeftMargin, mRightMargin, wxALL_PANES ); - - fl.mDarkPen.SetColour( mDarkCol ); - fl.mLightPen.SetColour( mLightCol ); - fl.mGrayPen.SetColour( mGrayCol ); - fl.mBorderPen.SetColour( mBorderCol ); - - fl.RecalcLayout( TRUE ); - - // NOTE:: currently it's bit tricky changing updates-manager - // in future, updates-manager will become a normal plugin - // and more convenient methods (Add/FindPlugin) will be used - - if ( mGCUpdatesMgrOn && - fl.GetUpdatesManager().GetClassInfo() != CLASSINFO( cbGCUpdatesMgr ) - ) - - fl.SetUpdatesManager( new cbGCUpdatesMgr( &fl ) ); - else - if ( !mGCUpdatesMgrOn && - fl.GetUpdatesManager().GetClassInfo() == CLASSINFO( cbGCUpdatesMgr ) - ) - - fl.SetUpdatesManager( new cbSimpleUpdatesMgr( &fl ) ); -} diff --git a/utils/framelayout/src/settingsdlg.h b/utils/framelayout/src/settingsdlg.h deleted file mode 100644 index 7ea1d4f847..0000000000 --- a/utils/framelayout/src/settingsdlg.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef __SETTINGSDLG_G__ -#define __SETTINGSDLG_G__ - -#include "wx/dialog.h" - -class wxFrameLayout; - -class SettingsDlg : public wxDialog -{ -protected: - - // "nice thing" about wxWindows: - - wxCheckBox* mpRTU_Check; - wxCheckBox* mpOPD_Check; - wxCheckBox* mpEDP_Check; - wxCheckBox* mpNDF_Check; - wxCheckBox* mpSPB_Check; - - wxCheckBox* mpHAP_Check; - wxCheckBox* mpGCU_Check; - wxCheckBox* mpAFP_Check; - wxCheckBox* mpCSP_Check; - - wxTextCtrl* mpRWInput; - wxStaticText* mpRWLabel; - wxTextCtrl* mpPTMInput; - wxStaticText* mpPTMLabel; - wxTextCtrl* mpPBMInput; - wxStaticText* mpPBMLabel; - wxTextCtrl* mpPLMInput; - wxStaticText* mpPLMLabel; - wxTextCtrl* mpPRMInput; - wxStaticText* mpPRMLabel; - - wxTextCtrl* mpDCInput; - wxStaticText* mpDCLabel; - wxTextCtrl* mpLCInput; - wxStaticText* mpLCLabel; - wxTextCtrl* mpGCInput; - wxStaticText* mpGCLabel; - wxTextCtrl* mpBCInput; - wxStaticText* mpBCLabel; - - // fields/properties - - bool mRealTimeUpdatesOn; - bool mOutOfPaneDragOn; - bool mExactDockingPredictionOn; - bool mNonDestructFrictionOn; - bool m3DShadesOn; - bool mHintRectAnimationOn; - bool mGCUpdatesMgrOn; - bool mAntiflickerPluginOn; - bool mCustomizationPluginOn; - - int mSashWidth; - int mTopMargin; - int mBottomMargin; - int mLeftMargin; - int mRightMargin; - - wxColour mDarkCol; - wxColour mLightCol; - wxColour mGrayCol; - wxColour mBorderCol; - -protected: - - bool mToDlg; - - // helpers - - void ExchgCheck( wxCheckBox* pChk, bool& value ); - void ExchgIntField( wxTextCtrl* pFld, int& value ); - void ExchgColourField( wxTextCtrl* pFld, wxColour& value ); - - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - -public: - - SettingsDlg( wxWindow* pParent ); - - void ReadLayoutSettings( wxFrameLayout& fl ); - void ApplyLayoutSettings( wxFrameLayout& fl ); - - void ExchangeFields( bool toDialog ); - - void OnApply( wxCommandEvent& event ); - void OnNotes( wxCommandEvent& event ); - - void OnHintAnimCheck( wxCommandEvent& event ); - void OnRTUpdatesCheck( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE(); -}; - -#endif \ No newline at end of file diff --git a/utils/framelayout/src/wxinfo.cpp b/utils/framelayout/src/wxinfo.cpp deleted file mode 100644 index 5f4d3ab8cd..0000000000 --- a/utils/framelayout/src/wxinfo.cpp +++ /dev/null @@ -1,159 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 23/11/98 -// RCS-ID: $Id$ -// Copyright: 1998 (c) Aleksandras Gluchovas -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "wxinifo.cpp" -#pragma interface "wxinifo.cpp" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "wx/hash.h" -#include "wxinfo.h" - -inline static void expand_item( wxTreeCtrl* pTree, wxTreeItemId& itemId ) -{ - pTree->Expand( itemId ); -} - -void wxCreateClassInfoTree( wxTreeCtrl* pTree, - wxTreeItemId parentBranchId, - long classImageNo - ) -{ - expand_item( pTree, parentBranchId ); - - wxHashTable hash; - - wxList lst; - - // collect all classes into list - - { - wxClassInfo* pCur = wxClassInfo::GetFirst(); - - wxClassInfo::InitializeClasses(); - - while( pCur ) - { - lst.Append( (wxObject*)pCur ); - - pCur = pCur->GetNext(); - } - } - - wxClassInfo::InitializeClasses(); - - // reflect class-hierarchy into the tree nodes - - int nHanged; - - do - { - nHanged = 0; - - wxNode* pCur = lst.First(); - - // repeat passes through class list, untill all of - // the class items are "hanged" onto their parent-items in the tree - - while( pCur ) - { - wxClassInfo& info = *((wxClassInfo*)pCur->Data()); - - if ( info.GetBaseClass1() == NULL ) - { - // parentless classes are put into the root branch - - wxTreeItemId* pId = new wxTreeItemId(); - *pId = pTree->AppendItem( parentBranchId, info.GetClassName(), classImageNo ); - - expand_item( pTree, *pId ); - - // "remember" it - hash.Put( long(&info), (wxObject*)pId ); - - // class is "hanged", remove it from the list - wxNode* pTmp = pCur; - - pCur = pCur->Next(); - - delete pTmp; - - ++nHanged; - } - else - { - wxTreeItemId* pParentId = (wxTreeItemId*)hash.Get( (long)info.GetBaseClass1() ); - - if ( pParentId != NULL ) - { - wxTreeItemId* pId = new wxTreeItemId(); - - *pId = pTree->AppendItem( *pParentId, info.GetClassName(), classImageNo ); - - expand_item( pTree, *pId ); - - hash.Put( long(&info), (wxObject*)pId ); - - wxNode* pTmp = pCur; - - pCur = pCur->Next(); - - // class is "hanged", remove it from the list - delete pTmp; - - ++nHanged; - } - else - { - // otherwise there's a parent, but it's not in the tree yet... - // hope to "hang" it in the subsequent passes - - pCur = pCur->Next(); - } - } - } - - } while( nHanged != 0 ); -} - -void wxCreateSerializerInfoTree( wxTreeCtrl* pTree, - wxTreeItemId parentBranchId, - long classImageNo - ) -{ - expand_item( pTree, parentBranchId ); - - wxSerializerInfo::InitializeSerializers(); - - // FOR NOW:: no hierarchy - one branch - - wxSerializerInfo* pCur = wxSerializerInfo::first; - - while( pCur ) - { - wxString fullName = pCur->className + wxString( "Serializer" ); - - pTree->AppendItem( parentBranchId, fullName, classImageNo ); - - pCur = pCur->next; - } -} diff --git a/utils/framelayout/src/wxinfo.h b/utils/framelayout/src/wxinfo.h deleted file mode 100644 index 9e9d135ab4..0000000000 --- a/utils/framelayout/src/wxinfo.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo -// Author: Aleksandras Gluchovas -// Modified by: -// Created: 23/11/98 -// RCS-ID: $Id$ -// Copyright: 1998 (c) Aleksandras Gluchovas -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WXINFO_G__ -#define __WXINFO_G__ - -#include "wx/object.h" -#include "wx/treectrl.h" - -#include "objstore.h" - -/* - * creates tree with hierarchically cauptured - * information about wxWindows dynamic classes (at "current run-time") - */ - -void wxCreateClassInfoTree( wxTreeCtrl* pTree, - wxTreeItemId parentBranchId, - long classImageNo = -1 - ); - -/* - * creates tree with information about - * serializer-classes (at current run-time) - * NOTE:: "objstore.cpp" should be compiled in - */ - -void wxCreateSerializerInfoTree( wxTreeCtrl* pTree, // existing tree control - wxTreeItemId parentBranchId, - long classImageNo = -1 // (-1) - text only - ); - -#endif