void CBCommandTable::HandleOptionsMenu ( const JIndex index ) { JPoint cell; const JBoolean ok = (GetTableSelection()).GetFirstSelectedCell(&cell); assert( ok ); CBCommandManager::CmdInfo info = itsCmdList->GetElement(cell.y); if (index == kIsMakeCmd) { info.isMake = !info.isMake; if (info.isMake) { info.saveAll = kJTrue; info.useWindow = kJTrue; } } else if (index == kIsCVSCmd) { info.isVCS = !info.isVCS; if (info.isVCS) { info.saveAll = kJTrue; } } else if (index == kSaveAllCmd) { info.saveAll = !info.saveAll; } else if (index == kOneAtATimeCmd) { info.oneAtATime = !info.oneAtATime; } else if (index == kUseWindowCmd) { info.useWindow = !info.useWindow; if (!info.useWindow) { info.raiseWindowWhenStart = kJFalse; } } else if (index == kRaisedWhenStartCmd) { info.raiseWindowWhenStart = !info.raiseWindowWhenStart; } else if (index == kBeepWhenFinishedCmd) { info.beepWhenFinished = !info.beepWhenFinished; } else if (index == kShowSeparatorCmd) { info.separator = !info.separator; } TableRefreshRow(cell.y); itsCmdList->SetElement(cell.y, info); }
void JXFSBindingTable::RemovePattern() { JPoint cell; if ((GetTableSelection()).GetFirstSelectedCell(&cell)) { if ((itsBindingList->GetBinding(cell.y))->IsSystemBinding()) { JGetUserNotification()->ReportError(JGetString(kCantRemoveSystemBindingID)); } else { CancelEditing(); if (itsBindingList->DeleteBinding(cell.y)) { RemoveRow(cell.y); } else { TableRefreshRow(cell.y); GetWindow()->Update(); (JGetUserNotification())->DisplayMessage(JGetString(kReplacedBySystemID)); } UpdateButtons(); Broadcast(DataChanged()); } } }
void GMFilterNameTable::HandleDNDHere ( const JPoint& pt, const JXWidget* source ) { itsDNDIsValid = kJTrue; JIndex oldIndex = itsCurrentDNDIndex; JPoint cell; if (GetCell(pt, &cell)) { itsCurrentDNDIndex = cell.y; } else { itsCurrentDNDIndex = 0; } if (oldIndex != 0) { TableRefreshRow(oldIndex); } else { const JSize count = GetRowCount(); if (count > 0) { TableRefreshRow(count); } } if (itsCurrentDNDIndex != 0) { TableRefreshRow(itsCurrentDNDIndex); } else { const JSize count = GetRowCount(); if (count > 0) { TableRefreshRow(count); } } }
void JXTextMenuTable::MenuHilightItem ( const JIndex itemIndex ) { itsHilightRow = itemIndex; TableRefreshRow(itemIndex); }
void JXTextMenuTable::MenuUnhilightItem ( const JIndex itemIndex ) { assert( itemIndex == itsHilightRow ); itsHilightRow = 0; TableRefreshRow(itemIndex); }
void JXFSBindingTable::HandleTypeMenu ( const JIndex index ) { JPoint cell; const JBoolean ok = (GetTableSelection()).GetFirstSelectedCell(&cell); assert( ok ); const JFSBinding::CommandType newType = kMenuIndexToCmdType [ index-1 ]; if (itsBindingList->SetCommandType(cell.y, newType)) { TableRefreshRow(cell.y); Broadcast(DataChanged()); } }
void JXFSBindingTable::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { JTableSelection& s = GetTableSelection(); s.ClearSelection(); JPoint cell; if (button == kJXLeftButton && GetCell(pt, &cell)) { s.SelectCell(cell); TableScrollToCell(cell); if (cell.x == kPatternColumn || cell.x == kCommandColumn) { BeginEditing(cell); } else if (cell.x == kTypeColumn) { itsTypeMenu->PopUp(this, pt, buttonStates, modifiers); } else if (cell.x == kSingleFileColumn) { itsBindingList->ToggleSingleFile(cell.y); TableRefreshRow(cell.y); Broadcast(DataChanged()); } } else { ScrollForWheel(button, modifiers); } }
void SelectionTable::Receive ( JBroadcaster* sender, const Message& message ) { // Here we check to see what messages we have received. // We first check if the sender is our data array if (sender == itsData) { // Our data array sent us a message // Was data inserted? if (message.Is(JOrderedSetT::kElementsInserted)) { // cast the message to an ElementsInserted object const JOrderedSetT::ElementsInserted* info = dynamic_cast<const JOrderedSetT::ElementsInserted*>(&message); assert(info != NULL); // For each element inserted, we insert a row InsertRows(info->GetFirstIndex(), info->GetCount(), kDefRowHeight); } // Was data removed? else if (message.Is(JOrderedSetT::kElementsRemoved)) { // cast the message to an ElementsRemoved object const JOrderedSetT::ElementsRemoved* info = dynamic_cast<const JOrderedSetT::ElementsRemoved*>(&message); assert(info != NULL); // Remove corresponding table rows. for (JSize i = info->GetLastIndex(); i >= info->GetFirstIndex() ; i--) { RemoveNextRows(info->GetFirstIndex(), info->GetCount()); } } // Was an element changed? else if (message.Is(JOrderedSetT::kElementChanged)) { // cast the message to an ElementsRemoved object const JOrderedSetT::ElementChanged* info = dynamic_cast<const JOrderedSetT::ElementChanged*>(&message); assert(info != NULL); // The element changed, so redraw it. // (This would not be necessary if we were using a // class derived from JTableData.) TableRefreshRow(info->GetFirstIndex()); } } // Did the Table menu send a message? else if (sender == itsTableMenu) { // Does the menu need an update? if (message.Is(JXMenu::kNeedsUpdate)) { UpdateTableMenu(); } // Has a menu item been selected? else if (message.Is(JXMenu::kItemSelected)) { // cast the message to an ItemSelecte object. // This will tell us which item was selected. const JXMenu::ItemSelected* info = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert(info != NULL); // Pass the selected menu item to our menu handler function. HandleTableMenu(info->GetIndex()); } } // pass the message to our base class else { JXTable::Receive(sender, message); } }
void JXTreeListWidget::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == itsTreeList && message.Is(JTreeList::kNodeInserted)) { const JTreeList::NodeInserted* info = dynamic_cast<const JTreeList::NodeInserted*>(&message); assert( info != NULL ); InsertRows(info->GetIndex(), 1); NeedsAdjustToTree(); } else if (sender == itsTreeList && message.Is(JTreeList::kNodeRemoved)) { const JTreeList::NodeRemoved* info = dynamic_cast<const JTreeList::NodeRemoved*>(&message); assert( info != NULL ); RemoveRow(info->GetIndex()); NeedsAdjustToTree(); } else if (sender == itsTreeList && message.Is(JTreeList::kNodeChanged)) { const JTreeList::NodeChanged* info = dynamic_cast<const JTreeList::NodeChanged*>(&message); assert( info != NULL ); TableRefreshRow(info->GetIndex()); NeedsAdjustToTree(); } else if (sender == itsTreeList && (message.Is(JTreeList::kNodeOpened) || message.Is(JTreeList::kNodeClosed))) { const JTreeList::NodeMessage* info = dynamic_cast<const JTreeList::NodeMessage*>(&message); assert( info != NULL ); TableRefreshRow(info->GetIndex()); } else if (sender == itsTreeList->GetTree() && message.Is(JTree::kPrepareForNodeMove)) { HandlePrepareForNodeMove(); } else if (sender == itsTreeList->GetTree() && message.Is(JTree::kNodeMoveFinished)) { HandleNodeMoveFinished(); } else { if (sender == this && message.Is(kColsInserted)) { const ColsInserted* info = dynamic_cast<const ColsInserted*>(&message); assert( info != NULL ); info->AdjustIndex(&itsToggleOpenColIndex); info->AdjustIndex(&itsNodeColIndex); info->AdjustIndex(&itsElasticColIndex); NeedsAdjustToTree(); } else if (sender == this && message.Is(kColsRemoved)) { const ColsRemoved* info = dynamic_cast<const ColsRemoved*>(&message); assert( info != NULL ); JBoolean ok = info->AdjustIndex(&itsToggleOpenColIndex); assert( ok ); ok = info->AdjustIndex(&itsNodeColIndex); assert( ok ); info->AdjustIndex(&itsElasticColIndex); // ok to let it go to zero NeedsAdjustToTree(); } else if (sender == this && message.Is(kColMoved)) { const ColMoved* info = dynamic_cast<const ColMoved*>(&message); assert( info != NULL ); info->AdjustIndex(&itsToggleOpenColIndex); info->AdjustIndex(&itsNodeColIndex); info->AdjustIndex(&itsElasticColIndex); itsMinColWidths->MoveElementToIndex(info->GetOrigIndex(), info->GetNewIndex()); } JXStyleTable::Receive(sender, message); } }