home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / ALIGRID.ZIP / ALIGREDI.PAS < prev    next >
Pascal/Delphi Source File  |  2001-07-06  |  21KB  |  701 lines

  1. unit AligrEdi;
  2. { The component editor for the TStringAlignGrid. }
  3. (*$p+,t+,x+,b-*)
  4.   (*$i ah_def.inc *)
  5. (*@/// interface *)
  6. interface
  7.  
  8. (*@/// uses *)
  9. uses
  10.   SysUtils,
  11.   typinfo,
  12. (*$ifdef delphi_1 *)
  13.   WinTypes,
  14.   WinProcs,
  15. (*$else *)
  16.   windows,
  17. (*$endif *)
  18.   Messages,
  19.   Classes,
  20.   Graphics,
  21.   Controls,
  22.   Forms,
  23.   Dialogs,
  24.   Grids,
  25.   (*$ifdef delphi_ge_6 *)
  26.   designintf,
  27.   designeditors,
  28.   (*$else *)
  29.   dsgnintf,
  30.   (*$endif *)
  31.   stdctrls,
  32.   buttons,
  33.   Spin,
  34.   ExtCtrls,
  35.   menus,
  36.   aligrid;
  37. (*@\\\0000001703*)
  38.  
  39. type
  40. (*@///   TGridComponentEditor = class(TComponentEditor) *)
  41. TGridComponentEditor = class(TComponentEditor)
  42. public
  43.   procedure Edit; override;
  44.   end;
  45. (*@\\\*)
  46. (*@\\\0000000601*)
  47. (*@/// implementation *)
  48. implementation
  49.  
  50. {$R aligredi.DFM}
  51.  
  52. type
  53. (*@///   Taligrid_edit=class(TForm) *)
  54. Taligrid_edit = class(TForm)
  55.   grid: TStringAlignGrid;
  56.   btn_ok: TButton;
  57.   btn_cancel: TButton;
  58.   grp_edit: TGroupBox;
  59.   btn_left: TSpeedButton;
  60.   btn_right: TSpeedButton;
  61.   btn_center: TSpeedButton;
  62.   btn_ww_none: TSpeedButton;
  63.   btn_ww_wrap: TSpeedButton;
  64.   btn_ww_elli: TSpeedButton;
  65.   btn_color: TSpeedButton;
  66.   btn_font: TSpeedButton;
  67.   edt_read: TCheckBox;
  68.   grp_what: TRadioGroup;
  69.   edt_width: TSpinEdit;
  70.   lbl_width: TLabel;
  71.   grp_cell: TRadioGroup;
  72.   FontDialog: TFontDialog;
  73.   ColorDialog: TColorDialog;
  74.   lbl_height: TLabel;
  75.   edt_height: TSpinEdit;
  76.   procedure btn_colorClick(Sender: TObject);
  77.   procedure btn_fontClick(Sender: TObject);
  78.   procedure gridSelectCell(Sender: TObject; Col,Row:Longint; var CanSelect:Boolean);
  79.   procedure grp_whatClick(Sender: TObject);
  80.   procedure grp_cellClick(Sender: TObject);
  81.   procedure btn_alignClick(Sender: TObject);
  82.   procedure btn_wrapClick(Sender: TObject);
  83.   procedure edt_readClick(Sender: TObject);
  84.   procedure edt_wh_Change(Sender: TObject);
  85. public
  86.   component_editor: TGridComponentEditor;
  87.   procedure Update_Group(col,row:longint);
  88. private
  89.   changing: boolean;
  90.   show_cell: integer;
  91. end;
  92. (*@\\\*)
  93. (*@///   THackGrid    =class(TStringAligngrid) *)
  94. (* a nasty hack: to access the protected variables and methods of an object
  95.    it is enough to create an empty descendent of this object and to typecast
  96.    any original object to the descendent - so the compiler then allows to
  97.    access the variables/methods, but as nothing of the VMT etc. is changed by
  98.    this deriving the code produced is absolutely the same. Of course one
  99.    could declare them public in first place, but as modifying the internal
  100.    stuff isn't that easy I dopn't wnat to open it to everyone, but I need it
  101.    here as the TGridComponentEditor brings the unit aligrid above the
  102.    code segment maximum size in 16 bit.                                     *)
  103.  
  104. THackGrid=class(TStringaligngrid)
  105.   end;
  106. (*@\\\*)
  107.  
  108. (*@/// Some internal help routines for copying the internal lists *)
  109. (*@/// function CopyStringCell(Source,Target:TList; ColCount,RowCount:integer):boolean; *)
  110. function CopyStringCell(Source,Target:TList; ColCount,RowCount:integer):boolean;
  111. var
  112.   v,w:pstring;
  113.   ACol,ARow: integer;
  114. begin
  115.   result:=false;
  116.   for ACol:=0 to Colcount-1 do
  117.     for ARow:=0 to Rowcount-1 do begin
  118.       v:=GetItemCell(ACol,ARow,Source);
  119.       if v<>NIL then begin
  120.         result:=true;
  121.         w:=NewStr(v^);
  122.         end
  123.       else
  124.         w:=NIL;
  125.       w:=SetItemCell(ACol,ARow, Target, w);
  126.       if w<>NIL then
  127.         DisposeStr(w);
  128.       end;
  129.   end;
  130. (*@\\\0000000A01*)
  131. (*@/// function CopyPropCell(Source,Target:TList; ColCount,RowCount:integer; grid:THackGrid):boolean; *)
  132. function CopyPropCell(Source,Target:TList; ColCount,RowCount:integer; grid:THackGrid):boolean;
  133. var
  134.   v,w:TCellProperties;
  135.   ACol,ARow: integer;
  136. begin
  137.   result:=false;
  138.   for ACol:=0 to Colcount-1 do
  139.     for ARow:=0 to Rowcount-1 do begin
  140.       v:=GetItemCell(ACol,ARow,Source);
  141.       if v<>NIL then begin
  142.         result:=true;
  143.         w:=v.clone;
  144.         if w.font<>NIL then
  145.           w.font.OnChange:=grid.fontchanged;
  146.         if w.brush<>NIL then
  147.           w.brush.OnChange:=grid.brushchanged;
  148.         if w.selfont<>NIL then
  149.           w.selfont.OnChange:=grid.fontchanged;
  150.         if w.selbrush<>NIL then
  151.           w.selbrush.OnChange:=grid.brushchanged;
  152.         end
  153.       else
  154.         w:=NIL;
  155.       w:=SetItemCell(ACol,ARow, Target, w);
  156.       w.free;
  157.       end;
  158.   end;
  159. (*@\\\0000001424*)
  160. (*@/// function CopyPropCol(Source,Target:TList; Count:integer; grid:THackGrid):boolean; *)
  161. function CopyPropCol(Source,Target:TList; Count:integer; grid:THackGrid):boolean;
  162. var
  163.   v,w:TCellProperties;
  164.   ACol: integer;
  165. begin
  166.   result:=false;
  167.   for ACol:=0 to Count-1 do begin
  168.     v:=GetItemCol(ACol,Source);
  169.     if v<>NIL then begin
  170.       result:=true;
  171.       w:=v.clone;
  172.       if w.font<>NIL then
  173.         w.font.OnChange:=grid.fontchanged;
  174.       if w.brush<>NIL then
  175.         w.brush.OnChange:=grid.brushchanged;
  176.       if w.selfont<>NIL then
  177.         w.selfont.OnChange:=grid.fontchanged;
  178.       if w.selbrush<>NIL then
  179.         w.selbrush.OnChange:=grid.brushchanged;
  180.       end
  181.     else
  182.       w:=NIL;
  183.     w:=SetItemCol(ACol, Target, w);
  184.     w.free;
  185.     end;
  186.   end;
  187. (*@\\\0000000D1A*)
  188. (*@\\\0000000201*)
  189.  
  190. (*@/// TGridComponentEditor = class(TComponentEditor) // The component editor *)
  191. { TGridComponentEditor }
  192. (*@/// procedure TGridComponentEditor.Edit;                          // OnCreate *)
  193. procedure TGridComponentEditor.Edit;
  194. var
  195.   source: THackgrid;
  196.   _grid: THackgrid;
  197.   _form: Taligrid_edit;
  198.   i: longint;
  199. begin
  200.   source:=THackGrid(component as TStringAlignGrid);
  201.   _form:=Taligrid_edit.Create(NIL);
  202.   _grid:=THackGrid(_form.grid);
  203.   if _grid.FCell=NIL then _grid.FCell:=TList.Create;
  204. (*@///   set grid data *)
  205. _grid.options:=[goVertLine,goHorzLine,goEditing];   {goRowSizing,goColSizing}
  206. _grid.fixedrows:=0;
  207. _grid.fixedcols:=0;
  208. if newstylecontrols then
  209.   _grid.DefaultRowHeight:=18;
  210. _grid.FAlwaysEdit:=true;
  211. if source<>NIL then begin
  212.   _grid.wordwrap:=source.wordwrap;
  213.   _grid.defaultColWidth:=source.defaultColWidth;
  214.   _grid.defaultRowHeight:=source.defaultRowHeight;
  215.   _grid.f_Fixedcols:=source.fixedcols;
  216.   _grid.f_fixedrows:=source.fixedrows;
  217.   _grid.colcount:=source.colcount;
  218.   _grid.rowcount:=source.rowcount;
  219.   for i:=source.colcount-1 downto 0 do
  220.     if source.colwidths[i]<>source.defaultColWidth then
  221.       _grid.ColWidths[i] :=source.colwidths[i];
  222.   for i:=source.rowcount-1 downto 0 do
  223.     if source.rowheights[i]<>source.defaultRowHeight then
  224.       _grid.rowheights[i] :=source.rowheights[i];
  225.   _grid.color:=source.color;
  226.   _grid.fixedcolor:=source.fixedcolor;
  227.   _grid.font:=source.font;
  228. (*@///   copy lists source -> grid *)
  229. CopyPropCell (source.FPropCell,_grid.FPropCell,source.colcount,source.rowcount,_grid);
  230. CopyPropCol  (source.FPropCol ,_grid.FPropCol ,source.colcount,_grid);
  231. CopyPropCol  (source.FFPropCol,_grid.FFPropCol,source.colcount,_grid);
  232. CopyPropCol  (source.FPropRow ,_grid.FPropRow ,source.rowcount,_grid);
  233. CopyPropCol  (source.FFPropRow,_grid.FFPropRow,source.rowcount,_grid);
  234. CopyStringCell(source.FHintCell ,_grid.FHintCell,source.colcount,source.rowcount);
  235. CopyStringCell(source.FCell     ,_grid.FCell,source.colcount,source.rowcount);
  236. (*@\\\000000074F*)
  237.   _grid.ListToCells(_grid.FCell);
  238.   end;
  239. (*@\\\000C001501001501*)
  240.   _form.Update_Group(_grid.col,_grid.row);
  241.   if _form.ShowModal=mrOK then begin
  242.     if _form.show_cell=0 then
  243.       _grid.CellsToList(_grid.FCell)
  244.     else
  245.       _grid.CellsToList(_grid.FHintCell);
  246.     if source<>NIL then begin
  247. (*@///       Data grid -> source *)
  248. for i:=_grid.colcount-1 downto 0 do
  249.   if _grid.colwidths[i]<>_grid.defaultColWidth then
  250.     source.ColWidths[i] :=_grid.colwidths[i];
  251. for i:=_grid.rowcount-1 downto 0 do
  252.   if _grid.rowheights[i]<>_grid.defaultRowHeight then
  253.     source.rowheights[i] :=_grid.rowheights[i];
  254.  
  255. source.FSaveHint     :=CopyStringCell(_grid.FHintCell ,source.FHintCell,source.colcount,source.rowcount);
  256. source.FSaveCells    :=CopyStringCell(_grid.FCell     ,source.FCell,source.colcount,source.rowcount);
  257. CopyPropCell (_grid.FPropCell,source.FPropCell,source.colcount,source.rowcount,source);
  258. CopyPropCol  (_grid.FPropCol ,source.FPropCol ,source.colcount,source);
  259. CopyPropCol  (_grid.FFPropCol,source.FFPropCol,source.colcount,source);
  260. CopyPropCol  (_grid.FPropRow ,source.FPropRow ,source.rowcount,source);
  261. CopyPropCol  (_grid.FFPropRow,source.FFPropRow,source.rowcount,source);
  262. (*@\\\0032000A01000E01000A01000A01*)
  263.       if source.FCell<>NIL then
  264.         source.ListToCells(source.FCell);
  265.       end;
  266.     if GetParentForm(source).Designer<>NIL then
  267.       GetParentForm(source).Designer.Modified;
  268.     end;
  269.   _form.Free;
  270.   end;
  271. (*@\\\0000001401*)
  272. (*@\\\0000000201*)
  273. (*@/// Taligrid_edit        = class(TForm)            // The edit form itself *)
  274. { Taligrid_edit }
  275. (*@/// procedure Taligrid_edit.btn_colorClick(Sender: TObject); *)
  276. procedure Taligrid_edit.btn_colorClick(Sender: TObject);
  277. var
  278.   ACol,ARow: longint;
  279.   _grid: THackgrid;
  280.   result: boolean;
  281. begin
  282.   if changing then EXIT;
  283.   try
  284.     changing:=true;
  285.     _grid:=THackgrid(grid);
  286.     ACol:=grid.col;
  287.     ARow:=grid.row;
  288. (*@///     Colordialog.Color:=...; *)
  289. case grp_what.itemindex of
  290.   0: Colordialog.Color:=_grid.GetColorCell(ACol,ARow);
  291.   1: Colordialog.Color:=_grid.GetColorCol(ACol);
  292.   2: Colordialog.Color:=_grid.GetFixColorCol(ACol);
  293.   3: Colordialog.Color:=_grid.GetColorRow(ARow);
  294.   4: Colordialog.Color:=_grid.GetFixColorRow(ARow);
  295.   else ;  (* this cant happen *)
  296.   end;
  297. (*@\\\0000000701*)
  298.     result:=ColorDialog.execute;
  299.     btn_color.down:=result;
  300.     if result then
  301. (*@///       _grid.SetColor...(...,Colordialog.Color); *)
  302. case grp_what.itemindex of
  303.   0: _grid.SetColorCell(ACol,ARow,Colordialog.Color);
  304.   1: _grid.SetColorCol(ACol,Colordialog.Color);
  305.   2: _grid.SetFixColorCol(ACol,Colordialog.Color);
  306.   3: _grid.SetColorRow(ARow,Colordialog.Color);
  307.   4: _grid.SetFixColorRow(ARow,Colordialog.Color);
  308.   else ;  (* this cant happen *)
  309.   end
  310. (*@\\\0000000801*)
  311.     else
  312. (*@///       _grid.ResetColor...(...); *)
  313. case grp_what.itemindex of
  314.   0: _grid.ResetColorCell(ACol,ARow);
  315.   1: _grid.ResetColorCol(ACol);
  316.   2: _grid.ResetColorFixedCol(ACol);
  317.   3: _grid.ResetColorRow(ARow);
  318.   4: _grid.ResetColorFixedRow(ARow);
  319.   else ;  (* this cant happen *)
  320.   end;
  321. (*@\\\0000000801*)
  322.     if _grid.edit_visible then _grid.Update_Edit;
  323.   finally
  324.     changing:=false;
  325.     end;
  326.   end;
  327. (*@\\\0000001301*)
  328. (*@/// procedure Taligrid_edit.btn_fontClick(Sender: TObject); *)
  329. procedure Taligrid_edit.btn_fontClick(Sender: TObject);
  330. var
  331.   ACol,ARow: longint;
  332.   _grid: THackgrid;
  333.   result: boolean;
  334. begin
  335.   if changing then EXIT;
  336.   try
  337.     changing:=true;
  338.     _grid:=THackgrid(grid);
  339.     ACol:=grid.col;
  340.     ARow:=grid.row;
  341. (*@///     Fontdialog.Font:=...; *)
  342. case grp_what.itemindex of
  343.   0: Fontdialog.Font:=_grid.GetFontCell(ACol,ARow);
  344.   1: Fontdialog.Font:=_grid.GetFontCol(ACol);
  345.   2: Fontdialog.Font:=_grid.GetFontFixedCol(ACol);
  346.   3: Fontdialog.Font:=_grid.GetFontRow(ARow);
  347.   4: Fontdialog.Font:=_grid.GetFontFixedRow(ARow);
  348.   else  font:=NIL;  (* this cant happen *)
  349.   end;
  350. (*@\\\0000000701*)
  351.     result:=FontDialog.execute;
  352.     btn_font.down:=result;
  353.     if result then
  354. (*@///       _grid.SetFont...(...,fontdialog.font); *)
  355. case grp_what.itemindex of
  356.   0: _grid.SetFontCell(ACol,ARow,fontdialog.font);
  357.   1: _grid.SetFontCol(ACol,fontdialog.font);
  358.   2: _grid.SetFontFixedCol(ACol,fontdialog.font);
  359.   3: _grid.SetfontRow(ARow,fontdialog.font);
  360.   4: _grid.SetFontFixedRow(ARow,fontdialog.font);
  361.   end
  362. (*@\\\0000000401*)
  363.     else
  364. (*@///       _grid.Resetfont...(...); *)
  365. case grp_what.itemindex of
  366.   0: _grid.ResetfontCell(ACol,ARow);
  367.   1: _grid.ResetfontCol(ACol);
  368.   2: _grid.ResetfontFixedCol(ACol);
  369.   3: _grid.ResetfontRow(ARow);
  370.   4: _grid.ResetfontFixedRow(ARow);
  371.   end;
  372. (*@\\\0000000206*)
  373.     if _grid.edit_visible then _grid.Update_Edit;
  374.   finally
  375.     changing:=false;
  376.     end;
  377.   end;
  378. (*@\\\*)
  379. (*@/// procedure Taligrid_edit.edt_readClick(Sender: TObject); *)
  380. procedure Taligrid_edit.edt_readClick(Sender: TObject);
  381. var
  382.   ACol,ARow: longint;
  383.   _grid: THackgrid;
  384. begin
  385.   if changing then EXIT;
  386.   try
  387.     changing:=true;
  388.     _grid:=THackgrid(grid);
  389.     ACol:=grid.col;
  390.     ARow:=grid.row;
  391.     case edt_read.state of
  392. (*@///       cbUnChecked: *)
  393. cbUnChecked:
  394.   case grp_what.itemindex of
  395.     0: _grid.EditCell[ACol,ARow]:=true;
  396.     1: _grid.EditCol[ACol]:=true;
  397.     3: _grid.EditRow[ARow]:=true;
  398.     end;
  399. (*@\\\0000000105*)
  400. (*@///       cbGrayed: *)
  401. cbGrayed:
  402.   case grp_what.itemindex of
  403.     0: _grid.ResetEditCell(ACol,ARow);
  404.     1: _grid.ResetEditCol(ACol);
  405.     3: _grid.ResetEditRow(ARow);
  406.     end;
  407. (*@\\\*)
  408. (*@///       cbChecked: *)
  409. cbChecked:
  410.   case grp_what.itemindex of
  411.     0: _grid.EditCell[ACol,ARow]:=false;
  412.     1: _grid.EditCol[ACol]:=false;
  413.     2: _grid.EditRow[ARow]:=false;
  414.     end;
  415. (*@\\\0000000103*)
  416.       end;
  417.   finally
  418.     changing:=false;
  419.     end;
  420.   end;
  421. (*@\\\0000000D01*)
  422. (*@/// procedure Taligrid_edit.btn_alignClick(Sender: TObject); *)
  423. procedure Taligrid_edit.btn_alignClick(Sender: TObject);
  424. var
  425.   ACol,ARow: longint;
  426.   _grid: THackgrid;
  427. begin
  428.   if changing then EXIT;
  429.   try
  430.     changing:=true;
  431.     _grid:=THackgrid(grid);
  432.     ACol:=grid.col;
  433.     ARow:=grid.row;
  434.     if false then
  435. (*@///     else if btn_left.down then *)
  436. else if btn_left.down then begin
  437.   case grp_what.itemindex of
  438.     0: _grid.AlignCell[ACol,ARow]:=alLeft;
  439.     1: _grid.AlignCol[ACol]      :=alLeft;
  440.     2: _grid.FixAlignCol[ACol]   :=alLeft;
  441.     3: _grid.AlignRow[ARow]      :=alLeft;
  442.     4: _grid.FixAlignRow[ARow]   :=alLeft;
  443.     end;
  444.   end
  445. (*@\\\*)
  446. (*@///     else if btn_right.down then *)
  447. else if btn_right.down then begin
  448.   case grp_what.itemindex of
  449.     0: _grid.AlignCell[ACol,ARow]:=alRight;
  450.     1: _grid.AlignCol[ACol]      :=alRight;
  451.     2: _grid.FixAlignCol[ACol]   :=alRight;
  452.     3: _grid.AlignRow[ARow]      :=alRight;
  453.     4: _grid.FixAlignRow[ARow]   :=alRight;
  454.     end;
  455.   end
  456. (*@\\\0000000326*)
  457. (*@///     else if btn_center.down then *)
  458. else if btn_center.down then begin
  459.   case grp_what.itemindex of
  460.     0: _grid.AlignCell[ACol,ARow]:=alCenter;
  461.     1: _grid.AlignCol[ACol]      :=alCenter;
  462.     2: _grid.FixAlignCol[ACol]   :=alCenter;
  463.     3: _grid.AlignRow[ARow]      :=alCenter;
  464.     4: _grid.FixAlignRow[ARow]   :=alCenter;
  465.     end;
  466.   end
  467. (*@\\\0000000201*)
  468. (*@///     else ResetAlignment *)
  469. else begin
  470.   case grp_what.itemindex of
  471.     0: _grid.ResetAlignCell(ACol,ARow);
  472.     1: _grid.ResetAlignCol(ACol);
  473.     2: _grid.ResetAlignFixedCol(ACol);
  474.     3: _grid.ResetAlignRow(ARow);
  475.     4: _grid.ResetAlignFixedRow(ARow);
  476.     end;
  477.   end;
  478. (*@\\\*)
  479.     if _grid.edit_visible then _grid.Update_Edit;
  480.   finally
  481.     changing:=false;
  482.     end;
  483.   end;
  484. (*@\\\*)
  485. (*@/// procedure Taligrid_edit.btn_wrapClick(Sender: TObject); *)
  486. procedure Taligrid_edit.btn_wrapClick(Sender: TObject);
  487. var
  488.   ACol,ARow: longint;
  489.   _grid: THackgrid;
  490. begin
  491.   if changing then EXIT;
  492.   try
  493.     changing:=true;
  494.     _grid:=THackgrid(grid);
  495.     ACol:=grid.col;
  496.     ARow:=grid.row;
  497.     if false then
  498. (*@///     else if btn_ww_none.down then *)
  499. else if btn_ww_none.down then begin
  500.   case grp_what.itemindex of
  501.     0: _grid.WordwrapCell[ACol,ARow]:=ww_none;
  502.     1: _grid.WordwrapCol[ACol]      :=ww_none;
  503.     2: _grid.FixWordwrapCol[ACol]   :=ww_none;
  504.     3: _grid.WordwrapRow[ARow]      :=ww_none;
  505.     4: _grid.FixWordwrapRow[ARow]   :=ww_none;
  506.     end;
  507.   end
  508. (*@\\\0000000114*)
  509. (*@///     else if btn_ww_wrap.down then *)
  510. else if btn_ww_wrap.down then begin
  511.   case grp_what.itemindex of
  512.     0: _grid.WordwrapCell[ACol,ARow]:=ww_wordwrap;
  513.     1: _grid.WordwrapCol[ACol]      :=ww_wordwrap;
  514.     2: _grid.FixWordwrapCol[ACol]   :=ww_wordwrap;
  515.     3: _grid.WordwrapRow[ARow]      :=ww_wordwrap;
  516.     4: _grid.FixWordwrapRow[ARow]   :=ww_wordwrap;
  517.     end;
  518.   end
  519. (*@\\\0000000114*)
  520. (*@///     else if btn_ww_elli.down then *)
  521. else if btn_ww_elli.down then begin
  522.   case grp_what.itemindex of
  523.     0: _grid.WordwrapCell[ACol,ARow]:=ww_ellipsis;
  524.     1: _grid.WordwrapCol[ACol]      :=ww_ellipsis;
  525.     2: _grid.FixWordwrapCol[ACol]   :=ww_ellipsis;
  526.     3: _grid.WordwrapRow[ARow]      :=ww_ellipsis;
  527.     4: _grid.FixWordwrapRow[ARow]   :=ww_ellipsis;
  528.     end;
  529.   end
  530. (*@\\\0000000301*)
  531. (*@///     else ResetWordwrap *)
  532. else begin
  533.   case grp_what.itemindex of
  534.     0: _grid.ResetWordwrapCell(ACol,ARow);
  535.     1: _grid.ResetWordwrapCol(ACol);
  536.     2: _grid.ResetWordwrapFixedCol(ACol);
  537.     3: _grid.ResetWordwrapRow(ARow);
  538.     4: _grid.ResetWordwrapFixedRow(ARow);
  539.     end;
  540.   end;
  541. (*@\\\*)
  542.   finally
  543.     changing:=false;
  544.     end;
  545.   end;
  546. (*@\\\0000000119*)
  547. (*@/// procedure Taligrid_edit.grp_cellClick(Sender: TObject); *)
  548. procedure Taligrid_edit.grp_cellClick(Sender: TObject);
  549. var
  550.   _grid: THackgrid;
  551. begin
  552.   _grid:=THackgrid(grid);
  553.   if grp_cell.itemindex=show_cell then EXIT;
  554.   _grid.Hideedit(false);
  555.   show_cell:=grp_cell.itemindex;
  556.   case show_cell of
  557.     0: begin
  558.       _grid.CellsToList(_grid.FHintCell);
  559.       _grid.ListToCells(_grid.FCell);
  560.       end;
  561.     1: begin
  562.       _grid.CellsToList(_grid.FCell);
  563.       _grid.ListToCells(_grid.FHintCell);
  564.       end;
  565.     end;
  566.   end;
  567. (*@\\\0000000711*)
  568. (*@/// procedure Taligrid_edit.gridSelectCell(Sender: TObject; Col,  Row: Longint...); *)
  569. procedure Taligrid_edit.gridSelectCell(Sender: TObject; Col,
  570.   Row: Longint; var CanSelect: Boolean);
  571. begin
  572.   Update_Group(col,row);
  573.   end;
  574. (*@\\\0000000401*)
  575. (*@/// procedure Taligrid_edit.grp_whatClick(Sender: TObject); *)
  576. procedure Taligrid_edit.grp_whatClick(Sender: TObject);
  577. begin
  578.   Update_Group(grid.col,grid.row);
  579.   end;
  580. (*@\\\0000000301*)
  581. (*@/// procedure Taligrid_edit.edt_wh_Change(Sender: TObject); *)
  582. procedure Taligrid_edit.edt_wh_Change(Sender: TObject);
  583. begin
  584.   if changing then EXIT;
  585.   grid.ColWidths[grid.col]:=edt_width.value;
  586.   grid.RowHeights[grid.row]:=edt_height.value;
  587.   end;
  588. (*@\\\0000000401*)
  589.  
  590. (*@/// procedure Taligrid_edit.Update_Group(col,row:longint); *)
  591. procedure Taligrid_edit.Update_Group(col,row:longint);
  592. var
  593.   v:TCellProperties;
  594.   Alignment: TMyAlign;
  595.   wordwrap: t_wordwrap;
  596.   editable: byte;
  597.   font,brush: pointer;
  598.   _grid: THackgrid;
  599. begin
  600.   try
  601.     changing:=true;
  602.     _grid:=THackgrid(grid);
  603.     if (Col>=0) or (Row>=0) then begin
  604.       case grp_what.itemindex of
  605.         0: v:=GetItemCell(Col,Row,_grid.FPropCell);
  606.         1: v:=GetItemCol(Col,_grid.FPropCol);
  607.         2: v:=GetItemCol(Col,_grid.FFPropCol);
  608.         3: v:=GetItemCol(Row,_grid.FPropRow);
  609.         4: v:=GetItemCol(Row,_grid.FFPropRow);
  610.         else  v:=NIL;
  611.         end;
  612. (*@///       Set alignment checks *)
  613. if v=NIL then
  614.   Alignment:=alDefault
  615. else
  616.   Alignment:=v.align;
  617.  
  618. case alignment of
  619.   alRight : btn_right.down:=true;
  620.   alLeft  : btn_left.down:=true;
  621.   alCenter: btn_center.down:=true;
  622.   alDefault: begin
  623.     btn_left.down:=false;
  624.     btn_right.down:=false;
  625.     btn_center.down:=false;
  626.     end;
  627.   end;
  628. (*@\\\0000000201*)
  629. (*@///       Set wordwrap checks *)
  630. if v=NIL then
  631.   Wordwrap:=ww_Default
  632. else
  633.   Wordwrap:=v.wordwrap;
  634.  
  635. case Wordwrap of
  636.   ww_none     : btn_ww_none.down:=true;
  637.   ww_wordwrap : btn_ww_wrap.down:=true;
  638.   ww_ellipsis : btn_ww_elli.down:=true;
  639.   ww_default  : begin
  640.     btn_ww_none.down:=false;
  641.     btn_ww_wrap.down:=false;
  642.     btn_ww_elli.down:=false;
  643.     end;
  644.   end;
  645. (*@\\\*)
  646. (*@///       Set editable checks *)
  647. edt_read.enabled:=(grp_what.itemindex<>2) and (grp_what.itemindex<>4);
  648.  
  649. if (v=NIL) or (grp_what.itemindex=2) or (grp_what.itemindex=4) then
  650.   editable:=0
  651. else
  652.   editable:=v.editable;
  653.  
  654. case editable of
  655.   0: edt_read.state:=cbGrayed;
  656.   2: edt_read.state:=cbUnChecked;
  657.   1: edt_read.state:=cbChecked;
  658.   end;
  659. (*@\\\0000000A04*)
  660. (*@///       Set font checks *)
  661. if v=NIL then
  662.   font:=NIL
  663. else
  664.   font:=v.font;
  665.  
  666. if (font=NIL) or not TMyFont(font).Haschanged then
  667.   btn_font.down:=false
  668. else
  669.   btn_font.down:=true;
  670. (*@\\\*)
  671. (*@///       Set color/brush checks *)
  672. if v=NIL then
  673.   brush:=NIL
  674. else
  675.   brush:=v.brush;
  676.  
  677. if (Brush=NIL) or not TMyBrush(Brush).Haschanged then
  678.   btn_color.down:=false
  679. else
  680.   btn_color.down:=true;
  681. (*@\\\0000000801*)
  682.       edt_width.value :=grid.ColWidths[col] ;
  683.       edt_height.value:=grid.RowHeights[row];
  684.       case grp_what.itemindex of
  685.         0: grp_edit.caption:='Cell '+inttostr(col)+'/'+inttostr(row);
  686.         1: grp_edit.caption:='Column '+inttostr(col);
  687.         2: grp_edit.caption:='Fixed column '+inttostr(col);
  688.         3: grp_edit.caption:='Row '+inttostr(row);
  689.         4: grp_edit.caption:='Fixed Row '+inttostr(row);
  690.         end;
  691.       end;
  692.   finally
  693.     changing:=false;
  694.     end;
  695.   end;
  696. (*@\\\0000001801*)
  697. (*@\\\0000000110*)
  698. (*@\\\0000000B01*)
  699. end.
  700. (*@\\\0001000015000601*)
  701.