Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/10 08:52:32 (15 years ago)
Author:
gkronber
Message:

Created a specialized view for function library injectors which allows full configuration of the function library. #748 (FunctionLibraryView is empty)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP/3.3/FunctionView.cs

    r2701 r2728  
    165165        if (e.Data.GetDataPresent("IFunction")) {
    166166          IFunction fun = (IFunction)e.Data.GetData("IFunction");
     167          try {
     168            Cursor = Cursors.WaitCursor;
     169            if (selectedSlot == ALL_SLOTS) {
     170              for (int slot = 0; slot < function.MaxSubTrees; slot++)
     171                function.AddAllowedSubFunction(fun, slot);
     172            } else {
     173              int slot = int.Parse(selectedSlot);
     174              function.AddAllowedSubFunction(fun, slot);
     175            }
     176          }
     177          finally {
     178            Cursor = Cursors.Default;
     179          }
     180        }
     181      }
     182    }
     183
     184    private void subFunctionsListBox_KeyUp(object sender, KeyEventArgs e) {
     185      try {
     186        Cursor = Cursors.WaitCursor;
     187        if (subFunctionsListBox.SelectedItems.Count > 0 && e.KeyCode == Keys.Delete) {
    167188          if (selectedSlot == ALL_SLOTS) {
    168             for (int slot = 0; slot < function.MaxSubTrees; slot++)
    169               function.AddAllowedSubFunction(fun, slot);
     189            for (int slot = 0; slot < function.MaxSubTrees; slot++) {
     190              foreach (var subFun in subFunctionsListBox.SelectedItems) {
     191                function.RemoveAllowedSubFunction((IFunction)subFun, slot);
     192              }
     193            }
    170194          } else {
    171195            int slot = int.Parse(selectedSlot);
    172             function.AddAllowedSubFunction(fun, slot);
    173           }
    174         }
    175       }
    176     }
    177 
    178     private void subFunctionsListBox_KeyUp(object sender, KeyEventArgs e) {
    179       if (subFunctionsListBox.SelectedItems.Count > 0 && e.KeyCode == Keys.Delete) {
    180 
    181         if (selectedSlot == ALL_SLOTS) {
    182           for (int slot = 0; slot < function.MaxSubTrees; slot++) {
    183196            foreach (var subFun in subFunctionsListBox.SelectedItems) {
    184197              function.RemoveAllowedSubFunction((IFunction)subFun, slot);
    185198            }
    186199          }
    187         } else {
    188           int slot = int.Parse(selectedSlot);
    189           foreach (var subFun in subFunctionsListBox.SelectedItems) {
    190             function.RemoveAllowedSubFunction((IFunction)subFun, slot);
    191           }
     200
    192201        }
    193 
     202      }
     203      finally {
     204        Cursor = Cursors.Default;
    194205      }
    195206    }
Note: See TracChangeset for help on using the changeset viewer.