void _HYObjectInspector::NewObject (void) { _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); _HYTable* dl = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); switch (p1->GetSelection()) { case 0: { NewTreeWindow (-1); break; } case 2: { _SimpleList sel; dl->GetSelection (sel); _String* md = nil; if (sel.lLength==2) { md = (_String*)dl->GetCellData(0,sel.lData[0]/2); } NewModel(md); break; } default: return; } BuildListOfObjects (p1->GetSelection()); }
void _HYObjectInspector::Activate () { _HYPullDown * p1 = (_HYPullDown*)GetCellObject (0,2); _HYTable* oList = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _SimpleList saveSelection; oList->GetSelection (saveSelection); if ((objectInspectorRect.width>=0)&&firstTime) { Hide(); #ifdef __HYPHY_GTK__ UpdateComponentInfo (); #else dim = MinMaxWindowDimensions(); #endif SetWindowRectangle (0,0,dim.bottom,dim.right); } BuildListOfObjects (p1->GetSelection()); oList->SetSelection (saveSelection); if ((objectInspectorRect.width>=0)&&firstTime) { #ifdef __HYPHY_GTK__ UpdateComponentInfo (); #else dim = MinMaxWindowDimensions(); #endif SetWindowRectangle (0,0,objectInspectorRect.bottom-objectInspectorRect.top,objectInspectorRect.right-objectInspectorRect.left); SetPosition (objectInspectorRect.left,objectInspectorRect.top); objectInspectorRect = GetWindowRect (); Show(); } _HYTWindow::Activate (); firstTime = false; }
bool _HYModelWindow::_ProcessMenuSelection (long msel) { if (_HYTWindow::_ProcessMenuSelection(msel)) { return true; } switch (msel) { case HY_WINDOW_MENU_ID_FILE+1: // save menu case HY_WINDOW_MENU_ID_FILE+3: { // save as menu DoSave (msel-HY_WINDOW_MENU_ID_FILE-2); return true; } case HY_WINDOW_MENU_ID_FILE+2: { // print _HYTable* t = (_HYTable*)GetCellObject (MODEL_MATRIX_ROW,4); t->_PrintTable((_HYTable*)GetCellObject (MODEL_MATRIX_ROW-1,4)); return true; } case HY_WINDOW_MENU_ID_EDIT+1: { // copy DoCopyCell (); return true; } case HY_WINDOW_MENU_ID_EDIT+3: { // paste DoPasteToCells(); return true; } case HY_WINDOW_MENU_ID_EDIT+5: { // select all DoSelectAll(); return true; } case HY_MDL_WIN32_MENU_BASE: { // model menu DoEditModelName (); return true; } default: { // rate menu msel -= HY_MDL_WIN32_MENU_BASE+100; if (msel >=0 && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget_by_action(menu_items,HY_MDL_WIN32_MENU_BASE+100+msel)))) if (msel!=rateChoice) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget_by_action(menu_items,HY_MDL_WIN32_MENU_BASE+100+rateChoice)),false); rateChoice = msel; taint = true; } return true; } } return false; }
void _HYObjectInspector::UpdateButtonsAndInfo (void) { _HYTable* dl = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _HYButtonBar* b1 = (_HYButtonBar*)GetCellObject (0,0); _SimpleList sel; dl->GetSelection (sel); if (sel.lLength) { b1->EnableButton (0,true); b1->EnableButton (1,true); } else { b1->EnableButton (0,false); b1->EnableButton (1,false); } }
void _HYObjectInspector::OpenObject (void) { _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); switch (p1->GetSelection()) { case 0: { OpenTreeFile(); break; } case 1: { OpenDataFile(); break; } case 2: { OpenModelFile(); break; } default: return; } BuildListOfObjects (p1->GetSelection()); }
void _HYObjectInspector::SortObjectsByName (long location) { _HYTable* table = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _List menuItems; menuItems.AppendNewInstance(new _String ("Ascending")); menuItems.AppendNewInstance(new _String ("Descending")); long h = table->_HandlePullDown (menuItems,(location&0xffff0000)>>16,location&0x0000ffff,0), k; if (h>=0) { menuItems.Clear(); _SimpleList index; for (k=0; k<table->verticalSpaces.lLength; k++) { index<<k; menuItems << table->GetCellData (0,k); } bool hasPadding = ((_String*)menuItems(menuItems.lLength-1))->sLength==0; if (hasPadding) { menuItems.Delete (menuItems.lLength-1); index.Delete (index.lLength-1); } SortLists (&menuItems, &index); if (h==1) { index.Flip(); } if (hasPadding) { index<<index.lLength; } table->SetRowOrder (index); } }
bool _HYParameterTable::_ProcessMenuSelection (long msel) { _HYTable* table = (_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW,0); bool res = false; switch (msel) { case HY_WINDOW_MENU_ID_FILE+1: // save { DoSave (); res = true; break; } case HY_WINDOW_MENU_ID_FILE+2: // print { _SimpleList columns, sel; columns << 0; columns << 1; columns << 2; columns << 3; table->GetSelection (sel); char resp = 3; if (sel.lLength) { _String pr ("Would you like to print only the selected cells? (Click \"No\" to print the entire table)."); resp = YesNoCancelPrompt (pr); } if (resp == 3) table->_PrintTable(columns,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0)); else if (resp == 1) { _SimpleList rows; for (long k = 0; k < sel.lLength; k+=4) rows << sel.lData[k]/4; table->_PrintTable(columns,rows,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0)); } res = true; break; } case HY_WINDOW_MENU_ID_EDIT: // undo { UndoCommand(); _UpdateUndoMenu (nil,nil); res = true; break; } case HY_WINDOW_MENU_ID_EDIT+5: // undo { SelectAll(); res = true; break; } case HY_PT_WIN32_MENU_BASE+10: case HY_PT_WIN32_MENU_BASE+11: case HY_PT_WIN32_MENU_BASE+12: case HY_PT_WIN32_MENU_BASE+13: { res = true; char toggleFlag; GtkWidget * checkMI = gtk_item_factory_get_widget_by_action(menu_items,msel); msel -= HY_PT_WIN32_MENU_BASE+10; switch (msel) { case 0: toggleFlag = HY_PARAMETER_TABLE_VIEW_LOCAL; break; case 1: toggleFlag = HY_PARAMETER_TABLE_VIEW_GLOBAL; break; case 2: toggleFlag = HY_PARAMETER_TABLE_VIEW_CONSTRAINED; break; case 3: toggleFlag = HY_PARAMETER_TABLE_VIEW_CATEGORY; break; } if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(checkMI)) != (bool)viewOptions&toggleFlag) { if (viewOptions&toggleFlag) { if (viewOptions-toggleFlag) viewOptions-=toggleFlag; else break; } else viewOptions+=toggleFlag; gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(checkMI), viewOptions&toggleFlag); ConstructTheTable(); SetWindowRectangle (top,left,bottom,right); } break; } case HY_PT_WIN32_MENU_BASE+1: OptimizeLikelihoodFunction(); res = true; break; case HY_PT_WIN32_MENU_BASE+2: DoEnterConstraint (); res = true; break; case HY_PT_WIN32_MENU_BASE+3: DoCleanUp (); res = true; break; case HY_PT_WIN32_MENU_BASE+4: HandleVarianceEstimates (); res = true; break; case HY_PT_WIN32_MENU_BASE+5: HandleProfilePlot (); res = true; break; case HY_PT_WIN32_MENU_BASE+6: HandleCategories (); res = true; break; case HY_PT_WIN32_MENU_BASE+7: HandleSelectParameters (); res = true; break; case HY_PT_WIN32_MENU_BASE+8: HandleOpenInChart (); res = true; break; } if (!res) res = _HYTWindow::_ProcessMenuSelection(msel); return res; }
void _HYObjectInspector::KillObject (void) { _HYTable* dl = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _HYButtonBar* b1 = (_HYButtonBar*)GetCellObject (0,0); _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); _SimpleList sel; dl->GetSelection (sel); if (sel.lLength) { b1->EnableButton (0,true); long f; switch (p1->GetSelection()) { case 0: { for (f = 0; f<sel.lLength; f+=2) { long treeID = LocateVarByName (*(_String*)dl->GetCellData (0,sel.lData[f]/2)); if (treeID>=0) #ifndef USE_AVL_NAMES treeID = variableReindex.lData[treeID]; #else treeID = variableNames.GetXtra(treeID); #endif if (dl->cellTypes.lData[sel.lData[f]] & HY_TABLE_BOLD) { _String prompt ("Tree "); prompt = prompt & *LocateVar (treeID)->GetName() & objectInspectorKillPrompt; if (warnTree||(!ProceedPromptWithCheck (prompt,donotWarnAgain,warnTree))) { continue; } } postTreeKillEvent (GetID(), treeID); } break; } case 1: { for (f = 0; f<sel.lLength; f+=2) { long dsID = dataSetNamesList.Find ((_String*)dl->GetCellData (0,sel.lData[f]/2)); if (dsID>=0) { if (dl->cellTypes.lData[sel.lData[f]] & HY_TABLE_BOLD) { _String prompt ("Dataset "); prompt = prompt & *(_String*)dataSetNamesList(dsID) & objectInspectorKillPrompt; if (!((!warnTree)&&ProceedPromptWithCheck (prompt,donotWarnAgain,warnDS))) { continue; } } postDSKillEvent (GetID(), dsID); } } break; } case 2: { for (f = 0; f<sel.lLength; f+=2) { if (sel.lData[f]/2<modelTemplates.lLength) { _List* modelT = FindModelTemplate((_String*)dl->GetCellData (0,sel.lData[f]/2)); if (modelT) { // template model _String*fileLocation = (_String*)(*modelT)(2), errMsg (*(_String*)dl->GetCellData (0,sel.lData[f]/2)); if (dl->cellTypes.lData[sel.lData[f]] & HY_TABLE_ITALIC) { errMsg = errMsg & " is a template model. If you wish to delete it, please do so by removing the appropriate file from the \"Substitution Models\" directory."; ProblemReport (errMsg); } else { errMsg = errMsg & " is about to be deleted. This action is NOT undoable."; if (ProceedPrompt (errMsg,(Ptr)this)) { if (remove (fileLocation->sData)) { errMsg = "File delete operation failed."; ProblemReport (errMsg); } else { errMsg = *(_String*)dl->GetCellData (0,sel.lData[f]/2); for (long k=0; k<modelTemplates.lLength; k++) { _List* thisList = (_List*)modelTemplates(k); if (errMsg.Equal((_String*)(*thisList)(0))) { modelTemplates.Delete (k); } } BuildListOfObjects (2); } } } } } } break; } } } }
void _HYObjectInspector::OpenObjectWindow (void) { _HYTable* dl = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _HYButtonBar* b1 = (_HYButtonBar*)GetCellObject (0,0); _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); _SimpleList sel; dl->GetSelection (sel); if (sel.lLength) { b1->EnableButton (0,true); for (long k = 0; k<sel.lLength; k+=2) { _String windowTitle (*(_String*)dl->GetCellData (0,sel.lData[k]/2)); long f; switch (p1->GetSelection()) { case 0: { _String winTitle (windowTitle); windowTitle = _String ("Tree ")&windowTitle; f = FindWindowByName (windowTitle); if (f<0) { _HYTreePanel* newTreePanel = new _HYTreePanel (winTitle,winTitle); newTreePanel->_Zoom(true); newTreePanel->BringToFront(); //newTreePanel->Show(); } else { _HYPlatformWindow* thisWindow = (_HYPlatformWindow*)windowObjects(f); thisWindow->_Activate(); } break; } case 1: { _String winTitle (windowTitle); windowTitle = _String ("DataSet ")&windowTitle; f = FindWindowByName (windowTitle); if (f<0) { _HYDataPanel* newDataPanel = new _HYDataPanel (winTitle,winTitle); newDataPanel->BringToFront(); } else { _HYPlatformWindow* thisWindow = (_HYPlatformWindow*)windowObjects(f); thisWindow->_Activate(); } break; } case 2: { _String winTitle (windowTitle); windowTitle = _String ("Model ")&windowTitle; f = FindWindowByName (windowTitle); if (f<0) { if (dl->cellTypes.lData[sel.lData[k]] & HY_TABLE_ITALIC) { if (!warnModelOpen) { windowTitle = _String ("Model \"") & winTitle & "\" is a template model, and it can't be opened. You can open a new model based on it, though."; if (!warnModelOpen) { if (!ProceedPromptWithCheck (windowTitle, donotWarnAgain, warnModelOpen)) { break; } } NewObject (); break; } } else { if (sel.lData[k]/2<modelTemplates.lLength) { _List* modelSpec = FindModelTemplate (&winTitle); if (modelSpec) { OpenModelFromFile(*(_String*)(*modelSpec)(2)); } } else { OpenModelFromMatrix (winTitle); } } } else { _HYWindow* thisWindow = (_HYWindow*)windowObjectRefs(f); thisWindow->BringToFront(); } break; } case 3: { _String winTitle (windowTitle); windowTitle = _String ("Likelihood Function ")&windowTitle; f = FindWindowByName (windowTitle); if (f<0) { f = likeFuncNamesList.Find(&winTitle); if (f>=0) { _HYParameterTable* newParameterTable = new _HYParameterTable (windowTitle,f); newParameterTable->_Zoom(true); newParameterTable->BringToFront(); } } else { _HYPlatformWindow* thisWindow = (_HYPlatformWindow*)windowObjects(f); thisWindow->_Activate(); } break; } } } } }
void _HYObjectInspector::BuildListOfObjects (long index) { _HYTable* oList = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW,0); _HYTable* oHead = (_HYTable*)GetCellObject (HY_OBJECT_INSPECTOR_TABLE_ROW-1,0); _HYButtonBar* b1 = (_HYButtonBar*)GetCellObject (0,0); _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); long k, rowCount = 0; oList->ClearTable(); _String newStat; switch (index) { case 0: { // trees for (k=0; k<variablePtrs.lLength; k++) { _Variable * thisVar = LocateVar(k); if (thisVar&&(thisVar->ObjectClass()==TREE)) { oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); _SimpleList deps; TreeDependencies (deps,thisVar->GetAVariable()); if (deps.lLength) { oList->SetCellData (thisVar->GetName(),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_BOLD,true); } else { oList->SetCellData (thisVar->GetName(),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true); } _TheTree * thisTree = (_TheTree*)thisVar; _PMathObj tc = thisTree->TipCount(); newStat = _String ((long)tc->Value()) & " leaves "; DeleteObject (tc); tc = thisTree->BranchCount(); newStat = newStat& ", " & _String ((long)tc->Value()+1) & " internal nodes."; DeleteObject (tc); oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true); rowCount++; } } b1->EnableButton (2,true); b1->EnableButton (3,true); break; } case 1: { // data sets for (k=0; k<dataSetNamesList.lLength; k++) { _String* thisDS = (_String*)dataSetNamesList(k); if (thisDS->sLength) { oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); _SimpleList deps; DSDependencies (deps,k); if (deps.lLength) { oList->SetCellData (thisDS,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_BOLD,true); } else { oList->SetCellData (thisDS,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true); } _DataSet* theDS = (_DataSet*)dataSetList(dataSetNamesList.Find(thisDS)); if (theDS->GetTT()->IsStandardNucleotide()) { newStat = "Nucleotide data"; } else if (theDS->GetTT()->IsStandardAA()) { newStat = "Aminoacid data"; } else if (theDS->GetTT()->IsStandardBinary()) { newStat = "Binary data"; } else { newStat = "Custom data"; } newStat = newStat & ". "& _String (theDS->NoOfColumns()) &" sites ("&_String (theDS->NoOfUniqueColumns())&" distinct patterns), "&_String(theDS->NoOfSpecies())& " species."; oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true); rowCount++; } } b1->EnableButton (2,true); b1->EnableButton (3,false); break; } case 2: { // Models for (k=0; k<modelTemplates.lLength; k++) { _List * thisModel = (_List*) modelTemplates(k); _SimpleList * modelParameters = (_SimpleList*) (*thisModel)(1); oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); if (modelParameters->lData[0] & HY_DATAPANEL_MODEL_MODELS) { oList->SetCellData ((*thisModel)(0),rowCount,0,HY_TABLE_STATIC_TEXT,true); } else { oList->SetCellData ((*thisModel)(0),rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC,true); } if (modelParameters->lData[1]==4) { newStat = "Nucleotide model"; } else if (modelParameters->lData[1]==16) { newStat = "Dinucleotide Model"; } else if (modelParameters->lData[1]==20) { newStat = "Aminoacid Model"; } else { newStat = "Codon Model"; } newStat = newStat & "."; oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true); rowCount++; } for (k=0; k<modelNames.lLength; k++) { _String * modelID = (_String*)modelNames(k); if (modelID->sLength) { oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); _SimpleList deps; ModelDependencies (deps,k); if (deps.lLength) { oList->SetCellData (modelID,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_BOLD,true); } else { oList->SetCellData (modelID,rowCount,0,HY_TABLE_STATIC_TEXT,true); } _Matrix * modelMatrix = (_Matrix*)LocateVar (modelMatrixIndices.lData[k])->GetValue(); long mDim = modelMatrix->GetHDim(); if (mDim==4) { newStat = "Nucleotide model"; } else if (mDim==16) { newStat = "Dinucleotide Model"; } else if (mDim==20) { newStat = "Aminoacid Model"; } else { newStat = "Codon Model"; } newStat = newStat & "."; oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true); rowCount++; } } b1->EnableButton (2,true); b1->EnableButton (3,true); break; } case 3: { // likelihood functions for (k=0; k<likeFuncNamesList.lLength; k++) { _String *lfName = (_String*)likeFuncNamesList (k); if (lfName->sLength) { oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); oList->SetCellData (lfName,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_BOLD,true); _LikelihoodFunction *lf = (_LikelihoodFunction*)likeFuncList (k); newStat = _String ("Likelihood Function on ") & (long)lf->GetTheTrees().lLength & " partitions/trees."; oList->SetCellData (&newStat,rowCount,1,HY_TABLE_STATIC_TEXT,true); rowCount++; } } b1->EnableButton (2,true); b1->EnableButton (3,false); break; } } if (rowCount==0) { newStat = _String("No ")& *p1->GetMenuItem(index) &" found."; oList->AddRow (-1,20,HY_TABLE_STATIC_TEXT); oList->SetCellData (&newStat,rowCount,0,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_CANTSELECT,true); oList->SetCellData (&empty,rowCount,1,HY_TABLE_STATIC_TEXT|HY_TABLE_ITALIC|HY_TABLE_CANTSELECT,true); rowCount ++; } else if (rowCount>1) { newStat = _String (rowCount) & ' ' & *p1->GetMenuItem(index) &" found."; } else { newStat = _String("One ") & p1->GetMenuItem(index)->Cut(0,p1->GetMenuItem(index)->sLength-2) & " found."; } if (rowCount<5) { oList->AddRow (-1,(5-rowCount)*20,HY_TABLE_STATIC_TEXT|HY_TABLE_CANTSELECT); } SetStatusBar (newStat); oList -> AutoFitWidth (*oHead); rowCount = oHead->GetMaxW(); if (rowCount<oHead->rel.right-oHead->rel.left) { oList->SetColumnSpacing (1,-rowCount+oHead->rel.right-oHead->rel.left+1,false); oHead->SetColumnSpacing (1,-rowCount+oHead->rel.right-oHead->rel.left+1,false); } rowCount = oList->GetMaxH(); if (rowCount<=oList->rel.bottom-oList->rel.top) { oList->SetRowSpacing (oList->verticalSpaces.lLength-1,oList->rel.bottom-oList->rel.top+1-rowCount,false); } oList->SetVisibleSize(oList->rel); oHead->SetVisibleSize(oHead->rel); oList->_MarkForUpdate (); oHead->_MarkForUpdate (); #ifdef __HYPHY_GTK__ UpdateComponentInfo (); #else dim = MinMaxWindowDimensions(); #endif }
bool _HYObjectInspector::ProcessGEvent (_HYEvent* e) { _String firstArg; long k,f; bool done = false; lastKillID++; _HYPullDown* p1 = (_HYPullDown*)GetCellObject (0,2); if (e->EventClass()==_hyGlobalTreeKillEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); if (MatchID(k)) { k = e->EventCode().Cut (f+1,-1).toNum(); _Variable* theV = LocateVar(k); if (theV->ObjectClass()==TREE) { _SimpleList lfIDs; TreeDependencies (lfIDs, theV->GetAVariable()); for (k=0; k<lfIDs.lLength; k++) { postLFKillEvent (GetID(), lfIDs.lData[k]); } if (lfIDs.lLength == 0) { DeleteVariable (*theV->GetName(),true); } else if (lastKillID<=2) { postTreeKillEvent (GetID(), theV->GetAVariable()); } BuildListOfObjects (p1->GetSelection()); } } done = true; } else if (e->EventClass()==_hyGlobalLFKillEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); if (MatchID(k)) { k = e->EventCode().Cut (f+1,-1).toNum(); KillLFRecord (k); } done = true; } else if (e->EventClass()==_hyGlobalDSKillEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); if (MatchID(k)) { k = e->EventCode().Cut (f+1,-1).toNum(); _SimpleList lfIDs; DSDependencies (lfIDs, k); for (f=0; f<lfIDs.lLength; f++) { postLFKillEvent (GetID(), lfIDs.lData[f]); } if (lfIDs.lLength == 0) { KillDataSetRecord (k); } else if (lastKillID<=2) { postDSKillEvent (GetID(), k); } BuildListOfObjects (p1->GetSelection()); done = true; } } lastKillID --; if (!done) { return _HYWindow::ProcessGEvent (e); } return true; }
bool _HYObjectInspector::ProcessEvent (_HYEvent* e) { _String firstArg; long k,i,f; bool done = false; if (e->EventClass()==_hyMenuSelChangeEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); for (i=0; i<components.lLength; i++) { if (((_HYGuiObject*)components(i))->MatchID(k)) { break; } } firstArg = e->EventCode().Cut (f+1,-1); k = firstArg.toNum(); BuildListOfObjects (k); done = true; } else { if (e->EventClass()==_hyTableChangeSelEvent) { k = e->EventCode().toNum(); for (i=0; i<components.lLength; i++) if (((_HYGuiObject*)components(i))->MatchID(k)) { break; } if (i==1) { UpdateButtonsAndInfo (); } done = true; } else { if (e->EventClass()==_hyButtonPushEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); for (i=0; i<components.lLength; i++) if (((_HYGuiObject*)components(i))->MatchID(k)) { break; } firstArg = e->EventCode().Cut (f+1,-1); k = firstArg.toNum(); if (i==4) { // button bar _HYButtonBar* bb = (_HYButtonBar*)GetCellObject (0,0); switch (k) { case 0: OpenObjectWindow(); break; case 1: KillObject (); break; case 2: OpenObject (); break; case 3: NewObject (); break; } bb->_UnpushButton(); UpdateButtonsAndInfo(); } done = true; } else { if (e->EventClass()==_hyTableDblClickEvent) { k = e->EventCode().toNum(); for (i=0; i<components.lLength; i++) if (((_HYGuiObject*)components(i))->MatchID(k)) { break; } if (i==1) { OpenObjectWindow(); } done = true; } else if (e->EventClass()==_hyTablePullDownEvent) { firstArg = e->EventCode().Cut (0,(f=e->EventCode().Find(','))-1); k = firstArg.toNum(); for (i=0; i<components.lLength; i++) { if (((_HYGuiObject*)components(i))->MatchID(k)) { break; } } k = e->EventCode().Find(',',f+1,-1); firstArg = e->EventCode().Cut (k+1,-1); if (i==2) { SortObjectsByName (firstArg.toNum()); } done = true; } } } } if (done) { DeleteObject (e); return true; } return _HYTWindow::ProcessEvent(e); }
//__________________________________________________________ _HYObjectInspector::~_HYObjectInspector() { objectInspectorObjClass = ((_HYPullDown*)GetCellObject (0,2))->GetSelection(); }