home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Palette / MiscTableScrollInspector.M < prev    next >
Encoding:
Text File  |  1998-03-31  |  21.4 KB  |  708 lines

  1. //=============================================================================
  2. //
  3. //  Copyright (C) 1995,1996,1997,1998 by Paul S. McCarthy and Eric Sunshine.
  4. //        Written by Paul S. McCarthy and Eric Sunshine.
  5. //                All Rights Reserved.
  6. //
  7. //    This notice may not be removed from this source code.
  8. //
  9. //    This object is included in the MiscKit by permission from the authors
  10. //    and its use is governed by the MiscKit license, found in the file
  11. //    "License.rtf" in the MiscKit distribution.  Please refer to that file
  12. //    for a list of all applicable permissions and restrictions.
  13. //    
  14. //=============================================================================
  15. //-----------------------------------------------------------------------------
  16. // MiscTableScrollInspector.M
  17. //
  18. //    Interface Builder inspector for MiscTableScroll.
  19. //
  20. //-----------------------------------------------------------------------------
  21. //-----------------------------------------------------------------------------
  22. // $Id: MiscTableScrollInspector.M,v 1.19 98/03/30 00:06:01 sunshine Exp $
  23. // $Log:    MiscTableScrollInspector.M,v $
  24. //  Revision 1.19  98/03/30  00:06:01  sunshine
  25. //  v138.1: Ditched unnecessary "align title" text field since under OPENSTEP,
  26. //  buttons are correctly dimmed when disabled.  Consequently I don't have to
  27. //  worry about figuring out correct enabled/disabled colors for the field.
  28. //  Fixed bug: Pressing "new slot" would draw and highlight the new cell, but
  29. //  wouldn't redraw the old selected cell.
  30. //  
  31. //  Revision 1.18  98/03/23  08:41:38  sunshine
  32. //  v135.1: Fixed v130 bug: up/down arrows stopped working.
  33. //  
  34. //  Revision 1.17  98/03/22  13:08:23  sunshine
  35. //  v133.1: Eliminated constrain-max, constrain-min is now implicit based on
  36. //  presence/absence of auto-size slots.  Eliminated data-sizing.
  37. //  Added alignment control.
  38. //-----------------------------------------------------------------------------
  39. #import "MiscTableScrollInspector.h"
  40. #import "MiscTableBorder.h"
  41. #import <MiscTableScroll/MiscTableScroll.h>
  42.  
  43. //=============================================================================
  44. // IB-ONLY METHODS FOR MiscTableScroll
  45. //=============================================================================
  46. @interface MiscTableScroll(IB)
  47. - (NSString*)inspectorClassName;
  48. - (void)editSelf:(id)sender in:(id)owner;
  49. @end
  50.  
  51. @implementation MiscTableScroll(IB)
  52. - (NSString*)inspectorClassName
  53.     {
  54.     NSString* s = @"MiscTableScrollInspector";
  55.     return s;
  56.     }
  57. // Prevent double-click from editing NSScrollView in IB
  58. - (void)editSelf:(id)sender in:(id)owner {}
  59. @end
  60.  
  61.  
  62. //=============================================================================
  63. // CONVENIENCE CATAGORIES
  64. //=============================================================================
  65. @interface NSPopUpButton(MiscTableScroll)
  66. - (int)popUpTag;
  67. - (void)setPopUpTag:(int)new_tag;
  68. @end
  69.  
  70. @implementation NSPopUpButton(MiscTableScroll)
  71.  
  72. - (int)popUpTag { return [[self selectedItem] tag]; }
  73.  
  74. - (void)setPopUpTag:(int)new_tag
  75.     {
  76.     NSArray* items = [self itemArray];
  77.     for (int i = [items count]; i-- > 0; )
  78.     {
  79.     id<NSMenuItem> item = (id<NSMenuItem>)[items objectAtIndex:i];
  80.     if ([item tag] == new_tag)
  81.         {
  82.         [self selectItemWithTitle:[item title]];
  83.         break;
  84.         }
  85.     }
  86.     }
  87.  
  88. @end
  89.  
  90.  
  91. //=============================================================================
  92. // IMPLEMENTATION
  93. //=============================================================================
  94. @interface MiscTableScrollInspector(Forward)
  95. - (void)doSlot:(id)sender;
  96. - (void)doTitleMode:(id)sender;
  97. @end
  98.  
  99. @implementation MiscTableScrollInspector
  100.  
  101. - (BOOL)wantsButtons { return NO; }
  102. - (void)ok:(id)sender { [super ok:sender]; }
  103.  
  104.  
  105. //-----------------------------------------------------------------------------
  106. // init
  107. //-----------------------------------------------------------------------------
  108. - (id)init
  109.     {
  110.     [super init];
  111.     [NSBundle loadNibNamed:[[self class] description] owner:self];
  112.     [[upButton cell] setImageDimsWhenDisabled:YES];
  113.     [[downButton cell] setImageDimsWhenDisabled:YES];
  114.     borderType = MISC_COL_BORDER;
  115.     dirty = NO;
  116.     return self;
  117.     }
  118.  
  119.  
  120. //-----------------------------------------------------------------------------
  121. // setTitleControls
  122. //-----------------------------------------------------------------------------
  123. - (void)setTitleControls
  124.     {
  125.     id o = [self object];
  126.     if ([o slotTitlesOn:borderType])
  127.     {
  128.     [titlesSwitch setState:1];
  129.     [sizableSwitch setEnabled:YES];
  130.     [sizableSwitch setState:border->isSizeable()];
  131.     [draggableSwitch setEnabled:YES];
  132.     [draggableSwitch setState:border->isDraggable()];
  133.     [titleModePopUp setEnabled:YES];
  134.     [titleModePopUp setPopUpTag:(int)[o slotTitleMode:borderType]];
  135.     }
  136.     else
  137.     {
  138.     [titlesSwitch setState:0];
  139.     [sizableSwitch setEnabled:NO];
  140.     [sizableSwitch setState:0];
  141.     [draggableSwitch setEnabled:NO];
  142.     [draggableSwitch setState:0];
  143.     [titleModePopUp setEnabled:NO];
  144.     [titleModePopUp setPopUpTag:(int)[o slotTitleMode:borderType]];
  145.     }
  146.     [uniformSizeField setEnabled:YES];
  147.     [uniformSizeField setIntValue:(int)[o uniformSizeSlots:borderType]];
  148.     }
  149.  
  150.  
  151. //-----------------------------------------------------------------------------
  152. // fillScroll
  153. //-----------------------------------------------------------------------------
  154. - (void)fillScroll
  155.     {
  156.     id o = [self object];
  157.     numSlots = [o numberOfSlots:borderType];
  158.     if (numSlots == 0)
  159.     {
  160.     [slotScroll deselectAllCells];
  161.     [slotScroll renewRows:0 columns:0]; // Gets rid of horiz scroller knob
  162.     }
  163.     else
  164.     {
  165.     [slotScroll renewRows:numSlots columns:1];
  166.     for (int i = 0; i < numSlots; i++)
  167.         {
  168.         int const pslot = [o border:borderType slotAtPosition:i];
  169.         [[slotScroll cellAtRow:i column:0]
  170.             setTitle:[o border:borderType slotTitle:pslot]];
  171.         }
  172.     }
  173.     [slotScroll sizeToCells];
  174.  
  175.     if (numSlots > 0)
  176.     {
  177.     if (slot < 0) slot = 0;
  178.     [slotScroll selectCellAtRow:slot column:0];
  179.     [slotScroll scrollCellToVisibleAtRow:slot column:0];
  180.     }
  181.     else
  182.     slot = -1;
  183.  
  184.     [slotScroll setNeedsDisplay:YES]; // Needed after pressing "Add".
  185.     [self doSlot:self];
  186.     }
  187.  
  188.  
  189. //-----------------------------------------------------------------------------
  190. // doEnabled:
  191. //-----------------------------------------------------------------------------
  192. - (void)doEnabled:(id)sender
  193.     {
  194.     [[self object] setEnabled:[enabledSwitch state]];
  195.     [self ok:sender];
  196.     }
  197.  
  198.  
  199. //-----------------------------------------------------------------------------
  200. // doLazy:
  201. //-----------------------------------------------------------------------------
  202. - (void)doLazy:(id)sender
  203.     {
  204.     [[self object] setLazy:[lazySwitch state]];
  205.     [self ok:sender];
  206.     [self revert:sender];
  207.     }
  208.  
  209.  
  210. //-----------------------------------------------------------------------------
  211. // doMode:
  212. //-----------------------------------------------------------------------------
  213. - (void)doMode:(id)sender
  214.     {
  215.     [[self object] setSelectionMode:MiscSelectionMode([modePopUp popUpTag])];
  216.     [self ok:sender];
  217.     }
  218.  
  219.  
  220. //-----------------------------------------------------------------------------
  221. // doBorder:
  222. //-----------------------------------------------------------------------------
  223. - (void)doBorder:(id)sender
  224.     {
  225.     MiscBorderType bt = MiscBorderType([borderPopUp popUpTag]);
  226.     if (bt != borderType)
  227.     {
  228.     borderType = bt;
  229.     [self revert:sender];
  230.     }
  231.     }
  232.  
  233.  
  234. //-----------------------------------------------------------------------------
  235. // doTitles:
  236. //-----------------------------------------------------------------------------
  237. - (void)doTitles:(id)sender
  238.     {
  239.     BOOL const isOn = [titlesSwitch state];
  240.     [[self object] border:borderType setSlotTitlesOn:isOn];
  241.     [self setTitleControls];
  242.     [self doSlot:self];
  243.     [self ok:sender];
  244.     }
  245.  
  246.  
  247. //-----------------------------------------------------------------------------
  248. // doSizable:
  249. //-----------------------------------------------------------------------------
  250. - (void)doSizable:(id)sender
  251.     {
  252.     [[self object] border:borderType setSizeableSlots:[sizableSwitch state]];
  253.     [self doSlot:0];
  254.     [self ok:sender];
  255.     }
  256.  
  257.  
  258. //-----------------------------------------------------------------------------
  259. // doDraggable:
  260. //-----------------------------------------------------------------------------
  261. - (void)doDraggable:(id)sender
  262.     {
  263.     [[self object] border:borderType
  264.         setDraggableSlots:[draggableSwitch state]];
  265.     [self ok:sender];
  266.     }
  267.  
  268.  
  269. //-----------------------------------------------------------------------------
  270. // doAutoSort:
  271. //-----------------------------------------------------------------------------
  272. - (void)doAutoSort:(id)sender
  273.     {
  274.     [[self object] border:borderType setAutoSortSlots:[autoSortSwitch state]];
  275.     [self ok:sender];
  276.     }
  277.  
  278.  
  279. //-----------------------------------------------------------------------------
  280. // doTitleMode:
  281. //-----------------------------------------------------------------------------
  282. - (void)doTitleMode:(id)sender
  283.     {
  284.     [[self object] border:borderType
  285.     setSlotTitleMode:(MiscTableTitleMode)[titleModePopUp popUpTag]];
  286.     [self fillScroll];
  287.     [self ok:sender];
  288.     }
  289.  
  290.  
  291. //-----------------------------------------------------------------------------
  292. // doDelete:
  293. //-----------------------------------------------------------------------------
  294. - (void)doDelete:(id)sender
  295.     {
  296.     id o = [self object];
  297.     [o border:borderType
  298.         removeSlot:[o border:borderType slotAtPosition:slot]];
  299.     [o tile];
  300.     [o display];
  301.     slot--;
  302.     numSlots--;
  303.     if (slot < 0 && numSlots > 0)
  304.     slot = 0;
  305.     [self fillScroll];
  306.     [self ok:sender];
  307.     }
  308.  
  309.  
  310. //-----------------------------------------------------------------------------
  311. // doNew:
  312. //-----------------------------------------------------------------------------
  313. - (void)doNew:(id)sender
  314.     {
  315.     id o = [self object];
  316.     [o addSlot:borderType];
  317.     [o sizeToCells];
  318.     slot = numSlots;
  319.     [self fillScroll];
  320.     [self ok:sender];
  321.     }
  322.  
  323.  
  324. //-----------------------------------------------------------------------------
  325. // doUserSizeable:
  326. //-----------------------------------------------------------------------------
  327. - (void)doUserSizeable:(id)sender
  328.     {
  329.     id o = [self object];
  330.     [o border:borderType setSlot:[o border:borderType slotAtPosition:slot]
  331.         sizeable:[userSizeableSwitch state]];
  332.     [self ok:sender];
  333.     }
  334.  
  335.  
  336. //-----------------------------------------------------------------------------
  337. // doAlign:
  338. //-----------------------------------------------------------------------------
  339. - (void)doAlign:(id)sender
  340.     {
  341.     id o = [self object];
  342.     int const pslot = [o border:borderType slotAtPosition:slot];
  343.     if ([o border:borderType slotCellType:pslot] == MISC_TABLE_CELL_TEXT)
  344.     {
  345.     id const proto = [o border:borderType slotCellPrototype:pslot];
  346.     id const cell = [alignMatrix selectedCell];
  347.     [proto setAlignment:(NSTextAlignment)[cell tag]];
  348.     }
  349.     [self ok:sender];
  350.     }
  351.  
  352.  
  353. //-----------------------------------------------------------------------------
  354. // doAutosize:
  355. //-----------------------------------------------------------------------------
  356. - (void)doAutosize:(id)sender
  357.     {
  358.     id o = [self object];
  359.     [o border:borderType setSlot:[o border:borderType slotAtPosition:slot]
  360.         autosize:[autosizeSwitch state]];
  361.     [self ok:sender];
  362.     }
  363.  
  364.  
  365. //-----------------------------------------------------------------------------
  366. // doCellClass:
  367. //-----------------------------------------------------------------------------
  368. - (void)doCellClass:(id)sender
  369.     {
  370.     id o = [self object];
  371.     int const pslot = [o border:borderType slotAtPosition:slot];
  372.     int const old_val = (int)[o border:borderType slotCellType:pslot];
  373.     int const new_val = [cellClassPopUp popUpTag];
  374.  
  375.     if (old_val != new_val)
  376.     {
  377.     [o border:borderType setSlot:pslot
  378.         cellType:(MiscTableCellStyle)new_val];
  379.     if (new_val == MISC_TABLE_CELL_TEXT)
  380.         {
  381.         [alignMatrix setEnabled:YES];
  382.         id const cell = [o border:borderType slotCellPrototype:pslot];
  383.         [alignMatrix selectCellWithTag:[cell alignment]];
  384.         }
  385.     else if (old_val == MISC_TABLE_CELL_TEXT)
  386.         [alignMatrix setEnabled:NO];
  387.     }
  388.  
  389.     [self ok:sender];
  390.     }
  391.  
  392.  
  393. //-----------------------------------------------------------------------------
  394. // doSortType:
  395. //-----------------------------------------------------------------------------
  396. - (void)doSortType:(id)sender
  397.     {
  398.     id o = [self object];
  399.     [o border:borderType setSlot:[o border:borderType slotAtPosition:slot]
  400.         sortType:(MiscSortType)[sortTypePopUp popUpTag]];
  401.     [self ok:sender];
  402.     }
  403.  
  404.  
  405. //-----------------------------------------------------------------------------
  406. // doSortDirection:
  407. //-----------------------------------------------------------------------------
  408. - (void)doSortDirection:(id)sender
  409.     {
  410.     id o = [self object];
  411.     [o border:borderType setSlot:[o border:borderType slotAtPosition:slot]
  412.     sortDirection:(MiscSortDirection)[sortDirectionPopUp popUpTag]];
  413.     [self ok:sender];
  414.     }
  415.  
  416.  
  417. //-----------------------------------------------------------------------------
  418. // doSlot:
  419. //-----------------------------------------------------------------------------
  420. - (void)doSlot:(id)sender
  421.     {
  422.     slot = [slotScroll selectedRow];
  423.     if (slot >= 0)
  424.     {
  425.     id o = [self object];
  426.     BOOL const titlesOn = [o slotTitlesOn:borderType];
  427.     BOOL const notUniform = ([o uniformSizeSlots:borderType] == 0);
  428.     int pslot = [o border:borderType slotAtPosition:slot];
  429.     [deleteButton setEnabled:YES];
  430.     [upButton setEnabled:(slot > 0)];
  431.     [downButton setEnabled:(slot < numSlots - 1)];
  432.     int const ctype = (int)[o border:borderType slotCellType:pslot];
  433.     [cellClassPopUp setEnabled:YES];
  434.     [cellClassPopUp setPopUpTag:ctype];
  435.     [sortTypePopUp setEnabled:YES];
  436.     [sortTypePopUp setPopUpTag:
  437.         (int)[o border:borderType slotSortType:pslot]];
  438.     [sortDirectionPopUp setEnabled:YES];
  439.     [sortDirectionPopUp setPopUpTag:
  440.         (int)[o border:borderType slotSortDirection:pslot]];
  441.     if (ctype == MISC_TABLE_CELL_TEXT)
  442.         {
  443.         [alignMatrix setEnabled:YES];
  444.         id const cell = [o border:borderType slotCellPrototype:pslot];
  445.         [alignMatrix selectCellWithTag:[cell alignment]];
  446.         }
  447.     else
  448.         [alignMatrix setEnabled:NO];
  449.     [autosizeSwitch setEnabled:notUniform];
  450.     [autosizeSwitch setState:[o border:borderType slotIsAutosize:pslot]];
  451.     BOOL const enabled = titlesOn && notUniform &&
  452.         [[self object] sizeableSlots:borderType];
  453.     [userSizeableSwitch setEnabled:enabled];
  454.     [userSizeableSwitch setState:
  455.         enabled && [o border:borderType slotIsSizeable:pslot]];
  456.     [sizeField setEnabled:notUniform];
  457.     [sizeField setIntValue:(int)[o border:borderType slotSize:pslot]];
  458.     [sizeMinField setEnabled:notUniform];
  459.     [sizeMinField setIntValue:
  460.         (int)[o border:borderType slotMinSize:pslot]];
  461.     [sizeMaxField setEnabled:notUniform];
  462.     [sizeMaxField setIntValue:
  463.         (int)[o border:borderType slotMaxSize:pslot]];
  464.     [titleField setEnabled:titlesOn &&
  465.         ([o slotTitleMode:borderType] == MISC_CUSTOM_TITLE)];
  466.     [titleField setStringValue:[o border:borderType slotTitle:pslot]];
  467.     }
  468.     else
  469.     {
  470.     [deleteButton setEnabled:NO];
  471.     [upButton setEnabled:NO];
  472.     [downButton setEnabled:NO];
  473.     [cellClassPopUp setEnabled:NO];
  474.     [cellClassPopUp setPopUpTag:0];
  475.     [sortTypePopUp setEnabled:NO];
  476.     [sortTypePopUp setPopUpTag:0];
  477.     [sortDirectionPopUp setEnabled:NO];
  478.     [sortDirectionPopUp setPopUpTag:0];
  479.     [alignMatrix setEnabled:NO];
  480.     [alignMatrix selectCellWithTag:0];
  481.     [autosizeSwitch setEnabled:NO];
  482.     [autosizeSwitch setState:0];
  483.     [userSizeableSwitch setEnabled:NO];
  484.     [userSizeableSwitch setState:0];
  485.     [sizeField setEnabled:NO];
  486.     [sizeField setStringValue:@""];
  487.     [sizeMinField setEnabled:NO];
  488.     [sizeMinField setStringValue:@""];
  489.     [sizeMaxField setEnabled:NO];
  490.     [sizeMaxField setStringValue:@""];
  491.     [titleField setEnabled:NO];
  492.     [titleField setStringValue:@""];
  493.     } 
  494.     }
  495.  
  496.  
  497. //-----------------------------------------------------------------------------
  498. // swapSlots::
  499. //-----------------------------------------------------------------------------
  500. - (void)swapSlots:(int)from_slot :(int)to_slot
  501.     {
  502.     border->swapSlots( from_slot, to_slot );
  503.     [[self object] display];
  504.     slot = to_slot;
  505.     [self fillScroll];
  506.     [self ok:self];
  507.     }
  508.  
  509.  
  510. //-----------------------------------------------------------------------------
  511. // doUp:
  512. //-----------------------------------------------------------------------------
  513. - (void)doUp:(id)sender
  514.     {
  515.     if (slot > 0)
  516.     [self swapSlots:slot :slot-1];
  517.     }
  518.  
  519.  
  520. //-----------------------------------------------------------------------------
  521. // doDown:
  522. //-----------------------------------------------------------------------------
  523. - (void)doDown:(id)sender
  524.     {
  525.     if (slot < numSlots - 1)
  526.     [self swapSlots:slot :slot+1];
  527.     }
  528.  
  529.  
  530. //-----------------------------------------------------------------------------
  531. // getPhysSlot
  532. //    Get the physical slot-id of the current slot.
  533. //-----------------------------------------------------------------------------
  534. - (int)getPhysSlot
  535.     {
  536.     return [[self object] border:borderType slotAtPosition:slot];
  537.     }
  538.  
  539.  
  540. //-----------------------------------------------------------------------------
  541. // controlTextDidBeginEditing:
  542. //-----------------------------------------------------------------------------
  543. - (void)controlTextDidBeginEditing:(NSNotification*)n
  544.     {
  545.     dirty = YES;
  546.     }
  547.  
  548.  
  549. //-----------------------------------------------------------------------------
  550. // controlTextDidEndEditing:
  551. //-----------------------------------------------------------------------------
  552. - (void)controlTextDidEndEditing:(NSNotification*)n
  553.     {
  554.     if (dirty)
  555.     {
  556.     dirty = NO;
  557.     id o = [self object];
  558.     NSTextField* field = [n object];
  559.     if (field == titleField)
  560.         {
  561.         int const pslot = [self getPhysSlot];
  562.         [o border:borderType setSlot:pslot
  563.             title:[titleField stringValue]];
  564.         [[slotScroll cellAtRow:slot column:0]
  565.             setTitle:[titleField stringValue]];
  566.         [slotScroll drawCellAtRow:slot column:0];
  567.         }
  568.     else if (field == uniformSizeField)
  569.         {
  570.         int old_size = (int)[o uniformSizeSlots:borderType];
  571.         int new_size = [uniformSizeField intValue];
  572.         if (new_size != 0)
  573.         {
  574.         if (new_size < MISC_MIN_PIXELS_SIZE)
  575.             new_size = MISC_MIN_PIXELS_SIZE;
  576.         if (new_size > MISC_MAX_PIXELS_SIZE)
  577.             new_size = MISC_MAX_PIXELS_SIZE;
  578.         [uniformSizeField setIntValue:new_size];
  579.         }
  580.         if (old_size != new_size)
  581.         {
  582.         [o border:borderType setUniformSizeSlots:(float)new_size];
  583.         [self ok:self];
  584.         [self revert:self];
  585.         }
  586.         }
  587.     else if (field == sizeField)
  588.         {
  589.         int const pslot = [self getPhysSlot];
  590.         int i = [sizeField intValue];
  591.         int const imin = (int)[o border:borderType slotMinSize:pslot];
  592.         int const imax = (int)[o border:borderType slotMaxSize:pslot];
  593.  
  594.         if (i < imin || i > imax)
  595.         {
  596.         if (i < imin) i = imin;
  597.         if (i > imax) i = imax;
  598.         [sizeField setIntValue:i];
  599.         }
  600.         [o border:borderType setSlot:pslot size:i];
  601.         }
  602.     else if (field == sizeMinField)
  603.         {
  604.         int const pslot = [self getPhysSlot];
  605.         int const i = (int)[o border:borderType slotSize:pslot];
  606.         int imin = [sizeMinField intValue];
  607.         int const imax = (int)[o border:borderType slotMaxSize:pslot];
  608.  
  609.         if (imin < MISC_MIN_PIXELS_SIZE)
  610.         imin = MISC_MIN_PIXELS_SIZE;
  611.         else if (imin > imax)
  612.         imin = imax;
  613.         if (imin > i)    // Not an 'else if'
  614.         imin = i;
  615.  
  616.         [sizeMinField setIntValue:imin];
  617.         [o border:borderType setSlot:pslot minSize:imin];
  618.         }
  619.     else if (field == sizeMaxField)
  620.         {
  621.         int const pslot = [self getPhysSlot];
  622.         int const i = (int)[o border:borderType slotSize:pslot];
  623.         int const imin = (int)[o border:borderType slotMinSize:pslot];
  624.         int imax = [sizeMaxField intValue];
  625.  
  626.         if (imax > MISC_MAX_PIXELS_SIZE)
  627.         imax = MISC_MAX_PIXELS_SIZE;
  628.         else if (imax < imin)
  629.         imax = imin;
  630.         if (imax < i)    // Not an 'else if'
  631.         imax = i;
  632.  
  633.         [sizeMaxField setIntValue:imax];
  634.         [o border:borderType setSlot:pslot maxSize:imax];
  635.         }
  636.     [self ok:self];
  637.     }
  638.     }
  639.  
  640.  
  641. //-----------------------------------------------------------------------------
  642. // doColorText:
  643. //-----------------------------------------------------------------------------
  644. - (void)doColorText:(id)sender
  645.     {
  646.     [[self object] setTextColor:[sender color]];
  647.     [self ok:sender];
  648.     }
  649.  
  650.  
  651. //-----------------------------------------------------------------------------
  652. // doColorBack:
  653. //-----------------------------------------------------------------------------
  654. - (void)doColorBack:(id)sender
  655.     {
  656.     [[self object] setBackgroundColor:[sender color]];
  657.     [self ok:sender];
  658.     }
  659.  
  660.  
  661. //-----------------------------------------------------------------------------
  662. // doColorTextSelected:
  663. //-----------------------------------------------------------------------------
  664. - (void)doColorTextSelected:(id)sender
  665.     {
  666.     [[self object] setSelectedTextColor:[sender color]];
  667.     [self ok:sender];
  668.     }
  669.  
  670.  
  671. //-----------------------------------------------------------------------------
  672. // doColorBackSelected:
  673. //-----------------------------------------------------------------------------
  674. - (void)doColorBackSelected:(id)sender
  675.     {
  676.     [[self object] setSelectedBackgroundColor:[sender color]];
  677.     [self ok:sender];
  678.     }
  679.  
  680.  
  681. //-----------------------------------------------------------------------------
  682. // revert:
  683. //-----------------------------------------------------------------------------
  684. - (void)revert:(id)sender
  685.     {
  686.     dirty = NO;
  687.     id o = [self object];
  688.     [super revert:sender];
  689.  
  690.     border = [o border:borderType];
  691.     [autoSortSwitch setState:[o autoSortSlots:borderType]];
  692.     [self setTitleControls];
  693.  
  694.     [enabledSwitch setState:[o isEnabled]];
  695.     [lazySwitch setState:[o isLazy]];
  696.     [modePopUp setPopUpTag:(int) [o selectionMode]];
  697.  
  698.     [colorText setColor:[o textColor]];
  699.     [colorTextSelected setColor:[o selectedTextColor]];
  700.     [colorBack setColor:[o backgroundColor]];
  701.     [colorBackSelected setColor:[o selectedBackgroundColor]];
  702.  
  703.     slot = -1;
  704.     [self fillScroll];
  705.     }
  706.  
  707. @end
  708.