View previous topic :: View next topic |
Author |
Message |
Stringer
Joined: 27 Jul 2009 Posts: 8
|
Posted: Tue Jul 28, 2009 5:59 pm Post subject: Change RightMargin behaviour |
|
|
I need to changes in RightMargin behaviour:
1. Smooth moving (one pixel step, not char width).
2. Drag'n'drop with simple click, without Ctrl pressing.
Is it possible? |
|
Back to top |
|
|
Stringer
Joined: 27 Jul 2009 Posts: 8
|
Posted: Wed Jul 29, 2009 1:50 pm Post subject: |
|
|
I have found a solution of both issues in a little bit editing of ecSyntMemo source. But I guess this is an incorrect way. |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Thu Jul 30, 2009 6:13 am Post subject: |
|
|
Hello,
If you get required behavior, please, send me updated source to integrate into working version.
Michael. |
|
Back to top |
|
|
Stringer
Joined: 27 Jul 2009 Posts: 8
|
Posted: Thu Jul 30, 2009 10:21 am Post subject: |
|
|
1.
Code: |
function TCustomSyntaxMemo.DefTextExt: TSize;
<...>
if Result.cx = 0 then
raise Exception.Create('Internal error: DefTextExt.cx = 0');
{$IFDEF DL_MOD_SMOOTH_RIGHTMARGIN}
Result.cx := 1;
{$ENDIF}
end;
|
2.
Code: |
procedure TCustomSyntaxMemo.MouseDown(Button: TMouseButton;
<...>
if ssCtrl in Shift then
begin
FDragStaple := IsOverStaple(X, Y);
if FDragStaple <> nil then Exit;
{$IFDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
end;
{$ENDIF}
FDraggedTextMargin := IsOverRightMargin(X);
if Assigned(FDraggedTextMargin) then
if FDraggedTextMargin.AllowDrag then
Exit
else
FDraggedTextMargin := nil;
{$IFNDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
end;
{$ENDIF}
<...>
end;
|
Code: |
procedure TCustomSyntaxMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
<...>
function CanDragMargin: Boolean;
begin
tm := IsOverRightMargin(X);
{$IFDEF DL_MOD_DRAG_RIGHTMARGIN_NON_CTRL}
Result := Assigned(tm) and tm.AllowDrag;
{$ELSE}
Result := Assigned(tm) and tm.AllowDrag and (ssCtrl in Shift);
{$ENDIF}
end;
<...>
|
All works |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Thu Jul 30, 2009 12:13 pm Post subject: |
|
|
This implementation is not good, because changing DefTextExt will effect on many other items.
Text margins processing was updated. New properties available:
Code: | TecTextMargins:
property AbsolutePos: Boolean; // Position of text margin - absolute
property AllowDrag: Boolean; // when true -dragging defined by individual allow drag
property DragWithCtrl: Boolean; // Drag with pressed control (or without it)
|
To access these properties from IDE updated collection editor property added, so these properties can be edited in object inspector. |
|
Back to top |
|
|
|