#include <gridtool.h>
Inheritance diagram for GridInfoBarOp:
Public Member Functions | |
GridInfoBarOp () | |
MsgResult | Message (Msg *Msg) |
Grid info bar dialog message handler. | |
void | InitControls () |
Inits all the controls in the info bar. Called immediately after the bar is created when the grid tool becomes the current tool. | |
void | EnableControls () |
Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc. | |
void | DisplayDefaultGridInfo () |
Set the controls on the info bar to reflect the default grid tool values. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN. | |
void | DisplayGridInfo (double Divisions, UnitType Units, UINT32 Subdivisions, GridType GType) |
Set the GridTool's controls on the info bar. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN. | |
void | DisplayGridInfo (NodeGrid *pGrid) |
Set the GridTool's controls on the info bar. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN. | |
NodeGrid * | GetLastGridDisplayed () |
Private Attributes | |
NodeGrid * | LastGridDisplayed |
Definition at line 603 of file gridtool.h.
|
Definition at line 607 of file gridtool.h.
|
|
Set the controls on the info bar to reflect the default grid tool values. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN.
Definition at line 3183 of file gridtool.cpp. 03184 { 03185 DisplayGridInfo( NodeGrid::GetDefaultDivisions(), 03186 NodeGrid::GetDefaultUnits(), 03187 NodeGrid::GetDefaultSubdivisions(), 03188 NodeGrid::GetDefaultGridType()); 03189 03190 LastGridDisplayed = NULL; 03191 }
|
|
Set the GridTool's controls on the info bar. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN.
Definition at line 3207 of file gridtool.cpp. 03208 { 03209 //if (!GridTool::IsCurrentTool()) return; 03210 if (Tool::GetCurrentID() != TOOLID_GRID) return; 03211 03212 DisplayGridInfo( pGrid->GetDivisions(), 03213 pGrid->GetUnits(), 03214 pGrid->GetSubdivisions(), 03215 pGrid->GetGridType()); 03216 03217 LastGridDisplayed = pGrid; 03218 03219 //SetDimensionGadgetValue(_R(IDC_DIVISIONS),(MILLIPOINT)pGrid->GetMainStep(),pGrid); 03220 }
|
|
Set the GridTool's controls on the info bar. Moved from GridTool to GridInfoBarOp on 28/4/94 by MarkN.
Definition at line 3239 of file gridtool.cpp. 03240 { 03241 //if (!GridTool::IsCurrentTool()) return; 03242 if (Tool::GetCurrentID() != TOOLID_GRID) return; 03243 03244 INT32 i; 03245 03246 if (Units != NOTYPE) 03247 { 03248 DocUnitList* pDocUnitList = DocUnitList::GetCurrentDocUnitList(); 03249 SetSelectedValueIndex(_R(IDC_UNITS),pDocUnitList->FindUnitIndex(Units)); 03250 } 03251 03252 /* if (pDocUnitList != NULL) 03253 { 03254 String_32 Str = pDocUnitList->GetToken(Units); 03255 TCHAR* p = Str; 03256 String_256 Str256 = p; 03257 SetStringGadgetValue(_R(IDC_UNITS),&Str256,FALSE,-1); 03258 } 03259 */ 03260 for (i=0;i<NUM_GRID_TYPES;i++) 03261 if (GridTypeList[i].Type == GType) 03262 SetSelectedValueIndex(_R(IDC_GRIDTYPE),i); 03263 03264 String_16 StringVal; 03265 TCHAR CharString[20]; 03266 03267 camSprintf(CharString, _T("%.2g"), (double) Divisions); 03268 StringVal = CharString; 03269 SetStringGadgetValue(_R(IDC_DIVISIONS), &StringVal, FALSE, -1); 03270 03271 camSprintf(CharString, _T("%ld"), (INT32) Subdivisions); 03272 StringVal = CharString; 03273 SetStringGadgetValue(_R(IDC_SUBDIVISIONS), &StringVal, FALSE,-1); 03274 }
|
|
Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc.
Definition at line 3155 of file gridtool.cpp. 03156 { 03157 //if (!GridTool::IsCurrentTool()) return; 03158 if (Tool::GetCurrentID() != TOOLID_GRID) return; 03159 03160 Spread* pSpread = GridTool::GetSpreadClicked(); 03161 BOOL enable = ((NodeGrid::GetNumSelectedGrids() > 0) && (pSpread != NULL)); 03162 03163 EnableGadget(_R(IDC_DIVISIONS), enable); 03164 EnableGadget(_R(IDC_SUBDIVISIONS), enable); 03165 EnableGadget(_R(IDC_UNITS), enable); 03166 EnableGadget(_R(IDC_GRIDTYPE), enable); 03167 03168 EnableGadget(_R(IDC_MAKEGRID),pSpread != NULL); 03169 }
|
|
Definition at line 619 of file gridtool.h. 00619 { return LastGridDisplayed; }
|
|
Inits all the controls in the info bar. Called immediately after the bar is created when the grid tool becomes the current tool.
Definition at line 3102 of file gridtool.cpp. 03103 { 03104 //if (!GridTool::IsCurrentTool()) return; 03105 if (Tool::GetCurrentID() != TOOLID_GRID) return; 03106 if (GridTool::GetDoc() == NULL) return; 03107 03108 INT32 i; 03109 03110 DeleteAllValues(_R(IDC_UNITS)); 03111 DeleteAllValues(_R(IDC_GRIDTYPE)); 03112 03113 DocUnitList* pDocUnitList = GridTool::GetDoc()->GetDocUnitList(); 03114 03115 for (i=0; i < pDocUnitList->GetNumUnits(); i++) 03116 { 03117 Unit* pUnit = pDocUnitList->FindUnit(i); 03118 String_32 Str = pUnit->GetToken(); 03119 TCHAR* p = Str; 03120 String_256 Str256 = p; 03121 SetStringGadgetValue(_R(IDC_UNITS),&Str256,FALSE,i); 03122 } 03123 03124 for (i=0; i<NUM_GRID_TYPES; i++) 03125 { 03126 String_32 Str = String_32(GridTypeList[i].IDS); 03127 SetStringGadgetValue(_R(IDC_GRIDTYPE),&Str,FALSE,i); 03128 } 03129 03130 INT32 l=1; 03131 for (i=0; i<10; i++,l++) 03132 { 03133 SetLongGadgetValue(_R(IDC_DIVISIONS), l,FALSE,i); 03134 SetLongGadgetValue(_R(IDC_SUBDIVISIONS),l,FALSE,i); 03135 } 03136 03137 EnableControls(); 03138 }
|
|
Grid info bar dialog message handler.
Reimplemented from InformationBarOp. Definition at line 2817 of file gridtool.cpp. 02818 { 02819 // if (IsUserName("MarkN")) TRACE( _T("GridInfoBarOp::Message()\n")); 02820 02821 if (IS_OUR_DIALOG_MSG(Message)) 02822 { 02823 DialogMsg* Msg = (DialogMsg*)Message; 02824 02825 // Check if the message is a CANCEL 02826 if (Msg->DlgMsg == DIM_CANCEL) 02827 { 02828 Close(); // Close the dialog 02829 } 02830 else if (Msg->DlgMsg == DIM_CREATE) 02831 { 02832 // Initialise the controls 02833 InitControls(); 02834 DisplayDefaultGridInfo(); 02835 } 02836 else 02837 { 02838 ChangeGrid* pChangeGrid = NULL; 02839 02840 //if (IsUserName("MarkN")) TRACE( _T("Msg->GadgetID = %ld\n"),Msg->GadgetID); 02841 02842 switch (Msg->GadgetID) 02843 { 02844 case _R(IDC_UNITS): 02845 { 02846 switch (Msg->DlgMsg) 02847 { 02848 case DIM_SELECTION_CHANGED : 02849 { 02850 WORD Index; 02851 GetValueIndex(_R(IDC_UNITS),&Index); 02852 DocUnitList* pDocUnitList = DocUnitList::GetCurrentDocUnitList(); 02853 if ((Index >= 0) && (Index < pDocUnitList->GetNumUnits())) 02854 { 02855 DocUnitList* pDocUnitList = DocUnitList::GetCurrentDocUnitList(); 02856 Unit* pUnit = pDocUnitList->FindUnit(Index); 02857 NodeGrid::SetDefaultUnits(pUnit->GetUnitType()); 02858 pChangeGrid = new ChangeGridUnits; 02859 } 02860 } 02861 break; 02862 } 02863 } 02864 break; 02865 02866 case _R(IDC_GRIDTYPE): 02867 { 02868 switch (Msg->DlgMsg) 02869 { 02870 case DIM_SELECTION_CHANGED: 02871 { 02872 WORD Index; 02873 GetValueIndex(_R(IDC_GRIDTYPE),&Index); 02874 if ((Index >= 0) && (Index <= NUM_GRID_TYPES)) 02875 { 02876 NodeGrid::SetDefaultGridType(GridTypeList[Index].Type); 02877 pChangeGrid = new ChangeGridType; 02878 } 02879 } 02880 break; 02881 } 02882 } 02883 break; 02884 02885 case _R(IDC_DIVISIONS): 02886 { 02887 //if (IsUserName("MarkN")) TRACE( _T("_R(IDC_DIVISIONS) - Msg->DlgMsg = %ld\n"),Msg->DlgMsg); 02888 switch (Msg->DlgMsg) 02889 { 02890 case DIM_SELECTION_CHANGED: 02891 { 02892 WORD Index; 02893 GetValueIndex(_R(IDC_DIVISIONS),&Index); 02894 //if (IsUserName("MarkN")) TRACE( _T("Divisions Index = %ld\n"),Index); 02895 02896 BOOL Valid=TRUE; 02897 double Div; 02898 02899 if (Index < 0) 02900 { 02901 String_32 StrVal = GetStringGadgetValue(_R(IDC_DIVISIONS),&Valid); 02902 camSscanf((TCHAR*)StrVal,"%NLf",&Div); 02903 } 02904 else 02905 Div = Index+1; 02906 02907 if (Valid) 02908 { 02909 NodeGrid::SetDefaultDivisions(Div); 02910 pChangeGrid = new ChangeGridDivisions; 02911 } 02912 } 02913 break; 02914 } 02915 } 02916 break; 02917 02918 case _R(IDC_SUBDIVISIONS): 02919 { 02920 //if (IsUserName("MarkN")) TRACE( _T("_R(IDC_SUBDIVISIONS) - Msg->DlgMsg = %ld\n"),Msg->DlgMsg); 02921 switch (Msg->DlgMsg) 02922 { 02923 case DIM_SELECTION_CHANGED: 02924 { 02925 WORD Index; 02926 GetValueIndex(_R(IDC_SUBDIVISIONS),&Index); 02927 //if (IsUserName("MarkN")) TRACE( _T("Divisions Index = %ld\n"),Index); 02928 02929 BOOL Valid=TRUE; 02930 UINT32 Subdiv; 02931 02932 if (Index < 0) 02933 { 02934 String_32 StrVal = GetStringGadgetValue(_R(IDC_SUBDIVISIONS),&Valid); 02935 camSscanf((TCHAR*)StrVal,"%ld",&Subdiv); 02936 } 02937 else 02938 Subdiv = Index+1; 02939 02940 if (Valid) 02941 { 02942 NodeGrid::SetDefaultSubdivisions(Subdiv); 02943 pChangeGrid = new ChangeGridSubdivisions; 02944 } 02945 } 02946 break; 02947 } 02948 } 02949 break; 02950 02951 case _R(IDC_MAKEGRID) : 02952 { 02953 //if (IsUserName("MarkN")) TRACE( _T("_R(IDC_MAKEGRID) - Msg->DlgMsg = %ld\n"),Msg->DlgMsg); 02954 switch (Msg->DlgMsg) 02955 { 02956 case DIM_LFT_BN_CLICKED: 02957 { 02958 GridTool::ToggleDefaultGrid(); 02959 // Make sure the controls are shaded correctly 02960 EnableControls(); 02961 } 02962 break; 02963 } 02964 } 02965 break; 02966 } 02967 02968 if (pChangeGrid != NULL) 02969 { 02970 OpGridChange* pOpGridChange = new OpGridChange; 02971 if (pOpGridChange != NULL) 02972 pOpGridChange->DoChangeSelectedGrids(pChangeGrid); 02973 } 02974 } 02975 } 02976 else if (MESSAGE_IS_A(Message,OpMsg)) // Check for undo/redo 02977 { 02978 OpMsg* pOpMsg = (OpMsg*)Message; 02979 02980 if (pOpMsg->MsgType == OpMsg::AFTER_UNDO || pOpMsg->MsgType == OpMsg::AFTER_REDO) 02981 { 02982 if (pOpMsg->pOp != NULL) 02983 { 02984 NodeGrid* pNodeGrid = NULL; 02985 02986 if (pOpMsg->pOp->IsKindOf(CC_RUNTIME_CLASS(OpGrid))) 02987 { 02988 NodeGrid::RecalcNumSelectedGrids(GridTool::GetSpreadClicked()); 02989 02990 GridInfoBarOp* pGridInfoBarOp = GridTool::GetGridInfoBarOp(); 02991 if (pGridInfoBarOp != NULL) 02992 pGridInfoBarOp->EnableControls(); 02993 02994 OpGrid* pOpGrid = (OpGrid*)(pOpMsg->pOp); 02995 02996 if (pOpMsg->MsgType == OpMsg::AFTER_UNDO) 02997 pNodeGrid = pOpGrid->GetPreOpDisplayedGrid(); 02998 02999 if (pOpMsg->MsgType == OpMsg::AFTER_REDO) 03000 pNodeGrid = pOpGrid->GetPostOpDisplayedGrid(); 03001 03002 if (pNodeGrid != NULL) 03003 DisplayGridInfo(pNodeGrid); 03004 } 03005 } 03006 } 03007 } 03008 else if (MESSAGE_IS_A(Message,UnitMsg)) // Check for changes in the units system 03009 { 03010 UnitMsg* pUnitMsg = (UnitMsg*)Message; 03011 BOOL UpdateInfoBar = FALSE; 03012 Unit* pThisUnit = NULL; 03013 03014 switch (pUnitMsg->MsgType) 03015 { 03016 case UnitMsg::BEFOREDELETE: 03017 case UnitMsg::NEW: 03018 case UnitMsg::CHANGED: 03019 pThisUnit = pUnitMsg->pDocUnitList->FindUnit(pUnitMsg->ThisUnitType); 03020 break; 03021 } 03022 03023 switch (pUnitMsg->MsgType) 03024 { 03025 case UnitMsg::BEFOREDELETE: 03026 if (NodeGrid::GetDefaultUnits() == pUnitMsg->ThisUnitType) 03027 NodeGrid::SetDefaultUnits(pThisUnit->GetBaseUnitType()); 03028 break; 03029 03030 case UnitMsg::NEW: 03031 case UnitMsg::CHANGED: 03032 case UnitMsg::AFTERDELETE: 03033 UpdateInfoBar = TRUE; 03034 break; 03035 } 03036 03037 if (UpdateInfoBar) 03038 { 03039 InitControls(); 03040 if (LastGridDisplayed == NULL) 03041 DisplayDefaultGridInfo(); 03042 else 03043 DisplayGridInfo(LastGridDisplayed); 03044 } 03045 03046 ProcessGridUnitMsg* pGridProc = new ProcessGridUnitMsg(pUnitMsg); 03047 if (pGridProc != NULL) 03048 { 03049 NodeGrid::ProcessAllGrids(pGridProc); 03050 delete pGridProc; 03051 } 03052 } 03053 else if (MESSAGE_IS_A(Message,DocChangingMsg)) // Check for changes in the units system 03054 { 03055 /* 03056 DocChangingMsg* pDocChangingMsg = (DocChangingMsg*)Message; 03057 Document* pDoc = pDocChangingMsg->pChangingDoc; 03058 03059 switch (pDocChangingMsg->State) 03060 { 03061 case DocChangingMsg::DocState::SELECTED: 03062 GridTool::SetDoc(pDoc); 03063 break; 03064 03065 case DocChangingMsg::DocState::UNSELECTED: 03066 case DocChangingMsg::DocState::KILLED: 03067 if (GridTool::GetDoc() == pDoc) 03068 GridTool::SetDoc(NULL); 03069 break; 03070 } 03071 */ 03072 DocChangingMsg* pDocChangingMsg = (DocChangingMsg*)Message; 03073 03074 switch (pDocChangingMsg->State) 03075 { 03076 case DocChangingMsg::DocState::SELCHANGED: 03077 GridTool::SetDoc(pDocChangingMsg->pNewDoc); 03078 break; 03079 } 03080 } 03081 03082 // Pass the message on 03083 return (InformationBarOp::Message(Message)); 03084 }
|
|
Definition at line 622 of file gridtool.h. |